[svn] r6656: vs-plugin/trunk: Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.Type.n Nemerle....

IT svnadmin at nemerle.org
Fri Sep 15 06:56:29 CEST 2006


Log:
Working on the method parameter tips.

Author: IT
Date: Fri Sep 15 06:56:25 2006
New Revision: 6656

Modified:
   vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.Type.n
   vs-plugin/trunk/Nemerle.VsIntegration/NemerleScanner.cs

Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.Type.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.Type.n	(original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.Type.n	Fri Sep 15 06:56:25 2006
@@ -206,11 +206,41 @@
     )
       : list[MethodTipInfo]
     {
-      def (_, obj) = FindObject(typeDecl, fileIndex, line, col, getText);
+      def typeBuilder = typeDecl.Builder;
+      def member      = typeBuilder.GetActiveMember(fileIndex, line, col);
 
-      _ = obj;
+      match (member)
+      {
+        | method is MethodBuilder => 
+          def loc = method.BodyLocation;
+          
+          if (loc.Contains(line, col)) // completion in method body
+          {
+            def bodyCode       = getText(loc.Line, loc.Column, loc.EndLine, loc.EndColumn);
+            def completionCode = getText(loc.Line, loc.Column, line, col);
+
+            def pos = completionCode.LastIndexOf('(');
+
+            if (pos > 0)
+            {
+              // This primitive step back should be replaced with something more intelligent
+              // handling brackets and, strings like "".Substring("".Substring(0).Length)
+              //
+              def code   = completionCode.Substring(0, pos).TrimEnd(' ', '\t', '\r', '\n');
+              def result = _engine.RunCompletionEngine(method, bodyCode, code.Length);
 
+              if (result != null)
+              {
       ([])
     }
+              else ([])
+            }
+            else ([])
+          }
+          else ([])
+        | null => ([])
+        | _ => throw System.Exception($"Unknown member type '$member'.");
+      }
+    }
   }
 }

Modified: vs-plugin/trunk/Nemerle.VsIntegration/NemerleScanner.cs
==============================================================================
--- vs-plugin/trunk/Nemerle.VsIntegration/NemerleScanner.cs	(original)
+++ vs-plugin/trunk/Nemerle.VsIntegration/NemerleScanner.cs	Fri Sep 15 06:56:25 2006
@@ -100,7 +100,7 @@
 
 				case SyntaxType.Comment:
 					tokenInfo.Color = TokenColor.Comment;
-					tokenInfo.Type  = state == 0 ? TokenType.LineComment : TokenType.Comment;
+					tokenInfo.Type  = state == 0? TokenType.LineComment : TokenType.Comment;
 					break;
 
 				case SyntaxType.CharLiteral:



More information about the svn mailing list