diff options
author | Mike Krüger <mkrueger@xamarin.com> | 2012-08-10 13:31:18 +0400 |
---|---|---|
committer | Mike Krüger <mkrueger@xamarin.com> | 2012-08-10 13:31:18 +0400 |
commit | db9dfd104e841287a7336fe222d1350ad6ee5088 (patch) | |
tree | a98695db058d67d0c73f71d385cba0f73080acfa /main/contrib | |
parent | 59d0a3663c700f105824abb16ff436e2cd1a6a34 (diff) |
* CSharpParser.cs:
* ICompletionContextProvider.cs:
* CSharpCompletionEngineBase.cs: Fixed 'Bug 6414 - Code completion
fail inside #if DEBUG'.
* CSharpCompletionTextEditorExtension.cs: Fixed 'Bug 6414 - Code
completion fail inside #if DEBUG '.
Diffstat (limited to 'main/contrib')
3 files changed, 15 insertions, 1 deletions
diff --git a/main/contrib/ICSharpCode.NRefactory.CSharp/Completion/CSharpCompletionEngineBase.cs b/main/contrib/ICSharpCode.NRefactory.CSharp/Completion/CSharpCompletionEngineBase.cs index 3ffa14a9c5..77cb83cba7 100644 --- a/main/contrib/ICSharpCode.NRefactory.CSharp/Completion/CSharpCompletionEngineBase.cs +++ b/main/contrib/ICSharpCode.NRefactory.CSharp/Completion/CSharpCompletionEngineBase.cs @@ -684,7 +684,11 @@ namespace ICSharpCode.NRefactory.CSharp.Completion using (var stream = new System.IO.StringReader (wrapper.ToString ())) { try { var parser = new CSharpParser (); + foreach (var sym in CompletionContextProvider.ConditionalSymbols) { + parser.CompilerSettings.ConditionalSymbols.Add (sym); + } var result = parser.Parse(stream, "stub.cs", memberLocation.Line - 1 - generatedLines); + return result; } catch (Exception) { Console.WriteLine("------"); diff --git a/main/contrib/ICSharpCode.NRefactory.CSharp/Completion/ICompletionContextProvider.cs b/main/contrib/ICSharpCode.NRefactory.CSharp/Completion/ICompletionContextProvider.cs index b477dc1bbf..f0d9d34b9b 100644 --- a/main/contrib/ICSharpCode.NRefactory.CSharp/Completion/ICompletionContextProvider.cs +++ b/main/contrib/ICSharpCode.NRefactory.CSharp/Completion/ICompletionContextProvider.cs @@ -35,6 +35,10 @@ namespace ICSharpCode.NRefactory.CSharp.Completion { public interface ICompletionContextProvider { + IList<string> ConditionalSymbols { + get; + } + void GetCurrentMembers (int offset, out IUnresolvedTypeDefinition currentType, out IUnresolvedMember currentMember); Tuple<string, TextLocation> GetMemberTextToCaret(int caretOffset, IUnresolvedTypeDefinition currentType, IUnresolvedMember currentMember); @@ -47,6 +51,12 @@ namespace ICSharpCode.NRefactory.CSharp.Completion readonly IDocument document; readonly CSharpParsedFile parsedFile; + public IList<string> ConditionalSymbols { + get { + return new string[0]; + } + } + public DefaultCompletionContextProvider (IDocument document, CSharpParsedFile parsedFile) { if (document == null) diff --git a/main/contrib/ICSharpCode.NRefactory.CSharp/Parser/CSharpParser.cs b/main/contrib/ICSharpCode.NRefactory.CSharp/Parser/CSharpParser.cs index 8ecaec6236..9a1b8f8569 100644 --- a/main/contrib/ICSharpCode.NRefactory.CSharp/Parser/CSharpParser.cs +++ b/main/contrib/ICSharpCode.NRefactory.CSharp/Parser/CSharpParser.cs @@ -3746,7 +3746,7 @@ namespace ICSharpCode.NRefactory.CSharp } conversionVisitor.Unit.FileName = fileName; - conversionVisitor.Unit.ConditionalSymbols = top.Conditionals.ToArray (); + conversionVisitor.Unit.ConditionalSymbols = top.Conditionals.Concat (compilerSettings.ConditionalSymbols).ToArray (); return conversionVisitor.Unit; } |