Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/20/15 12:16:25 (9 years ago)
Author:
jkarder
Message:

#2077:

  • added background parser to provide code completion for the scripted code
  • minor code changes
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/CodeEditor/HeuristicLab.CodeEditor/3.4/LanguageFeatures/CodeCompletion/CSharp/CSharpCodeCompletionStrategy.cs

    r11738 r11800  
    2626using ICSharpCode.NRefactory.CSharp;
    2727using ICSharpCode.NRefactory.CSharp.Completion;
     28using ICSharpCode.NRefactory.Editor;
    2829using ICSharpCode.NRefactory.TypeSystem;
    2930
     
    9293          }
    9394        }
     95      }
    9496
    95         if (!controlSpace) {
    96           var pce = new CSharpParameterCompletionEngine(
    97             completionContext.Document,
    98             completionContext.CompletionContextProvider,
    99             completionFactory,
    100             completionContext.ProjectContent,
    101             completionContext.TypeResolveContextAtCaret
    102           );
     97      if (!controlSpace) {
     98        var pce = new CSharpParameterCompletionEngine(
     99          completionContext.Document,
     100          completionContext.CompletionContextProvider,
     101          completionFactory,
     102          completionContext.ProjectContent,
     103          completionContext.TypeResolveContextAtCaret
     104        );
    103105
    104           var parameterDataProvider = pce.GetParameterDataProvider(completionContext.Offset, completionChar);
    105           result.OverloadProvider = parameterDataProvider as IUpdatableOverloadProvider;
    106         }
     106        var parameterDataProvider = pce.GetParameterDataProvider(completionContext.Offset, completionChar);
     107        result.OverloadProvider = parameterDataProvider as IUpdatableOverloadProvider;
    107108      }
    108109
    109110      return result;
    110111    }
     112
     113    protected override void DoParseStep() {
     114      var document = (IDocument)codeEditor.Invoke(
     115        (Func<IDocument>)(() => {
     116          var doc = codeEditor.TextEditor.Document;
     117          return new ReadOnlyDocument(doc, doc.FileName);
     118        })
     119      );
     120
     121      var unresolvedFile = CSharpCodeCompletionHelpers.CreateCSharpUnresolvedFile(document);
     122      projectContent = projectContent.AddOrUpdateFiles(unresolvedFile);
     123    }
    111124  }
    112125}
Note: See TracChangeset for help on using the changeset viewer.