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

IT svnadmin at nemerle.org
Sun Sep 3 09:02:05 CEST 2006


Log:
Message/error/hint highlighting.

Author: IT
Date: Sun Sep  3 09:02:01 2006
New Revision: 6609

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

Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.n	(original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.n	Sun Sep  3 09:02:01 2006
@@ -12,7 +12,8 @@
 
 namespace Nemerle.Completion2
 {
-  public delegate GetText(line : int, col : int, lineEnd : int, colEnd : int) : string;
+  public delegate GetText (line : int, col : int, lineEnd : int, colEnd : int) : string;
+  public delegate AddError(compilerMessage : CompilerMessage) : void;
 
   [Record]
   public partial class Project
@@ -126,5 +127,35 @@
         | _ => null
       }
     }
+
+    public CheckErrors([NotNull] fileName : string, addError : AddError, getText : GetText) : void
+    {
+      foreach (cm in _engine.CompilerMessages)
+        addError(cm);
+
+      def fileIndex = _compileUnits.GetFileIndex(fileName);
+
+      foreach (decl in _compileUnits[fileIndex].Decls)
+      {
+      | Type(builder) =>
+
+        foreach (member in builder.GetMembers())
+        {
+        | method is MethodBuilder =>
+
+          def location = method.BodyLocation;
+
+          mutable bodyCode = getText(location.Line, location.Column, location.EndLine, location.EndColumn);
+
+          _ = _engine.CompileMethod(method, bodyCode, location);
+
+          foreach (cm in _engine.CompilerMessages)
+            addError(cm);
+
+        | _ => ()
+        }
+      | _ => ()
+      }
+    }
   } // end class Project
 } // end namespace

Modified: vs-plugin/trunk/Nemerle.VsIntegration/NemerleLanguage.cs
==============================================================================
--- vs-plugin/trunk/Nemerle.VsIntegration/NemerleLanguage.cs	(original)
+++ vs-plugin/trunk/Nemerle.VsIntegration/NemerleLanguage.cs	Sun Sep  3 09:02:01 2006
@@ -164,16 +164,18 @@
 
 		private AuthoringScope Check(ParseRequest request)
 		{
-			ProjectInfo project = ProjectInfo.FindProject(request.FileName);
+			ProjectInfo projectInfo = ProjectInfo.FindProject(request.FileName);
 
-			if (project == null)
+			if (projectInfo == null)
 				return null;
 
-			project.UpdateFile(request);
+			projectInfo.UpdateFile(request);
 
-			project.Engine.GetProject();
+			Project project = projectInfo.Engine.GetProject();
 
-			foreach (CompilerMessage cm in project.Engine.CompilerMessages)
+			project.CheckErrors(
+				request.FileName,
+				delegate(CompilerMessage cm)
 			{
 				TextSpan ts = new TextSpan();
 
@@ -189,7 +191,11 @@
 					cm.MessageKind == MessageKind.Error   ? Severity.Error :
 					cm.MessageKind == MessageKind.Warning ? Severity.Warning :
 					                                        Severity.Hint);
-			}
+				},
+				delegate(int lineStart, int colStart, int lineEnd, int colEnd)
+				{
+					return GetCodeRegion(request, lineStart - 1, colStart - 1, lineEnd - 1, colEnd - 1);
+				});
 
 			return GetDefaultScope(request);
 		}



More information about the svn mailing list