From dfd083a7ddb2b10578ac0880d134c8abfa216b95 Mon Sep 17 00:00:00 2001 From: Maxim Ignatenko Date: Fri, 22 May 2015 22:20:08 +0100 Subject: [PATCH] Add an option for completing func names only --- GoSublime.sublime-settings | 3 +++ gosubl/gs.py | 1 + gscomplete.py | 3 ++- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/GoSublime.sublime-settings b/GoSublime.sublime-settings index 1238368a..e9852e2d 100644 --- a/GoSublime.sublime-settings +++ b/GoSublime.sublime-settings @@ -169,6 +169,9 @@ // note: this feature only comes into effect when autocomplete was triggered after a dot, e.g. `fmt.|` "autocomplete_suggest_imports": false, + // if set to true, completion will not insert snippet with function arguments. + "autocomplete_func_name_only": false, + // whether or not to show function call tip in the status bar // the same can be achieved ctrl+dot,ctrl+space using an output panel "calltips": true, diff --git a/gosubl/gs.py b/gosubl/gs.py index f34bba86..0df1867f 100644 --- a/gosubl/gs.py +++ b/gosubl/gs.py @@ -76,6 +76,7 @@ "autocomplete_closures": False, "autocomplete_filter_name": "", "autocomplete_suggest_imports": False, + "autocomplete_func_name_only": False, "on_save": [], "shell": [], "default_snippets": [], diff --git a/gscomplete.py b/gscomplete.py index cc40d999..77264634 100644 --- a/gscomplete.py +++ b/gscomplete.py @@ -139,7 +139,8 @@ def on_query_completions(self, view, prefix, locations): return ([], AC_OPTS) nc = view.substr(sublime.Region(pos, pos+1)) - cl = self.complete(fn, offset, src, nc.isalpha() or nc == "(") + func_name_only = gs.setting('autocomplete_func_name_only', False) + cl = self.complete(fn, offset, src, nc.isalpha() or nc == "(" or func_name_only) pc = view.substr(sublime.Region(pos-1, pos)) if show_snippets and (pc.isspace() or pc.isalpha()):