Sublime Forum

ST4 - Suggestions order (snippets)

#1

Is there a way to change the suggestions order?

In ST3, I can type my snippet trigger chars, hit tab and get the snippet inserted.
The problem is that in ST4, this won’t happen, instead it suggests some variables from other files.
But, if I hit Ctrl+Space after typing the trigger chars, the snippet sugestion is showed, and then after hitting tab the snippet get inserted.

Example:

My snippet have this chars to get triggered:
<tabTrigger>pr</tabTrigger>

When typing ‘pr’ i get suggestions from another file variables, like ‘prd’, ‘prds’, but not the snippet one.
So when hit Ctrl+Space, the first suggestion is the snippet, then when hit Tab, it gets inserted.

I like the ST3 behavior because of less keys pressed to get the snippet inserted, I only have to type ‘pr’ and then tab. In ST4 I have to type ‘pr’, then Ctrl+Space, then ‘Tab’.

Is there something I can put in setting to change this?

Thanks in advance!

0 Likes

#2

There’s a new setting that may help you with this:

	// Controls how the auto complete results are reordered when typing:
	// - "none" will fully reorder the results according to how well the
	//   completion matches the typed text.
	// - "some" will partially reorder the results, taking into account how
	//   well the completion matches whats typed, and likelihood of the
	//   completion.
	// - "strict" will never reorder the results.
	"auto_complete_preserve_order": "some",

The value shown here is the new default; the ST3 behaviour corresponds to the none value.

0 Likes

#3

Thanks for you response.

The option ‘none’ is the best of them, now the snippet is inserted almost every time, but if there’s a delay between typing ‘pr’ and Tab press, the popup shows the other options and no luck.

I tried to disable the popup by setting “auto_complete”: false and “auto_complete_delay”: 10000,
but it shows anyway at the first second.

0 Likes

#4

Does that also happen in Safe Mode? It’s possible that a package/plugin is forcing the AC popup to appear in situations where it normally wouldn’t.

0 Likes

#5

Indeed, in safe mode the problem is gone.

I’ve noticed that the problem is because the popup opens immediately as I type, but in safe mode only appears when press Ctrl+Space.

So I think the solution is disabling that popup, but I don’t know how, this are my settings about that:

"auto_complete": false,
"auto_complete_commit_on_tab": false,
"auto_complete_delay": 10000,
"auto_complete_selector": "source - (comment, string.quoted.single.php)",
"auto_complete_with_fields": true,
"mini_auto_complete": false,
"auto_complete_preserve_order": "none",
0 Likes

#6

Solved!

The problem was given by SublimeCodeIntel package.
Thank you!!!

2 Likes