Changeset 11800 for branches/CodeEditor/HeuristicLab.CodeEditor/3.4/LanguageFeatures/CodeCompletion/CodeCompletionStrategy.cs
- Timestamp:
- 01/20/15 12:16:25 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/CodeEditor/HeuristicLab.CodeEditor/3.4/LanguageFeatures/CodeCompletion/CodeCompletionStrategy.cs
r11700 r11800 21 21 22 22 using System.Linq; 23 using System.Threading; 24 using System.Threading.Tasks; 23 25 using ICSharpCode.AvalonEdit.CodeCompletion; 24 26 … … 26 28 internal abstract class CodeCompletionStrategy : ICodeCompletionStrategy { 27 29 protected readonly CodeEditor codeEditor; 30 protected readonly Task backgroundParser; 28 31 29 32 protected CodeCompletionStrategy(CodeEditor codeEditor) { 30 33 this.codeEditor = codeEditor; 34 backgroundParser = new Task(DoBackgroundParsing); 31 35 } 32 36 … … 36 40 } 37 41 42 public virtual void RunBackgroundParser() { 43 backgroundParser.Start(); 44 } 45 38 46 protected abstract CodeCompletionResult GetCodeCompletionResult(bool controlSpace); 47 protected abstract void DoParseStep(); 39 48 40 49 protected virtual void ApplyCodeCompletionData(CodeCompletionResult codeCompletionResult) { … … 57 66 58 67 var data = cw.CompletionList.CompletionData; 59 foreach (var completion in codeCompletionResult.CompletionData.OrderBy(x => x.Text)) 68 var newData = codeCompletionResult.CompletionData.OrderBy(x => x.Text).ToArray(); 69 foreach (var completion in newData) 60 70 data.Add(completion); 61 71 … … 77 87 } 78 88 } 89 90 protected virtual void DoBackgroundParsing() { 91 while (!codeEditor.IsDisposed) { 92 DoParseStep(); 93 Thread.Sleep(1000); 94 } 95 } 79 96 } 80 97 }
Note: See TracChangeset
for help on using the changeset viewer.