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

IT svnadmin at nemerle.org
Sun Nov 12 22:49:53 CET 2006


Log:
Compile the source right after it's loaded.


Author: IT
Date: Sun Nov 12 22:49:47 2006
New Revision: 6874

Modified:
   vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/CompileUnitCollection.n
   vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.Type.n
   vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.n
   vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/ScanLexer.n
   vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/NemerleLanguageService.cs
   vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/NemerleSource.cs

Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/CompileUnitCollection.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/CompileUnitCollection.n	(original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/CompileUnitCollection.n	Sun Nov 12 22:49:47 2006
@@ -1,17 +1,22 @@
+using System;
+
 using Nemerle.Assertions;
 using Nemerle.Collections;
 using Nemerle.Compiler;
 using Nemerle.Compiler.Parsetree;
 using Nemerle.Utility;
+
 using SCG = System.Collections.Generic;
 
 namespace Nemerle.Completion2
 {
   public class CompileUnitCollection
   {
-    public this([NotNull] engine        : Engine, 
+    public this(
+      [NotNull] engine     : Engine, 
                 [NotNull] fileInfos     : array[Decl.Namespace],
-                [NotNull] regionsMap    : Hashtable[string, list[Region]])
+      [NotNull] regionsMap : Hashtable[string, list[Region]]
+    )
     {
       _engine     = engine;
       _fileInfos  = fileInfos;
@@ -22,7 +27,6 @@
     _fileInfos  : array[Decl.Namespace];
     _regionsMap : Hashtable[string, list[Region]];
 
-
     public GetFileIndex(filePath : string) : int
     {
       Location.GetFileIndex(filePath);

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

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 Nov 12 22:49:47 2006
@@ -287,10 +287,8 @@
               break;
 #endif
 
-            try
-            {
-            // Get errors.
-            //
+//            try
+//            {
               def pExpr = method.GetParsedBody();
 
               when (pExpr != null)
@@ -309,11 +307,11 @@
                   }
                 });
               }
-            }
-            catch
-            {
-              | _ => ()
-            }
+//            }
+//            catch
+//            {
+//              | _ => ()
+//            }
 
             // Get the method region location.
             //
@@ -415,6 +413,7 @@
 
         //TODO: Ðåãèîíû ïîêà íå ðåëîêåéòÿòñÿ. Òàê ÷òî ïðè çìåíåíèè èñõîäíèêîâ îíè äîëæíû âðàòü.
         def regions = CompileUnits.GetRegions(fileName);
+
         foreach (r in regions)
         {
           // Êàêîé ñìûñë â mutable? Äà è âîîáùå çà÷åì êîïèðîâàòü Location â ïåðåìåííûå?

Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/ScanLexer.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/ScanLexer.n	(original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/ScanLexer.n	Sun Nov 12 22:49:47 2006
@@ -451,11 +451,6 @@
 
           (TP.Operator, C.Quotation, TR.None)
 
-        //| RoundGroup(LooseGroup(Operator(name))) when name == "$" =>
-
-        //  _Debug(tok);
-        //  (TP.String, C.String, TR.None)
-
         | _                         => (TP.Unknown,    C.Text,       TR.None)
         }
 

Modified: vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/NemerleLanguageService.cs
==============================================================================
--- vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/NemerleLanguageService.cs	(original)
+++ vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/NemerleLanguageService.cs	Sun Nov 12 22:49:47 2006
@@ -150,6 +150,17 @@
 			return new NemerleSource(this, buffer, new Colorizer(this, buffer, GetScanner(buffer)));
 		}
 
+		public override CodeWindowManager CreateCodeWindowManager(IVsCodeWindow codeWindow, Source source)
+		{
+			CodeWindowManager m = base.CreateCodeWindowManager(codeWindow, source);
+
+			// It compiles the source right after it's loaded.
+			//
+			source.BeginParse();
+
+			return m;
+		}
+
 		public override LanguagePreferences GetLanguagePreferences()
 		{
 			if (_preferences == null)
@@ -480,7 +491,7 @@
 		{
 			Source src = GetSource(LastActiveTextView);
 
-			if (src != null && src.LastParseTime == Int32.MaxValue)
+			if (src != null && src.LastParseTime == int.MaxValue)
 				src.LastParseTime = 0;
 
 			base.OnIdle(periodic);

Modified: vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/NemerleSource.cs
==============================================================================
--- vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/NemerleSource.cs	(original)
+++ vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/NemerleSource.cs	Sun Nov 12 22:49:47 2006
@@ -23,12 +23,13 @@
 		public NemerleSource(NemerleLanguageService service, IVsTextLines textLines, Colorizer colorizer)
 			: base(service, textLines, colorizer)
 		{
-			//BeginParse();
 			string      path = GetFilePath();
 			ProjectInfo info = ProjectInfo.FindProject(path);
 
 			if (info != null)
 				info.AddSource(this);
+
+			LastParseTime = 0;
 		}
 
 		public override void Dispose()
@@ -68,8 +69,16 @@
 			base.Completion(textView, info, reason);
 		}
 
+		private int _timeStamp;
+		public  int  TimeStamp
+		{
+			get { return _timeStamp;  }
+		}
+
 		public override void OnChangeLineText(TextLineChange[] lineChange, int last)
 		{
+			_timeStamp++;
+
 			//TODO: Ñþäà íóæíî âñòàâèòü êîä îáíîâëÿþùèé ëîêåéøîíû â äåðåâå òèïîâ åñëè ðåäàêòèðîâàíèå
 			// ïðîèñõîäèò âíóòðè âûðàæåíèé è îáíóëÿòü äåðåâî òèïîâ â îáðàòîíîì ñëó÷àå.
 			// Åñëè äåðåâî òèïîâ íåò, òî íè÷åãî íå äåëàåì.
@@ -77,7 +86,7 @@
 			string      fileName    = GetFilePath();
 			ProjectInfo projectInfo = ProjectInfo.FindProject(fileName);
 
-			if (null == projectInfo)
+			if (projectInfo == null)
 				return;
 
 			for (int i = 0; i < lineChange.Length; i++)
@@ -103,6 +112,7 @@
 			return new NemerleAuthoringSink(this, reason, line, col, maxErrors);
 		}
 
+		/*
 		public override void ProcessHiddenRegions(ArrayList hiddenRegions)
 		{
 			IVsEnumHiddenRegions ppenum = null;
@@ -256,6 +266,8 @@
 				Marshal.ReleaseComObject(ppenum);
 			}
 		}
+		*/
+
 		public override void ReformatSpan(EditArray mgr, TextSpan span)
 		{
 			string filePath = GetFilePath();



More information about the svn mailing list