[Monodevelop-patches-list] r1269 - in trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor: . CodeCompletion

commit-watcher at mono-cvs.ximian.com commit-watcher at mono-cvs.ximian.com
Sat Mar 27 18:21:14 EST 2004


Author: tberman
Date: 2004-03-27 18:21:14 -0500 (Sat, 27 Mar 2004)
New Revision: 1269

Modified:
   trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/ChangeLog
   trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/CodeCompletionDataProvider.cs
Log:
using ExpressionFinder if it exists.


Modified: trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/ChangeLog
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/ChangeLog	2004-03-27 23:03:30 UTC (rev 1268)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/ChangeLog	2004-03-27 23:21:14 UTC (rev 1269)
@@ -1,3 +1,8 @@
+2004-03-27  Todd berman  <tberman at sevenl.net>
+
+	* CodeCompletion/CodeCompletionDataProvider.cs: use the
+	ExpressionFinder if it exists.
+
 2004-03-27  Todd Berman  <tberman at sevenl.net>
 
 	* CodeCompletion/CodeCompletionDataProvider.cs: add refactorying of

Modified: trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/CodeCompletionDataProvider.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/CodeCompletionDataProvider.cs	2004-03-27 23:03:30 UTC (rev 1268)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/CodeCompletionDataProvider.cs	2004-03-27 23:21:14 UTC (rev 1269)
@@ -59,40 +59,21 @@
 			
 			caretLineNumber      = insertIter.Line + 1;
 			caretColumn          = insertIter.LineOffset + 1;
-			string expression    = TextUtilities.GetExpressionBeforeOffset (textArea, insertIter.Offset);
+			//string expression    = TextUtilities.GetExpressionBeforeOffset (textArea, insertIter.Offset);
 			ResolveResult results;
 			
-			if (expression.Length == 0) {
-				return null;
-			}
-			
-			IParserService           parserService           = (IParserService)MonoDevelop.Core.Services.ServiceManager.Services.GetService(typeof(IParserService));
+			IParserService parserService = (IParserService)MonoDevelop.Core.Services.ServiceManager.Services.GetService(typeof(IParserService));
+			IExpressionFinder expressionFinder = parserService.GetExpressionFinder(fileName);
+			string expression    = expressionFinder == null ? TextUtilities.GetExpressionBeforeOffset(textArea, insertIter.Offset) : expressionFinder.FindExpression(textArea.Buffer.GetText(textArea.Buffer.StartIter, insertIter, true), insertIter.Offset - 2);
+			Console.WriteLine ("Expression: >{0}<", expression);
 			if (charTyped == ' ') {
 				if (expression == "using" || expression.EndsWith(" using") || expression.EndsWith("\tusing")|| expression.EndsWith("\nusing")|| expression.EndsWith("\rusing")) {
 					string[] namespaces = parserService.GetNamespaceList("");
-//					AddResolveResults(new ResolveResult(namespaces, ShowMembers.Public));
 					AddResolveResults(new ResolveResult(namespaces));
-//					IParseInformation info = parserService.GetParseInformation(fileName);
-//					ICompilationUnit unit = info.BestCompilationUnit as ICompilationUnit;
-//					if (unit != null) {
-//						foreach (IUsing u in unit.Usings) {
-//							if (u.Region.IsInside(caretLineNumber, caretColumn)) {
-//								foreach (string usingStr in u.Usings) {
-//									results = parserService.Resolve(usingStr, caretLineNumber, caretColumn, fileName);
-//									AddResolveResults(results);
-//								}
-//								if (u.Aliases[""] != null) {
-//									results = parserService.Resolve(u.Aliases[""].ToString(), caretLineNumber, caretColumn, fileName);
-//									AddResolveResults(results);
-//								}
-//							}
-//						}
-//					}
 				}
 			} else {
 				//FIXME: I added the null check, #D doesnt need it, why do we?
 				if (fileName != null) {
-					//Console.WriteLine ("resolve " + lang);
 					results = parserService.Resolve(expression, 
 				                                caretLineNumber,
 				                                caretColumn,




More information about the Monodevelop-patches-list mailing list