[svn] r7593: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2: CodeModel/Project.MakeCompletionL...

VladD2 svnadmin at nemerle.org
Thu Apr 12 07:12:21 CEST 2007


Log:
1. Prevent add keywords (like mutable, null, true, ...) if member completion is accrued.
2. Add completion of when/where/with if code not well formed.

Author: VladD2
Date: Thu Apr 12 07:12:19 2007
New Revision: 7593

Modified:
   vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.MakeCompletionList.n
   vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.Type.n
   vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Engine/Engine.Completion.n
   vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Engine/Engine.Properties.n

Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.MakeCompletionList.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.MakeCompletionList.n	(original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.MakeCompletionList.n	Thu Apr 12 07:12:19 2007
@@ -86,13 +86,12 @@
         }
       }
 
-      when (inExpr)
+      when (inExpr && result.ObjectType == null)
       {
         def add(keyword)
         { completionList.Add(CompletionElem(GlyphType.Snippet :> int, keyword, "keyword", null)); }
 
-        def keywords = array["mutable", "def", "array", "true", "false", "null"];
-        keywords.FilterLazy(_.StartsWithIgnoreCace(result.NamePrefix)).Iter(add);
+        _expressionKeywords.FilterLazy(_.StartsWithIgnoreCace(result.NamePrefix)).Iter(add);
       }
 
       //TODO: Поправить комплейшон для конструкторов.

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	Thu Apr 12 07:12:19 2007
@@ -46,7 +46,7 @@
           if (result == null)
           {
             Trace.WriteLine("### RunCompletionEngine() return null!");
-            TopKeywords
+            Engine.ExpressionDefaultKeywords
           }
           else
             Engine.MakeCompletionList(result, true);

Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Engine/Engine.Completion.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Engine/Engine.Completion.n	(original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Engine/Engine.Completion.n	Thu Apr 12 07:12:19 2007
@@ -273,6 +273,8 @@
           def obj = obj; // for debug
           def name = name; // for debug
           def elems = SCG.List ();
+          def elems2 = elems;
+          _ = elems2;
           def tobj = typer.TypeExpr (obj);
 
           def AddOverloads(overloads)
@@ -444,8 +446,8 @@
 
     /// Try compile method body, find completion token and build completion list.
     public RunCompletionEngine (
-      [NotNull]         method             : MethodBuilder, 
-      [NotNull]         content            : string,
+      /*[NotNull]*/         method             : MethodBuilder, 
+      /*[NotNull]*/         content            : string,
                         methodBodyLocation : Location,
                         completionMarkLine : int,
                         completionMarkChar : int

Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Engine/Engine.Properties.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Engine/Engine.Properties.n	(original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Engine/Engine.Properties.n	Thu Apr 12 07:12:19 2007
@@ -52,14 +52,20 @@
         ["using", "class", "struct", "variant", "namespace", "enum", "public", "protected",
          "internal", "private", "abstract", "sealed", "delegate", "#if", "#region", "extern",
          "interface", "partial", "static", "[Accessor]", "[Record]", "this", "override",
-         "module", "where", "mutable"],
+         "module", "mutable"],
         GlyphType.Snippet :> int,
         "snippet or top level keyword");
         
-        //"out", "ref"
+      _expressionDefaultKeywords = StrsToCompletionElems(
+        [ "where", "when", "with" ],
+        GlyphType.Snippet :> int,
+        "snippet or top level keyword");
     }
 
     [Accessor] static _topKeywords : array[CompletionElem];
+    [Accessor] static _expressionDefaultKeywords : array[CompletionElem];
+    static _expressionKeywords : array[string]
+      = array["mutable", "def", "array", "true", "false", "null", "#if", "#region"];
 
 #pragma warning disable 618 // Obsolete
     public Project : Project



More information about the svn mailing list