diff --git a/README.md b/README.md index 0f3748da..f1abcaee 100644 --- a/README.md +++ b/README.md @@ -105,6 +105,7 @@ These settings can be overridden in `Packages/User/TypeScript.sublime-settings`, - `node_args`: array of command line arguments sent to the tsserver Node.js process before the tsserver script path (useful for e.g. changing max heap size or attaching debugger to the tsserver process) - `tsserver_args`: array of command line arguments sent to tsserver Node.js process after the tsserver script path (useful for e.g. overriding tsserver error message locale) - `tsserver_env`: environment variables to set for the tsserver Node.js process (useful for e.g. setting `TSS_LOG`). These variables are merged with the environment variables available to Sublime. +- `auto_complete_api_completions_only`: boolean to make the autocompletion only provides typescript suggestions and hides the standard completions (aka, all the words of the page). (Default value: `false`). Project System ------ diff --git a/TypeScript.sublime-settings b/TypeScript.sublime-settings index 2c113dc3..b1802a83 100644 --- a/TypeScript.sublime-settings +++ b/TypeScript.sublime-settings @@ -1,5 +1,6 @@ { "auto_complete_triggers" : [ {"selector": "source.ts", "characters": "."} ], + "auto_complete_api_completions_only": false, "use_tab_stops": false, "word_separators": "./\\()\"'-:,.;<>~!@#%^&*|+=[]{}`~?", diff --git a/typescript/listeners/completion.py b/typescript/listeners/completion.py index 6b4bd750..d02c4b92 100644 --- a/typescript/listeners/completion.py +++ b/typescript/listeners/completion.py @@ -142,9 +142,10 @@ def handle_completion_info(self, completions_resp): self.run_auto_complete() def run_auto_complete(self): + settings = sublime.load_settings("TypeScript.sublime-settings") active_view().run_command("auto_complete", { 'disable_auto_insert': True, - 'api_completions_only': False, + 'api_completions_only': settings.get('auto_complete_api_completions_only', False), 'next_completion_if_showing': False, 'auto_complete_commit_on_tab': True, })