Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/07/15 14:26:44 (9 years ago)
Author:
jkarder
Message:

#2419: refactored CodeCompletionStrategy and CSharpCodeCompletionStrategy

Location:
trunk/sources/HeuristicLab.CodeEditor/3.4/LanguageFeatures/CodeCompletion
Files:
2 edited

Legend:

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

    r12012 r12646  
    2020#endregion
    2121
    22 using System;
    2322using System.Collections.Generic;
    2423using System.Linq;
     
    2625using ICSharpCode.NRefactory.CSharp;
    2726using ICSharpCode.NRefactory.CSharp.Completion;
    28 using ICSharpCode.NRefactory.Editor;
    2927using ICSharpCode.NRefactory.TypeSystem;
    3028
     
    112110
    113111    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 
     112      if (document == null) return;
    121113      var unresolvedFile = CSharpParsingHelpers.CreateCSharpUnresolvedFile(document);
    122114      projectContent = projectContent.AddOrUpdateFiles(unresolvedFile);
  • trunk/sources/HeuristicLab.CodeEditor/3.4/LanguageFeatures/CodeCompletion/CodeCompletionStrategy.cs

    r12012 r12646  
    2020#endregion
    2121
     22using System;
    2223using System.Linq;
    2324using System.Threading;
    2425using System.Threading.Tasks;
    2526using ICSharpCode.AvalonEdit.CodeCompletion;
     27using ICSharpCode.NRefactory.Editor;
    2628
    2729namespace HeuristicLab.CodeEditor {
     
    2931    protected readonly CodeEditor codeEditor;
    3032    protected readonly Task backgroundParser;
     33    protected IDocument document;
    3134
    3235    protected CodeCompletionStrategy(CodeEditor codeEditor) {
    3336      this.codeEditor = codeEditor;
     37      this.codeEditor.TextEditorTextChanged += codeEditor_TextEditorTextChanged;
    3438      backgroundParser = new Task(DoBackgroundParsing);
    3539    }
     
    9599      }
    96100    }
     101
     102    private void codeEditor_TextEditorTextChanged(object sender, EventArgs e) {
     103      var doc = codeEditor.TextEditor.Document;
     104      document = new ReadOnlyDocument(doc, doc.FileName);
     105    }
    97106  }
    98107}
Note: See TracChangeset for help on using the changeset viewer.