Changeset 15973 for branches/2522_RefactorPluginInfrastructure/HeuristicLab.CodeEditor/3.4/LanguageFeatures/CodeCompletion
- Timestamp:
- 06/28/18 11:13:37 (6 years ago)
- Location:
- branches/2522_RefactorPluginInfrastructure
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2522_RefactorPluginInfrastructure
- Property svn:ignore
-
old new 24 24 protoc.exe 25 25 obj 26 .vs
-
- Property svn:mergeinfo changed
- Property svn:ignore
-
branches/2522_RefactorPluginInfrastructure/HeuristicLab.CodeEditor/3.4/LanguageFeatures/CodeCompletion/CSharp/CSharpCodeCompletionContext.cs
r12012 r15973 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/2522_RefactorPluginInfrastructure/HeuristicLab.CodeEditor/3.4/LanguageFeatures/CodeCompletion/CSharp/CSharpCodeCompletionDataFactory.cs
r12012 r15973 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/2522_RefactorPluginInfrastructure/HeuristicLab.CodeEditor/3.4/LanguageFeatures/CodeCompletion/CSharp/CSharpCodeCompletionStrategy.cs
r12646 r15973 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 44 44 var document = codeEditor.TextEditor.Document; 45 45 int offset = codeEditor.TextEditor.CaretOffset; 46 var result = new CodeCompletionResult(); 46 47 47 var result = new CodeCompletionResult(); 48 var completionContext = new CSharpCodeCompletionContext(document, offset, projectContent); 49 var completionFactory = new CSharpCodeCompletionDataFactory(completionContext); 50 var cce = new CSharpCompletionEngine( 51 completionContext.Document, 52 completionContext.CompletionContextProvider, 53 completionFactory, 54 completionContext.ProjectContent, 55 completionContext.TypeResolveContextAtCaret 56 ); 57 58 char completionChar = completionContext.Document.GetCharAt(completionContext.Offset - 1); 59 int startPos, triggerWordLength; 60 IEnumerable<ICompletionData> completionData; 61 62 if (controlSpace) { 63 if (!cce.TryGetCompletionWord(completionContext.Offset, out startPos, out triggerWordLength)) { 64 startPos = completionContext.Offset; 65 triggerWordLength = 0; 66 } 67 completionData = cce.GetCompletionData(startPos, true); 68 } else { 69 startPos = completionContext.Offset; 70 if (char.IsLetterOrDigit(completionChar) || completionChar == '_') { 71 if (startPos > 1 && char.IsLetterOrDigit(completionContext.Document.GetCharAt((startPos - 2)))) 72 return result; 73 completionData = cce.GetCompletionData(startPos, false); 74 triggerWordLength = 1; 75 } else { 76 completionData = cce.GetCompletionData(startPos, false); 77 triggerWordLength = 0; 78 } 79 } 80 81 result.TriggerWordLength = triggerWordLength; 82 result.TriggerWord = completionContext.Document.GetText(completionContext.Offset - triggerWordLength, triggerWordLength); 83 84 if (completionData.Any() && cce.AutoCompleteEmptyMatch) { 85 foreach (var completion in completionData) { 86 var cast = completion as CompletionData; 87 if (cast != null) { 88 cast.TriggerWord = result.TriggerWord; 89 cast.TriggerWordLength = result.TriggerWordLength; 90 result.CompletionData.Add(cast); 91 } 92 } 93 } 94 95 if (!controlSpace) { 96 var pce = new CSharpParameterCompletionEngine( 48 try { 49 var completionContext = new CSharpCodeCompletionContext(document, offset, projectContent); 50 var completionFactory = new CSharpCodeCompletionDataFactory(completionContext); 51 var cce = new CSharpCompletionEngine( 97 52 completionContext.Document, 98 53 completionContext.CompletionContextProvider, … … 100 55 completionContext.ProjectContent, 101 56 completionContext.TypeResolveContextAtCaret 102 );57 ); 103 58 104 var parameterDataProvider = pce.GetParameterDataProvider(completionContext.Offset, completionChar); 105 result.OverloadProvider = parameterDataProvider as IUpdatableOverloadProvider; 59 char completionChar = completionContext.Document.GetCharAt(completionContext.Offset - 1); 60 int startPos, triggerWordLength; 61 IEnumerable<ICompletionData> completionData; 62 63 if (controlSpace) { 64 if (!cce.TryGetCompletionWord(completionContext.Offset, out startPos, out triggerWordLength)) { 65 startPos = completionContext.Offset; 66 triggerWordLength = 0; 67 } 68 completionData = cce.GetCompletionData(startPos, true); 69 } else { 70 startPos = completionContext.Offset; 71 if (char.IsLetterOrDigit(completionChar) || completionChar == '_') { 72 if (startPos > 1 && char.IsLetterOrDigit(completionContext.Document.GetCharAt((startPos - 2)))) 73 return result; 74 completionData = cce.GetCompletionData(startPos, false); 75 triggerWordLength = 1; 76 } else { 77 completionData = cce.GetCompletionData(startPos, false); 78 triggerWordLength = 0; 79 } 80 } 81 82 result.TriggerWordLength = triggerWordLength; 83 result.TriggerWord = completionContext.Document.GetText(completionContext.Offset - triggerWordLength, triggerWordLength); 84 85 if (completionData.Any() && cce.AutoCompleteEmptyMatch) { 86 foreach (var completion in completionData) { 87 var cast = completion as CompletionData; 88 if (cast != null) { 89 cast.TriggerWord = result.TriggerWord; 90 cast.TriggerWordLength = result.TriggerWordLength; 91 result.CompletionData.Add(cast); 92 } 93 } 94 } 95 96 if (!controlSpace) { 97 var pce = new CSharpParameterCompletionEngine( 98 completionContext.Document, 99 completionContext.CompletionContextProvider, 100 completionFactory, 101 completionContext.ProjectContent, 102 completionContext.TypeResolveContextAtCaret 103 ); 104 105 var parameterDataProvider = pce.GetParameterDataProvider(completionContext.Offset, completionChar); 106 result.OverloadProvider = parameterDataProvider as IUpdatableOverloadProvider; 107 } 108 } catch { 109 // ignore exceptions thrown during code completion 106 110 } 107 111 -
branches/2522_RefactorPluginInfrastructure/HeuristicLab.CodeEditor/3.4/LanguageFeatures/CodeCompletion/CSharp/CSharpDocumentationBuilder.cs
r11804 r15973 19 19 20 20 /* HeuristicLab 21 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)21 * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 22 22 * 23 23 * This file is part of HeuristicLab. -
branches/2522_RefactorPluginInfrastructure/HeuristicLab.CodeEditor/3.4/LanguageFeatures/CodeCompletion/CSharp/CSharpInsightItem.cs
r11804 r15973 19 19 20 20 /* HeuristicLab 21 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)21 * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 22 22 * 23 23 * This file is part of HeuristicLab. -
branches/2522_RefactorPluginInfrastructure/HeuristicLab.CodeEditor/3.4/LanguageFeatures/CodeCompletion/CSharp/CSharpOverloadProvider.cs
r12012 r15973 21 21 22 22 /* HeuristicLab 23 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)23 * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 24 24 * 25 25 * This file is part of HeuristicLab. -
branches/2522_RefactorPluginInfrastructure/HeuristicLab.CodeEditor/3.4/LanguageFeatures/CodeCompletion/CSharp/CompletionData/CodeCompletionData.cs
r12012 r15973 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/2522_RefactorPluginInfrastructure/HeuristicLab.CodeEditor/3.4/LanguageFeatures/CodeCompletion/CSharp/CompletionData/EntityCompletionData.cs
r12012 r15973 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/2522_RefactorPluginInfrastructure/HeuristicLab.CodeEditor/3.4/LanguageFeatures/CodeCompletion/CSharp/CompletionData/Images/CompletionImage.cs
r12012 r15973 4 4 5 5 /* HeuristicLab 6 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)6 * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 7 7 * 8 8 * This file is part of HeuristicLab. -
branches/2522_RefactorPluginInfrastructure/HeuristicLab.CodeEditor/3.4/LanguageFeatures/CodeCompletion/CSharp/CompletionData/VariableCompletionData.cs
r12012 r15973 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/2522_RefactorPluginInfrastructure/HeuristicLab.CodeEditor/3.4/LanguageFeatures/CodeCompletion/CodeCompletionResult.cs
r12012 r15973 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/2522_RefactorPluginInfrastructure/HeuristicLab.CodeEditor/3.4/LanguageFeatures/CodeCompletion/CodeCompletionStrategy.cs
r12654 r15973 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab.
Note: See TracChangeset
for help on using the changeset viewer.