Sublime Forum

[SOLVED] Does ST3 support autocompletion of tabtrigger keywords?

#1

Currently I experiment with snippets a lot. I can trigger them by typing fully the tabtrigger keyword and hitting tab. As I was reading on various websites I saw from time to time a hint that it could be possible to have an autocomplete popup while typing the tabtrigger keyword. In that way I could see various snippets that start with that chars and would also so the possible description.

Is that possible and if yes how would I activate that?

0 Likes

#2

You can translate your snippet into auto completion to accomplish that. I already did so in the past because the need to type the whole tabtrigger is somewhat useless in most cases because no one knows them.

You can add the whole content of the snippet to an autocompletion and escape the newlines and tabs.

Example:

{
	// Toplevel Statement Snippets
	"scope": "source.s840d_gcode - comment - string - support.variable - meta.definition - meta.redefinition - meta.control - meta.function - meta.function-call",
	"completions": [
		{
			"trigger": "ARC  definition \tsnippet",
			"contents": "%_N_${1/.+//m}${1:${TM_FILENAME/^((.*?)\\..*)?$/$2/:UNTITLED}}_DEF\n;\\$PATH=/_N_DEF_DIR\n"
		},
}
1 Like

#3

Just a small note that we’re taking about normal completions here, not auto completions, since they are static.

2 Likes

#4

Aha? There is a difference?

0 Likes

#5

Mostly in a conventional sense. Auto-completions are supposedly context-aware and provide member or attribute completions, for example, while .sublime-completions files are basically always static.

I mean, yes, you could make a very precise syntax definition and assign very fine-grained scopes that allow you to provide very accurate completions, but nobody does that (for good reason) and the naming is just a convention anway.
It might be that I’m the only one who cares about this distinction, but it makes sense from a user point of view imo. I try to get new packages added to the default channel to have the correct labels and package names regarding this.

3 Likes

#6

@FichteFoll & @deathaxe as it seems I found a simpler solution.

The package SublimeCodeIntel provides not only Code Intelligence it also has an autocomplete engine. With that package enabled it provides automatically also an autocompletion for user generated snippets. :slight_smile:

0 Likes

#7

What would be a good reason? It is because it would be too difficult?

0 Likes

#8

Providing these “semi-content-aware” completions via the API hook would be easier.

2 Likes