eerohele / Tutkain

A Sublime Text package for interactive Clojure development
https://tutkain.flowthing.me
Other
68 stars 8 forks source link

Completion remove from popup, when last symbol been typed #60

Closed demoj1 closed 3 years ago

demoj1 commented 3 years ago

When last symbol been typed, completion remove from popup list.

https://user-images.githubusercontent.com/10886027/128491531-36f3c1e4-8c11-43a8-8607-c4eb9e91d93d.mov

This is not convenient in the case of, i known function name and typing it, but i don't known arguments and i want to see it.

eerohele commented 3 years ago

Yes, this is annoying and ought to be fixed. I'll look into it.

demoj1 commented 3 years ago

Easy way which i find, add space symbol after candidate name.

https://user-images.githubusercontent.com/10886027/128622725-c37efc6c-8021-4493-af43-c42657690a42.mov

diff --git a/package.py b/package.py
index 6c2b8c5..3666a43 100644
--- a/package.py
+++ b/package.py
@@ -626,7 +626,7 @@ class TutkainViewEventListener(ViewEventListener):
             details = f"""<a href="{sublime.command_url("tutkain_show_popup", args={"item": d})}">More</a>"""

         return sublime.CompletionItem(
-            item.get(edn.Keyword("candidate")),
+            item.get(edn.Keyword("candidate")) + " ",
             kind=completion_kinds().get(item.get(edn.Keyword("type")).name, sublime.KIND_AMBIGUOUS),
             annotation=" ".join(item.get(edn.Keyword("arglists"), [])),
             details=details,

And it look right way, because after press TAB or Enter for insert completion, name inserted with space after name. But this not work for variable name, after the variable I don't always want to see a space...

demoj1 commented 3 years ago

Okey, i found completion field on CompletionItem class, it solves the previous problem.