Sublime Forum

Configure what Autocomplete suggests

#1

Hi there,

My sublime text 3 used to worked perfectly.
When editing my files, it used to show me only “relative” suggestions. For example, in a ts file, working on a class, if I typed this. somewhere in a method, autocomplete only showed me the methods and properties of my object …

But since few weeks, I had to reinstall sublimetext (after OS migration), the autocomplete is way too verbose. It suggest me ALL THE WORDS used in the file … which is completely a non-sense for a code sheet.
I just type this. : what would I care about those words here ?

Is there any way to go back to the previous behavior ?
Or a way to manage the displayed list (clear the default one, – I am pretty sure nobody cares about thoses words anyway, – and let the language packages add the real expected suggestions) ?
Or at least force auto complete popup to start systematically from the top of the list where properties and methods are grouped, because sometimes, for no reason, it starts at the middle of the list ?

For the records : I tried to remove ALL my packages (keeping only the Typescript one) … and it changed nothing.

I look angry right now … but I am not : I love your software and thank you very much for it. :kissing_heart:
I just spent too many hours trying to deactive this annoying behavior and it drives me crazy. :grimacing:

0 Likes

#2

It sounds to me like you were using a plugin for auto completion before and either no longer have said plugin or it isn’t working. The default autocomplete in Sublime Text 3 is generally not aware of the context of your code, so gives you anything that matches in the file.

0 Likes

#3

Hi,

Thanks for your reply.

You are right: the default autocomplete does not know the context of the file.
I am using the Typescript package which adds the expected completion to the list.

But what I expect is to hide these default suggestions.
When I turn off default autocomplete (using " auto_complete ": false,), it hides the pop-up window and I have to press ^ Space to open it, and by the way, it still contains all the words on the page … so it’s not really disabled. The name of the option is misleading.

I really expect the popup to still appear automatically, but containing only what the packages add to it … and not all of these words completely useless and counter-intuitive in some cases …

Is there a way to tell Sublime Text to keep the pop-up open automatically, but to hide the default content or assign it a blank/noop source?
or a way to tell a package to “replace” the contents of the list instead of adding it?

I think splitting the current “auto_complete” option into two separate options (autocomplete_auto_display and autocomplete_default_content) might be cool!

0 Likes

#4

There is a way to hide these default completions for a plugin, there are two flags for it described in the API reference for the on_query_completions method:

sublime.INHIBIT_WORD_COMPLETIONS: prevent Sublime Text from showing completions based on the contents of the view
sublime.INHIBIT_EXPLICIT_COMPLETIONS: prevent Sublime Text from showing completions based on .sublime-completions files

I know that the LSP package uses this based on a user setting to only show context specific completions if desired. So you might want to create an issue or pull request for that at the TypeScript package repository, or alternatively you could search the plugin code and create an override of it for yourself.

1 Like

#5

Thank you both so much for your help …
You were right: problem comes from the Typescript plugin, and more especially from this commit :

It removes the flag sublime.INHIBIT_WORD_COMPLETIONS from the on_query_completions return

It has been released few weeks ago, which coincides with the beginning of my troubles…
I reverted manually this change and retrieved my expected behavior.

Thanks again.

(For the record, I just pushed a PR to fix the pb : https://github.com/microsoft/TypeScript-Sublime-Plugin/pull/739)

0 Likes