clarified boundary cases of completion;
authorwenzelm
Thu, 16 Jul 2015 16:30:43 +0200
changeset 60732 18299765542e
parent 60731 4ac4b314d93c
child 60733 7a72429c5a1f
clarified boundary cases of completion;
src/Pure/General/completion.scala
src/Pure/ML/ml_compiler_polyml.ML
--- a/src/Pure/General/completion.scala	Thu Jul 16 14:40:23 2015 +0200
+++ b/src/Pure/General/completion.scala	Thu Jul 16 16:30:43 2015 +0200
@@ -199,7 +199,8 @@
             if (kind == "") (name, quote(decode(name)))
             else
              (Long_Name.qualify(kind, name),
-              Word.implode(Word.explode('_', kind)) + " " + quote(decode(name)))
+              Word.implode(Word.explode('_', kind)) +
+              (if (xname == name) "" else " " + quote(decode(name))))
           description = List(xname1, "(" + descr_name + ")")
         } yield Item(range, original, full_name, description, xname1, 0, true)
 
--- a/src/Pure/ML/ml_compiler_polyml.ML	Thu Jul 16 14:40:23 2015 +0200
+++ b/src/Pure/ML/ml_compiler_polyml.ML	Thu Jul 16 16:30:43 2015 +0200
@@ -45,9 +45,9 @@
 
     fun reported_completions loc names =
       let val pos = Exn_Properties.position_of loc in
-        if is_reported pos then
+        if is_reported pos andalso not (null names) then
           let
-            val completion = Completion.names pos (map (fn a => (a, ("ML", ""))) names);
+            val completion = Completion.names pos (map (fn a => (a, ("ML", a))) names);
             val xml = Completion.encode completion;
           in cons (pos, fn () => Markup.completion, fn () => YXML.string_of_body xml) end
         else I