[svn] r6877: vs-plugin/trunk: ConsoleTest/Program.cs Nemerle.Compiler.Utils/Nemerle.Compiler.Utils.csproj ...

IT svnadmin at nemerle.org
Mon Nov 13 02:05:03 CET 2006


Log:
Fixed some region related bugs.

Author: IT
Date: Mon Nov 13 02:04:59 2006
New Revision: 6877

Modified:
   vs-plugin/trunk/ConsoleTest/Program.cs
   vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Compiler.Utils.csproj
   vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.n
   vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Tests.Init.n
   vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Tests.n
   vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/NemerleLanguageService.cs
   vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/NemerleSource.cs

Modified: vs-plugin/trunk/ConsoleTest/Program.cs
==============================================================================
--- vs-plugin/trunk/ConsoleTest/Program.cs	(original)
+++ vs-plugin/trunk/ConsoleTest/Program.cs	Mon Nov 13 02:04:59 2006
@@ -12,6 +12,7 @@
 			Test1 test = new Test1();
 			test.Init();
 
+			test.Check_regions();
 			test.QuickTip_TupleProp();
 			test.QuickTip_TupleMethod();
 			test.Complete_enum();

Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Compiler.Utils.csproj
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Compiler.Utils.csproj	(original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Compiler.Utils.csproj	Mon Nov 13 02:04:59 2006
@@ -74,10 +74,10 @@
     <Compile Include="Nemerle.Completion2\CodeModel\GlyphType.n" />
     <Compile Include="Const.n" />
     <Content Include="Nemerle.Completion2\Tests\Content\Class1-2.n">
-      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </Content>
     <Content Include="Nemerle.Completion2\Tests\Content\Class1.n">
-      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </Content>
     <Compile Include="Utils.n" />
     <Compile Include="Nemerle.Completion2\Tests\Tests.Init.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	Mon Nov 13 02:04:59 2006
@@ -248,6 +248,9 @@
 
         def processBuilder(builder : TypeBuilder)
         {
+           when (builder.IsDelegate || builder.IsVariantOption)
+             return;
+
           // Region for the type itself.
           //
           mutable lineStart = builder.Location.Line;
@@ -428,7 +431,7 @@
 
           addHiddenRegion(
             Location(fileIndex, lineStart, colStart, lineEnd, colEnd),
-            if (r.Text.IsNullOrEmpty()) "#region" else r.Text, true);
+            if (r.Text.IsNullOrEmpty()) "#region" else r.Text, false);
         }
       }
 

Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Tests.Init.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Tests.Init.n	(original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Tests.Init.n	Mon Nov 13 02:04:59 2006
@@ -148,9 +148,9 @@
         GetRegion(loc.Line, loc.Column, loc.EndLine, loc.EndColumn)
       }
 
-      public GetLine(_line : int) : string
+      public GetLine(line : int) : string
       {
-        throw NotImplementedException();
+        File.ReadAllLines(_filePath)[line - 1];
       }
 
       public GetPositionOfLineIndex(_line : int, _col : int) : int

Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Tests.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Tests.n	(original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Tests.n	Mon Nov 13 02:04:59 2006
@@ -14,6 +14,22 @@
   public partial class Test1
   {
     [Test]
+    public Check_regions() : void
+    {
+      def file = FilePath1;
+
+      _project.Check(
+        file,
+        TestSourceTextManager(file),
+        fun(loc, _, _)
+        {
+          when (loc.Line == loc.EndLine)
+            Assert.IsFalse(loc.Column > loc.EndColumn)
+        },
+        (_) => false);
+    }
+
+    [Test]
     public Complete_enum() : void
     {
       def file = FilePath1;

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	Mon Nov 13 02:04:59 2006
@@ -227,11 +227,13 @@
 		private AuthoringScope Check(ParseRequest request)
 		{
 			ProjectInfo projectInfo = ProjectInfo.FindProject(request.FileName);
+			NemerleSource source      = projectInfo.GetSource(request.FileName);
 
 			if (projectInfo == null)
 				return null;
 
 			int nErrors = 0;
+			bool allExpanded = source.TimeStamp > 0;
 
 			request.Sink.ProcessHiddenRegions = true;
 
@@ -249,9 +251,10 @@
 					r.tsHiddenText = Convert(location);
 					r.iType        = (int)HIDDEN_REGION_TYPE.hrtCollapsible;
 					r.dwBehavior   = (int)HIDDEN_REGION_BEHAVIOR.hrbEditorControlled; //.hrbClientControlled;
-					r.dwState      = (uint)(isExpanded? HIDDEN_REGION_STATE.hrsExpanded: HIDDEN_REGION_STATE.hrsDefault);
 					r.pszBanner    = string.IsNullOrEmpty(text)? null: text;
 					r.dwClient     = 25;
+					r.dwState      = (uint)(allExpanded || isExpanded?
+						HIDDEN_REGION_STATE.hrsExpanded: HIDDEN_REGION_STATE.hrsDefault);
 
 					request.Sink.AddHiddenRegion(r);
 				},

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	Mon Nov 13 02:04:59 2006
@@ -112,6 +112,14 @@
 			return new NemerleAuthoringSink(this, reason, line, col, maxErrors);
 		}
 
+		public override void ProcessHiddenRegions(ArrayList hiddenRegions)
+		{
+#if DEBUG
+			LanguageService.Preferences.MaxRegionTime = 1000 * 60 * 10;
+#endif
+
+			base.ProcessHiddenRegions(hiddenRegions);
+		}
 		/*
 		public override void ProcessHiddenRegions(ArrayList hiddenRegions)
 		{



More information about the svn mailing list