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

pbludov svnadmin at nemerle.org
Tue Oct 16 13:16:53 CEST 2007


Log:
QuickTip & Navigation fixes

Author: pbludov
Date: Tue Oct 16 13:16:37 2007
New Revision: 7810

Added:
   vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/WebApplication/
      - copied from rev 7805, vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/Web/WebApplication/
   vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/WebApplication/Default.aspx
      - copied unchanged from rev 7808, vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/Web/WebApplication/Default.aspx
   vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/WebApplication/Default.aspx.designer.n
      - copied unchanged from rev 7808, vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/Web/WebApplication/Default.aspx.designer.n
   vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/WebApplication/Default.aspx.n
      - copied unchanged from rev 7808, vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/Web/WebApplication/Default.aspx.n
   vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/WebApplication/Properties/
      - copied from rev 7808, vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/Web/WebApplication/Properties/
   vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/WebApplication/Web.config
      - copied unchanged from rev 7808, vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/Web/WebApplication/Web.config
   vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/WebApplication/WebApplication.nproj
      - copied unchanged from rev 7808, vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/Web/WebApplication/WebApplication.nproj
   vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/WebApplication/WebApplication.vstemplate
      - copied unchanged from rev 7808, vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/Web/WebApplication/WebApplication.vstemplate
   vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/WebApplication/__TemplateIcon.ico
      - copied unchanged from rev 7808, vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/Web/WebApplication/__TemplateIcon.ico
   vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/WebService/
      - copied from rev 7805, vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/Web/WebService/
   vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/WebService/Properties/
      - copied from rev 7808, vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/Web/WebService/Properties/
   vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/WebService/Service1.asmx
      - copied unchanged from rev 7808, vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/Web/WebService/Service1.asmx
   vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/WebService/Service1.asmx.n
      - copied unchanged from rev 7808, vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/Web/WebService/Service1.asmx.n
   vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/WebService/Web.config
      - copied unchanged from rev 7808, vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/Web/WebService/Web.config
   vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/WebService/WebService.nproj
      - copied unchanged from rev 7808, vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/Web/WebService/WebService.nproj
   vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/WebService/WebService.vstemplate
      - copied unchanged from rev 7808, vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/Web/WebService/WebService.vstemplate
   vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/WebService/__TemplateIcon.ico
      - copied unchanged from rev 7808, vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/Web/WebService/__TemplateIcon.ico
Removed:
   vs-plugin/trunk/Nemerle.VsIntegration/Templates/Projects/Web/
Modified:
   vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.Type.n
   vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.Using.n
   vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Tests.n
   vs-plugin/trunk/Nemerle.Compiler.Utils/Utils.n
   vs-plugin/trunk/Nemerle.VsIntegration/Nemerle.VisualStudio.csproj

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	Tue Oct 16 13:16:37 2007
@@ -94,7 +94,7 @@
       def typeBuilder = typeDecl.Builder;
       def member      = 
         if (typeBuilder.IsDelegate) typeBuilder : IMember
-        else typeBuilder.GetMemberByLocation(fileIndex, line, col);
+        else typeBuilder.GetMemberByLocation(fileIndex, line, col) ?? typeBuilder;
 
       def checkType(pexpr, texpr : TyVar) 
       {
@@ -227,7 +227,34 @@
         }
         else
         {
-          (Location.Default, null, null)
+          def typarms = ast.header.typarms;
+
+          if (typarms.tyvars.OrderedContains(line, col))
+            match (typarms.tyvars.Find(t => t.Location.Contains(line, col)))
+            {
+            | Some(t) => (t.Location, null, method.Header.typarms.Nth(typarms.tyvars.IndexOf(t)))
+            | _       => (Location.Default, null, null)
+            }
+          else
+          {
+            // Covarian/Contravariant constraints breaks OrderedContains optimization
+            // so process them one-by-one.
+            //
+            def constraints = typarms.constraints.RevFilter(c => !Utils.IsSpecialConstraint(c.ty));
+
+            match (constraints.Find(c => c.ty.Location.Contains(line, col)))
+            {
+            | Some(c) =>
+
+              def tyVarConstraints = constraints.Filter(tc => tc.tyvar.Equals(c.tyvar));
+              def typarm = method.Header.typarms.Nth(typarms.tyvars.IndexOf(c.tyvar));
+
+              Debug.Assert(tyVarConstraints.Length == typarm.Constraints.Length);
+              (c.ty.Location, null, typarm.Constraints.Nth(tyVarConstraints.IndexOf(c)))
+
+            | _       =>           (Location.Default, null, null)
+            }
+          }
         }
       }
 
