[svn] r6660: vs-plugin/trunk: Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/MethodTipInfo.n Nemerle...

IT svnadmin at nemerle.org
Mon Sep 18 01:00:43 CEST 2006


Log:
Working on the method parameter tips.

Author: IT
Date: Mon Sep 18 01:00:39 2006
New Revision: 6660

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

Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/MethodTipInfo.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/MethodTipInfo.n	(original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/MethodTipInfo.n	Mon Sep 18 01:00:39 2006
@@ -65,10 +65,25 @@
       _methods[index].Name;
     }
 
-    public GetMethodLocation() : Location
+    public delegate StartName      (location : Location, name : string) : void;
+    public delegate StartParameters(location : Location)                : void;
+
+    public SetCurrentCall(
+      line            : int,
+      col             : int,
+      startName       : StartName,
+      startParameters : StartParameters
+    )
+      : void
     {
       def memberName = GetName(0);
 
+      def findRoundGroup(tokens)
+      {
+      | h :: t => if (h is Token.RoundGroup) tokens else findRoundGroup(t)
+      | _      => []
+      }
+
       def findIdentifier(token : Token)
       {
       | Identifier(name) when name == memberName && token.Next == null => token
@@ -82,19 +97,19 @@
       | _                         => null
       }
 
-      def findBeforeRoundGroup(tokens)
+      match (findRoundGroup(_tokens))
       {
-      | h :: t => if (h is Token.RoundGroup) t else findBeforeRoundGroup(t)
-      | _ => []
-      }
+      | rg :: prev :: _ =>
 
-      def token = match (findBeforeRoundGroup(_tokens))
-      {
-      | t :: _ => findIdentifier(t)
-      | _      => null
-      }
+        def token = findIdentifier(prev);
+
+        startName      (token.Location, memberName);
+        startParameters(rg.Location);
 
-      if (token == null) Location() else token.Location
+      | _ =>
+        def loc = Location(_tokens.Head.Location.FileIndex, line, col - 1, line, col + 1);
+        startName(loc, memberName);
+      }
     }
   }
 }

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	Mon Sep 18 01:00:39 2006
@@ -206,6 +206,9 @@
     )
       : MethodTipInfo
     {
+      when (col == 21)
+        _=col.ToString();
+
       def typeBuilder = typeDecl.Builder;
       def member      = typeBuilder.GetActiveMember(fileIndex, line, col);
 

Modified: vs-plugin/trunk/Nemerle.VsIntegration/NemerleLanguage.cs
==============================================================================
--- vs-plugin/trunk/Nemerle.VsIntegration/NemerleLanguage.cs	(original)
+++ vs-plugin/trunk/Nemerle.VsIntegration/NemerleLanguage.cs	Mon Sep 18 01:00:39 2006
@@ -184,12 +184,7 @@
 					_request.FileName,
 					delegate(CompilerMessage cm)
 					{
-						TextSpan ts = new TextSpan();
-
-						ts.iStartLine  = cm.Location.Line      - 1;
-						ts.iEndLine    = cm.Location.EndLine   - 1;
-						ts.iStartIndex = cm.Location.Column    - 1;
-						ts.iEndIndex   = cm.Location.EndColumn - 1;
+						TextSpan ts = Convert(cm.Location);
 
 						_request.Sink.AddError(
 							_request.FileName,
@@ -263,27 +258,15 @@
 
 			if (methods != null)
 			{
-				TextSpan ts  = new TextSpan();
-				Location loc = methods.GetMethodLocation();
-
-				if (loc.EndLine == 0)
+				methods.SetCurrentCall(_request.Line + 1, _request.Col + 1,
+					delegate(Location loc, string name)
 				{
-					ts.iStartLine  = _request.Line;
-					ts.iEndLine    = _request.Line;
-					ts.iStartIndex = _request.Col - 1;
-					ts.iEndIndex   = _request.Col + 1;
-				}
-				else
+						_request.Sink.StartName(Convert(loc), name);
+					},
+					delegate(Location loc)
 				{
-					ts.iStartLine  = loc.Line      - 1;
-					ts.iEndLine    = loc.EndLine   - 1;
-					ts.iStartIndex = loc.Column    - 1;
-					ts.iEndIndex   = loc.EndColumn - 1;
-				}
-
-				_request.Sink.StartName(ts, methods.GetName(0));
-				//_request.Sink.QualifyName(ts, ts, methods.GetName(0));
-				_request.Sink.StartParameters(ts);
+						_request.Sink.StartParameters(Convert(loc));
+					});
 
 				return new NemerleAuthoringScope(
 					ProjectInfo.FindProject(_request.FileName),
@@ -327,6 +310,18 @@
 			return projectInfo;
 		}
 
+		private TextSpan Convert(Location location)
+		{
+			TextSpan ts = new TextSpan();
+
+			ts.iStartLine  = location.Line      - 1;
+			ts.iEndLine    = location.EndLine   - 1;
+			ts.iStartIndex = location.Column    - 1;
+			ts.iEndIndex   = location.EndColumn - 1;
+
+			return ts;
+		}
+
 		#endregion
 
 		public override ImageList GetImageList()

Modified: vs-plugin/trunk/Nemerle.VsIntegration/NemerleMethods.cs
==============================================================================
--- vs-plugin/trunk/Nemerle.VsIntegration/NemerleMethods.cs	(original)
+++ vs-plugin/trunk/Nemerle.VsIntegration/NemerleMethods.cs	Mon Sep 18 01:00:39 2006
@@ -52,9 +52,13 @@
 			return _info.GetName(index);
 		}
 
-		public Location GetMethodLocation()
+		public void SetCurrentCall(
+			int                          line,
+			int                           col,
+			MethodTipInfo.StartName       startName,
+			MethodTipInfo.StartParameters startParameters)
 		{
-			return _info.GetMethodLocation();
+			_info.SetCurrentCall(line, col, startName, startParameters);
 		}
 	}
 }



More information about the svn mailing list