Sublime Forum

Autocomplete is not disabled for strings

#1

Hello, I am using the latest build 4107, and I can’t figure out how to disable Autocomplete when typing inside a quoted string. (Applies to all languages: JS, PHP, etc).
I have the following plugins installed: Package Control, Sass, and SFTP. I don’t think any of those would mess with PHP or JS autocomplete settings.
I looked at this answer: Preventing unwanted auto-completion in comments
But the settings to exclude quoted and double-quoted strings are already present. here’s the snippet from the default config file, which I assume is active.

// Enable auto complete to be triggered automatically when typing.
	"auto_complete": true,

	// The maximum file size where auto complete will be automatically triggered.
	"auto_complete_size_limit": 4194304,

	// The delay, in ms, before the auto complete window is shown after typing
	"auto_complete_delay": 50,

	// Controls what scopes auto complete will be triggered in
	"auto_complete_selector": "meta.tag, source - comment - string.quoted.double.block - string.quoted.single.block - string.unquoted.heredoc",

	// Additional situations to trigger auto complete
	"auto_complete_triggers":
	[
		{"selector": "text.html, text.xml", "characters": "<"},
		{"selector": "punctuation.accessor", "rhs_empty": true},
	],

My custom preferences are only the following:

{
	"color_scheme": "Packages/Color Scheme - Default/Monokai.sublime-color-scheme",
	"font_size": 10,
	"ignored_packages":
	[
		"Vintage",
	],
	"theme": "Adaptive.sublime-theme",
	"hardware_acceleration": "opengl",
}

Why is it ignoring these settings?

0 Likes

#2

The default auto_complete_selector is unchanged since ST 3176 (or earlier) and it excludes .block strings only. Normal quoted strings are still included into auto completions.

That’s nothing new to ST 4107.

If you want to exclude completions from strings you may want to tweak the selector a bit. Maybe:

"auto_complete_selector": "meta.tag, source - comment - string.quoted.double - string.quoted.single - string.unquoted.heredoc",

… or just …

"auto_complete_selector": "meta.tag, source - comment - string",

… to catch them all.

0 Likes

#3

I think this topic has come up for several years, and has been misunderstood just as long. Here is the problem:

How do we disable the popup that appears when typing inside a string:

0 Likes

#4

My hunch is those completions to be provided by a plugin. It’s otherwise quite unusual to see such a clean list of file names in python source.

If the plugin (or anything else) also defines an auto_complete_trigger such as

	"auto_complete_triggers":
	[
		{"selector": "source, text", "characters": " "},
	]

completion panel would be displayed everywhere (even within strings), if a space is entered.

0 Likes

#5

I am guessing the user has AutoFileName installed https://packagecontrol.io/packages/AutoFileName

1 Like

#6

Yes! autofilename was the problem for me.

0 Likes