@@ -241,6 +268,7 @@
         | []         => (Location.Default, null, null)
       }
 
+      Debug.Assert(member == null || member.Location.Contains(line, col), "Got a wrong member???");
       match (member)
       {
       | mb is MethodBuilder   => getMethod(mb)
@@ -322,22 +350,7 @@
             // Covarian/Contravariant constraints breaks OrderedContains optimization
             // so process them one-by-one.
             //
-            def isSpecialConstraint(ty)
-            {
-            | PExpr.Ref(name) =>
-              match (name.Id)
-              {
-              | "new"
-              | "class"
-              | "struct"
-              | "+"
-              | "-" => true
-              | _   => false
-              }
-            | _   => false
-            }
-
-            def constraints = typarms.constraints.RevFilter(c => !isSpecialConstraint(c.ty));
+            def constraints = typarms.constraints.RevFilter(c => !Utils.IsSpecialConstraint(c.ty));
 
             match (constraints.Find(c => c.ty.Location.Contains(line, col)))
             {
@@ -352,7 +365,7 @@
             | _       => (tb.Ast.ParsedName.Location, null, tb : object)
             }
           }
-        | _ => (tb.Location, null, tb)
+        | _ => (tb.Ast.ParsedName.Location, null, tb : object)
         }
 
       | null                  => (Location.Default, null, null)

Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.Using.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.Using.n	(original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.Using.n	Tue Oct 16 13:16:37 2007
@@ -181,13 +181,27 @@
       line      : int,
       col       : int) : QuickTipInfo
     {
+      def (node, locs) = 
       if (Contains(usingDecl.NameLocations, fileIndex, line, col))
       {
         def (names, locs) = Truncate(usingDecl.Name, usingDecl.NameLocations, fileIndex, line, col);
 
-        def node = OpenNs(names /*usingDecl.Name*/, usingDecl.BeforeEnv.CurrentNamespace, false);
+          (OpenNs(names /*usingDecl.Name*/, usingDecl.BeforeEnv.CurrentNamespace, false),
+            $[ l | l in locs, l.Line > line || l.Contains(line, col)]);
+        }
+        else if (usingDecl.AliasLocation.Contains(fileIndex, line, col))
+        {
+          (OpenNs(usingDecl.Name, usingDecl.BeforeEnv.CurrentNamespace, false),
+            [usingDecl.AliasLocation]);
+        }
+        else
+          (null, null);
 
-        def prefix = match (node.Value)
+        def prefix = 
+          if (node == null)
+            null
+        else
+          match (node.Value)
         {
           | NamespaceReference  =>   "namespace"
           | Cached(ti)          =>
@@ -205,10 +219,7 @@
         if (prefix != null)
         {
           Debug.WriteLine("*** Using QuickTip found.");
-          QuickTipInfo(
-            prefix,
-            names,
-            $[ l | l in locs, l.Line > line || l.Contains(line, col)])
+          QuickTipInfo(prefix, node.FullName, locs)
         }
         else
         {
@@ -216,12 +227,6 @@
           null
         }
       }
-      else
-      {
-        Debug.WriteLine("*** Using QuickTip not found.");
-        null
-      }
-    }
 
     internal GetUsingGoto(
       usingDecl : Decl.Using,
@@ -229,12 +234,21 @@
       line      : int,
       col       : int) : list [GotoInfo]
     {
+      def node =
       if (Contains(usingDecl.NameLocations, fileIndex, line, col))
       {
         def (names, _) = Truncate(usingDecl.Name, usingDecl.NameLocations, fileIndex, line, col);
 
-        def node = OpenNs(names /*usingDecl.Name*/, usingDecl.BeforeEnv.CurrentNamespace, false);
+          OpenNs(names /*usingDecl.Name*/, usingDecl.BeforeEnv.CurrentNamespace, false);
+        }
+        else if (usingDecl.AliasLocation.Contains(fileIndex, line, col))
+        {
+          OpenNs(usingDecl.Name, usingDecl.BeforeEnv.CurrentNamespace, false);
+        }
+        else
+          null;
 
+      if (node != null)
         match (node.Value)
         {
           | Cached(ty)
@@ -247,13 +261,8 @@
             }
           | _                   => []
         }
