Sublime Forum

How to ban specific words from autocompletion?

#1

I like autocompletion, and I like the fact that for the most part it works decently well in absence of a language server or other advanced plugin system. I use it for QML development all the time.

However, there are in some cases Sublime Text would suggest meaningless words (like names of rarely used constants), and what’s worse it would do it consistently. For example, I have to be careful when typing imhe as a shorthand for implicitHeight because every time I do Sublime Text suggests some non-sense ImhEmailCharactersOnly entry, and when I try to narrow it down to imheigh, I get itemHeight, which is also useless and error-prone.

I have a simple request. Can I just ban these specific words from completing in QML scoped files ever?

1 Like

#2

In case source of those completions is a sublime-completions file, you could create an override with those entries removed. Plugin provided completions can’t be black-listed externally.

0 Likes

#3

I don’t know what’s sublime-completions file. And I’m pretty sure they are coming from simply Sublime Text examining existing code base without any plugins’ help.

0 Likes

#4

sublime-completions are static lists of tokens to suggest in auto completions panel in certain scopes.

Example: https://github.com/sublimehq/Packages/blob/master/Java/Java.sublime-completions


What you are seeing are so called word completions. Plugins can disable them at all, but there’s also no blacklist to filter certain words. It would, IMHO make even less sense than for static lists.

To improve “hit rate” you probably want to set "auto_complete_use_history": true. With this flag set ST remembers committed completions and prefers them the next time the same trigger word is typed, very much like command palette does.

It requires "auto_complete_preserve_order": "some", or "auto_complete_preserve_order": "none", being set, to enable ST to reorder completion candidates.

1 Like