Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Bockover <abock@xamarin.com>2014-10-06 04:40:31 +0400
committerAaron Bockover <abock@xamarin.com>2014-10-06 04:41:38 +0400
commit511ebcc68e93e73dae01affc1cb00a935c352e81 (patch)
tree37f2e42af95b379e4f6705cb26fd4bbf77d5ea53
parent779f7bb209f976f588769b9332b34bd9d90da028 (diff)
CSharpCompletionTextEditorExtension: make Compilation virtual
Previously the compilation was pulled from Document. Hoist the Document.Compliation getter logic into the completion extension, and fall back to ProjectContent.CreateCompilation directly if there’s no Project. This allows documents without projects to control their references.
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Completion/CSharpCompletionTextEditorExtension.cs12
1 files changed, 5 insertions, 7 deletions
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Completion/CSharpCompletionTextEditorExtension.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Completion/CSharpCompletionTextEditorExtension.cs
index 2a378a1020..6e1134678f 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Completion/CSharpCompletionTextEditorExtension.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Completion/CSharpCompletionTextEditorExtension.cs
@@ -110,10 +110,8 @@ namespace MonoDevelop.CSharp.Completion
}
}
- public ICompilation Compilation {
- get {
- return document.Compilation;
- }
+ public virtual ICompilation Compilation {
+ get { return Project != null ? TypeSystemService.GetCompilation (Project) : ProjectContent.CreateCompilation (); }
}
public MonoDevelop.Projects.Project Project {
@@ -171,7 +169,7 @@ namespace MonoDevelop.CSharp.Completion
var parsedDocument = document.ParsedDocument;
if (parsedDocument != null) {
this.Unit = parsedDocument.GetAst<SyntaxTree> ();
- this.UnresolvedFileCompilation = Document.Compilation;
+ this.UnresolvedFileCompilation = Compilation;
this.CSharpUnresolvedFile = parsedDocument.ParsedFile as CSharpUnresolvedFile;
if (addEventHandlersInInitialization)
document.Editor.Caret.PositionChanged += HandlePositionChanged;
@@ -258,7 +256,7 @@ namespace MonoDevelop.CSharp.Completion
this.Unit = newDocument.GetAst<SyntaxTree> ();
this.CSharpUnresolvedFile = newDocument.ParsedFile as CSharpUnresolvedFile;
- this.UnresolvedFileCompilation = Document.Compilation;
+ this.UnresolvedFileCompilation = Compilation;
if (TypeSegmentTreeUpdated != null)
TypeSegmentTreeUpdated (this, EventArgs.Empty);
}
@@ -643,7 +641,7 @@ namespace MonoDevelop.CSharp.Completion
var result = new List<string> ();
while (scope != null) {
result.Add (scope.NamespaceName);
- var ctx = CSharpUnresolvedFile.GetResolver (Document.Compilation, scope.Region.Begin);
+ var ctx = CSharpUnresolvedFile.GetResolver (Compilation, scope.Region.Begin);
foreach (var u in scope.Usings) {
var ns = u.ResolveNamespace (ctx);
if (ns == null)