-      }
       else
-      {
-        // Alias name or whitespace
-        //
         []
       }
-    }
   } // end class Project
 } // end namespace

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	Tue Oct 16 13:16:37 2007
@@ -773,11 +773,6 @@
             def col      = m.Index + int.Parse(m.Groups[2].Value);
             def expected = m.Groups[3].Value;
 
-            when (expected == "Stack")
-            {
-              assert(true);
-            }
-
             def result = _project.GetQuickTipInfo(file, i+1, col);
             when (result == null)
             {

Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Utils.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Utils.n	(original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Utils.n	Tue Oct 16 13:16:37 2007
@@ -132,6 +132,21 @@
       | Enum          => "enum "
     }
 
+    public static IsSpecialConstraint(ty : PExpr) : bool
+    {
+    | PExpr.Ref(name) =>
+      match (name.Id)
+      {
+      | "new"
+      | "class"
+      | "struct"
+      | "+"
+      | "-" => true
+      | _   => false
+      }
+    | _   => false
+    }
+
     public static ToMethodDefinitionString(this t : TyVar) : string
     {
       | MType.Fun(parms, to) =>

Modified: vs-plugin/trunk/Nemerle.VsIntegration/Nemerle.VisualStudio.csproj
==============================================================================
--- vs-plugin/trunk/Nemerle.VsIntegration/Nemerle.VisualStudio.csproj	(original)
+++ vs-plugin/trunk/Nemerle.VsIntegration/Nemerle.VisualStudio.csproj	Tue Oct 16 13:16:37 2007
@@ -231,80 +231,80 @@
     <ZipProject Include="Templates\Projects\MacroLibrary\MacroLibrary.nproj" />
     <ZipProject Include="Templates\Projects\ClassLibrary\AssemblyInfo.n" />
 
-    <ZipProject Include="Templates\Projects\Web\WebApplication\Properties\AssemblyInfo.n">
+    <ZipProject Include="Templates\Projects\WebApplication\Properties\AssemblyInfo.n">
       <OutputSubPath>Web</OutputSubPath>
-      <RootPath>Templates\Projects\Web\WebApplication</RootPath>
+      <RootPath>Templates\Projects\WebApplication</RootPath>
       <Visible>false</Visible>
     </ZipProject>
-    <ZipProject Include="Templates\Projects\Web\WebApplication\__TemplateIcon.ico" >
+    <ZipProject Include="Templates\Projects\WebApplication\__TemplateIcon.ico" >
       <OutputSubPath>Web</OutputSubPath>
-      <RootPath>Templates\Projects\Web\WebApplication</RootPath>
+      <RootPath>Templates\Projects\WebApplication</RootPath>
       <Visible>false</Visible>
     </ZipProject>
-    <ZipProject Include="Templates\Projects\Web\WebApplication\Default.aspx" >
+    <ZipProject Include="Templates\Projects\WebApplication\Default.aspx" >
       <OutputSubPath>Web</OutputSubPath>
-      <RootPath>Templates\Projects\Web\WebApplication</RootPath>
+      <RootPath>Templates\Projects\WebApplication</RootPath>
       <Visible>false</Visible>
     </ZipProject>
-    <ZipProject Include="Templates\Projects\Web\WebApplication\Default.aspx.n" >
+    <ZipProject Include="Templates\Projects\WebApplication\Default.aspx.n" >
       <OutputSubPath>Web</OutputSubPath>
-      <RootPath>Templates\Projects\Web\WebApplication</RootPath>
+      <RootPath>Templates\Projects\WebApplication</RootPath>
       <Visible>false</Visible>
     </ZipProject>
-    <ZipProject Include="Templates\Projects\Web\WebApplication\Default.aspx.designer.n" >
+    <ZipProject Include="Templates\Projects\WebApplication\Default.aspx.designer.n" >
       <OutputSubPath>Web</OutputSubPath>
-      <RootPath>Templates\Projects\Web\WebApplication</RootPath>
+      <RootPath>Templates\Projects\WebApplication</RootPath>
       <Visible>false</Visible>
     </ZipProject>
-    <ZipProject Include="Templates\Projects\Web\WebApplication\Web.config" >
+    <ZipProject Include="Templates\Projects\WebApplication\Web.config" >
       <OutputSubPath>Web</OutputSubPath>
-      <RootPath>Templates\Projects\Web\WebApplication</RootPath>
+      <RootPath>Templates\Projects\WebApplication</RootPath>
       <Visible>false</Visible>
     </ZipProject>
-    <ZipProject Include="Templates\Projects\Web\WebApplication\WebApplication.nproj" >
+    <ZipProject Include="Templates\Projects\WebApplication\WebApplication.nproj" >
       <OutputSubPath>Web</OutputSubPath>
-      <RootPath>Templates\Projects\Web\WebApplication</RootPath>
+      <RootPath>Templates\Projects\WebApplication</RootPath>
       <Visible>false</Visible>
     </ZipProject>
-    <ZipProject Include="Templates\Projects\Web\WebApplication\WebApplication.vstemplate" >
+    <ZipProject Include="Templates\Projects\WebApplication\WebApplication.vstemplate" >
       <OutputSubPath>Web</OutputSubPath>
-      <RootPath>Templates\Projects\Web\WebApplication</RootPath>
+      <RootPath>Templates\Projects\WebApplication</RootPath>
       <Visible>false</Visible>
     </ZipProject>
 
-    <ZipProject Include="Templates\Projects\Web\WebService\Properties\AssemblyInfo.n" >
+    <ZipProject Include="Templates\Projects\WebService\Properties\AssemblyInfo.n" >
       <OutputSubPath>Web</OutputSubPath>
-      <RootPath>Templates\Projects\Web\WebService</RootPath>
+      <RootPath>Templates\Projects\WebService</RootPath>
       <Visible>false</Visible>
     </ZipProject>
-    <ZipProject Include="Templates\Projects\Web\WebService\WebService.vstemplate" >
+    <ZipProject Include="Templates\Projects\WebService\WebService.vstemplate" >
       <OutputSubPath>Web</OutputSubPath>
-      <RootPath>Templates\Projects\Web\WebService</RootPath>
+      <RootPath>Templates\Projects\WebService</RootPath>
       <Visible>false</Visible>
     </ZipProject>
-    <ZipProject Include="Templates\Projects\Web\WebService\Service1.asmx" >
+    <ZipProject Include="Templates\Projects\WebService\Service1.asmx" >
       <OutputSubPath>Web</OutputSubPath>
-      <RootPath>Templates\Projects\Web\WebService</RootPath>
+      <RootPath>Templates\Projects\WebService</RootPath>
       <Visible>false</Visible>
     </ZipProject>
-    <ZipProject Include="Templates\Projects\Web\WebService\Service1.asmx.n" >
+    <ZipProject Include="Templates\Projects\WebService\Service1.asmx.n" >
       <OutputSubPath>Web</OutputSubPath>
-      <RootPath>Templates\Projects\Web\WebService</RootPath>
+      <RootPath>Templates\Projects\WebService</RootPath>
       <Visible>false</Visible>
     </ZipProject>
-    <ZipProject Include="Templates\Projects\Web\WebService\__TemplateIcon.ico" >
+    <ZipProject Include="Templates\Projects\WebService\__TemplateIcon.ico" >
       <OutputSubPath>Web</OutputSubPath>
-      <RootPath>Templates\Projects\Web\WebService</RootPath>
+      <RootPath>Templates\Projects\WebService</RootPath>
       <Visible>false</Visible>
     </ZipProject>
-    <ZipProject Include="Templates\Projects\Web\WebService\WebService.nproj" >
+    <ZipProject Include="Templates\Projects\WebService\WebService.nproj" >
       <OutputSubPath>Web</OutputSubPath>
-      <RootPath>Templates\Projects\Web\WebService</RootPath>
+      <RootPath>Templates\Projects\WebService</RootPath>
       <Visible>false</Visible>
     </ZipProject>
-    <ZipProject Include="Templates\Projects\Web\WebService\Web.config" >
+    <ZipProject Include="Templates\Projects\WebService\Web.config" >
       <OutputSubPath>Web</OutputSubPath>
-      <RootPath>Templates\Projects\Web\WebService</RootPath>
+      <RootPath>Templates\Projects\WebService</RootPath>
       <Visible>false</Visible>
     </ZipProject>
   </ItemGroup>



More information about the svn mailing list