[Monodevelop-patches-list] r2723 - in trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor: . Gui InsightWindow
Lluis Sanchez <lluis@ximian.com>
lluis at mono-cvs.ximian.com
Tue Aug 9 19:46:56 EDT 2005
Author: lluis
Date: 2005-08-09 19:46:55 -0400 (Tue, 09 Aug 2005)
New Revision: 2723
Modified:
trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/ChangeLog
trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorDisplayBinding.cs
trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorView.cs
trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/InsightWindow/IndexerInsightDataProvider.cs
trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/InsightWindow/MethodInsightDataProvider.cs
Log:
2005-08-09 Lluis Sanchez Gual <lluis at novell.com>
* InsightWindow/IndexerInsightDataProvider.cs:
* InsightWindow/MethodInsightDataProvider.cs:
* Gui/SourceEditorView.cs: Use the new IParserContext API.
* Gui/SourceEditorDisplayBinding.cs: Implement IEditable.TextChanged.
Modified: trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/ChangeLog
===================================================================
--- trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/ChangeLog 2005-08-09 23:46:20 UTC (rev 2722)
+++ trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/ChangeLog 2005-08-09 23:46:55 UTC (rev 2723)
@@ -1,3 +1,11 @@
+2005-08-09 Lluis Sanchez Gual <lluis at novell.com>
+
+ * InsightWindow/IndexerInsightDataProvider.cs:
+ * InsightWindow/MethodInsightDataProvider.cs:
+ * Gui/SourceEditorView.cs: Use the new IParserContext API.
+
+ * Gui/SourceEditorDisplayBinding.cs: Implement IEditable.TextChanged.
+
2005-08-06 John Luke <john.luke at gmail.com>
* SourceEditor.mdp: update
Modified: trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorDisplayBinding.cs
===================================================================
--- trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorDisplayBinding.cs 2005-08-09 23:46:20 UTC (rev 2722)
+++ trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorDisplayBinding.cs 2005-08-09 23:46:55 UTC (rev 2723)
@@ -464,6 +464,12 @@
se.View.ScrollMarkOnscreen (se.Buffer.InsertMark);
}
}
+
+ public event EventHandler TextChanged {
+ add { se.Buffer.Changed += value; }
+ remove { se.Buffer.Changed -= value; }
+ }
+
#endregion
#region Status Bar Handling
Modified: trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorView.cs
===================================================================
--- trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorView.cs 2005-08-09 23:46:20 UTC (rev 2722)
+++ trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorView.cs 2005-08-09 23:46:55 UTC (rev 2723)
@@ -196,9 +196,28 @@
triggerIter.ForwardChar ();
PrepareCompletionDetails(triggerIter);
- CompletionListWindow.ShowWindow (triggerChar, new CodeCompletionDataProvider (true), this, this.ParentEditor.DisplayBinding.Project, this.ParentEditor.DisplayBinding.ContentName);
+ CompletionListWindow.ShowWindow (triggerChar, GetCodeCompletionDataProvider (true), this);
}
+ IParserContext GetParserContext ()
+ {
+ string file = ParentEditor.DisplayBinding.IsUntitled ? ParentEditor.DisplayBinding.UntitledName : ParentEditor.DisplayBinding.ContentName;
+ Project project = ParentEditor.DisplayBinding.Project;
+ IParserDatabase pdb = Runtime.ProjectService.ParserDatabase;
+
+ if (project != null)
+ return pdb.GetProjectParserContext (project);
+ else
+ return pdb.GetFileParserContext (file);
+ }
+
+ CodeCompletionDataProvider GetCodeCompletionDataProvider (bool ctrl)
+ {
+ IParserContext ctx = GetParserContext ();
+ string file = ParentEditor.DisplayBinding.IsUntitled ? ParentEditor.DisplayBinding.UntitledName : ParentEditor.DisplayBinding.ContentName;
+ return new CodeCompletionDataProvider (ctx, file, ctrl);
+ }
+
bool MonodocResolver ()
{
TextIter insertIter = buf.GetIterAtMark (buf.InsertMark);
@@ -225,13 +244,12 @@
return false;
}
insertIter = triggerIter;
- IParserService parser = (IParserService)ServiceManager.GetService (typeof (IParserService));
string fileName = ParentEditor.DisplayBinding.ContentName;
- IExpressionFinder expressionFinder = parser.GetExpressionFinder(fileName);
+ IExpressionFinder expressionFinder = GetParserContext ().GetExpressionFinder(fileName);
string expression = expressionFinder == null ? TextUtilities.GetExpressionBeforeOffset(this, insertIter.Offset) : expressionFinder.FindExpression(buf.GetText(buf.StartIter, insertIter, true), insertIter.Offset - 2);
if (expression == null) return false;
Console.WriteLine ("Expression: {" + expression + "}");
- string type = parser.MonodocResolver (ParentEditor.DisplayBinding.Project, expression, insertIter.Line + 1, insertIter.LineOffset + 1, fileName, buf.Text);
+ string type = GetParserContext ().MonodocResolver (expression, insertIter.Line + 1, insertIter.LineOffset + 1, fileName, buf.Text);
if (type == null || type.Length == 0)
return false;
@@ -377,7 +395,7 @@
bool retval = base.OnKeyPressEvent (evnt);
if (EnableCodeCompletion && PeekCharIsWhitespace ()) {
PrepareCompletionDetails(buf.GetIterAtMark (buf.InsertMark));
- CompletionListWindow.ShowWindow ((char)key, new CodeCompletionDataProvider (), this, this.ParentEditor.DisplayBinding.Project, this.ParentEditor.DisplayBinding.ContentName);
+ CompletionListWindow.ShowWindow ((char)key, GetCodeCompletionDataProvider (false), this);
}
return retval;
/*case '(':
Modified: trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/InsightWindow/IndexerInsightDataProvider.cs
===================================================================
--- trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/InsightWindow/IndexerInsightDataProvider.cs 2005-08-09 23:46:20 UTC (rev 2722)
+++ trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/InsightWindow/IndexerInsightDataProvider.cs 2005-08-09 23:46:55 UTC (rev 2723)
@@ -61,11 +61,17 @@
// the parser works with 1 based coordinates
int caretLineNumber = initialIter.Line + 1;
int caretColumn = initialIter.LineOffset + 1;
- IParserService parserService = (IParserService)ServiceManager.GetService(typeof(IParserService));
- ResolveResult results = parserService.Resolve(project, methodObject, caretLineNumber, caretColumn, fileName, textArea.Buffer.Text);
+ IParserContext parserContext;
+ if (project != null)
+ parserContext = Runtime.ProjectService.ParserDatabase.GetProjectParserContext (project);
+ else
+ parserContext = Runtime.ProjectService.ParserDatabase.GetFileParserContext (fileName);
+
+ ResolveResult results = parserContext.Resolve (methodObject, caretLineNumber, caretColumn, fileName, textArea.Buffer.Text);
+
if (results != null && results.Type != null) {
- foreach (IClass c in parserService.GetClassInheritanceTree (project, results.Type)) {
+ foreach (IClass c in parserContext.GetClassInheritanceTree (results.Type)) {
foreach (IIndexer indexer in c.Indexer) {
methods.Add(indexer);
}
Modified: trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/InsightWindow/MethodInsightDataProvider.cs
===================================================================
--- trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/InsightWindow/MethodInsightDataProvider.cs 2005-08-09 23:46:20 UTC (rev 2722)
+++ trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/InsightWindow/MethodInsightDataProvider.cs 2005-08-09 23:46:55 UTC (rev 2723)
@@ -86,14 +86,20 @@
methodObject = words[words.Length - 1];
}
}
- IParserService parserService = (IParserService)ServiceManager.GetService(typeof(IParserService));
- ResolveResult results = parserService.Resolve(project, methodObject, caretLineNumber, caretColumn, fileName, text);
+ IParserContext parserContext;
+ if (project != null)
+ parserContext = Runtime.ProjectService.ParserDatabase.GetProjectParserContext (project);
+ else
+ parserContext = Runtime.ProjectService.ParserDatabase.GetFileParserContext (fileName);
+
+ ResolveResult results = parserContext.Resolve (methodObject, caretLineNumber, caretColumn, fileName, text);
+
if (results != null && results.Type != null) {
if (contructorInsight) {
AddConstructors(results.Type);
} else {
- foreach (IClass c in parserService.GetClassInheritanceTree (project, results.Type)) {
+ foreach (IClass c in parserContext.GetClassInheritanceTree (results.Type)) {
AddMethods(c, methodName, false);
}
}
More information about the Monodevelop-patches-list
mailing list