Sublime Forum

ST4 Autocomplete - limit scope?

#1

Hello. Typing in ST4 is now sluggish compared to ST3 for me and it seems directly related to the number of file sit is trying to pull into autocomplete. How can I limit the scope of the autocomplete to get back the typing responsiveness of ST3?

1 Like

#2

+1

This is exactly the concern for me in using ST4.

0 Likes

#3

There’s a new setting that’s enabled by default that allows ST4 to pull completions from all files in the symbol index (i.e. all files that are contained in folders you have open in the side bar):

	// Auto complete will used indexed data to provide completions from other
	// files when this is enabled
	"auto_complete_use_index": true,

It defaults to being turned on, and turning it off returns things back to the ST3 method of only providing completions from files that are actively open.

That said, do you seem the same lag in typing in Safe Mode? It’s possible that a plugin may be trying to do something on every key press or doing extra work to add completions that might be contributing to the issue.

1 Like

#4

Interesting - it was a plugin that was causing the issue. Curious how it caused the glitch in the new 4 install but 3 was still happy.

Nonetheless, it would be great to limit the scope of the code completion. I really only need code completion for a subset of my project and it would be really helpful to not shift through what I know I don’t need.

Thanks!

0 Likes

#5

The AC system in ST4 has been significantly revamped and updated behind the scenes, so it’s possible that older plugins are trying to do something in a way that makes the new system a bit unhappy, such as trying to do manually things that it already does itself.

Regarding limiting the scope of completions, depending on what you mean by that you can adjust the auto_complete_selector setting. It specifies in what situations the AC panel automatically appears, so if there are instances where you don’t want that you can adjust it. Regardless of the setting, you can always summon the AC panel manually.

0 Likes

#6

Is there a setting that you can set for code completion to only show what the functions available are and only list the variables in the current python file your working on?

Maybe packages that will do the same?

Thank you

0 Likes

#7

Possibly LSP, depending on what kind of granularity you want. The internal system will show all symbols from all files or just from the current file, depending on your settings; there is no granularity there to say “all functions from everywhere but variables only from here” kind of thing.

On the flip side, LSP has actual knowledge about the structure and form of the language that you’re working with, so it can offer you only symbols that make sense in the current context. For Python that may involve it showing you importable items from other places and auto adding the import for you, which may or may not be what you want.

I can’t say for sure on that one because although I do use LSP for production Python coding at work, I don’t rely on AC to tell me the symbol and instead use it to autocomplete what I already want, so I don’t have enough muscle memory reps off the top of my head to be exactly sure how it behaves.

0 Likes