Sublime Forum

Autocomplete HTML classes

#1

Is there a way of getting Sublime 3 to autocomplete in HTML class attributes when the word contains a hyphen? I have installed a few packages that I thought might help, but none do. I’ve tried:

Emmet
SublimeCodeIntel
AllAutocomplete

I discovered that AutoFileName interferes with autocompletion in CSS files, so I disabled that.

I’ve removed the hyphen from the “word_seperators” setting and this has had no effect. In theory AllAutocomplete should be stuffing the autocomplete list with all CSS selectors, including those with hyphens because I’ve removed the hyphen from word_seperators.

Example: If I have classes in an open CSS file called .foo and .foo-bar then only foo appears in the class attribute autocomplete dropdown. Here’s a screenr:

screenr.com/5JeH

Surely this is a common need when working with HTML and CSS, especially given that hyphenated words are very common in CSS? Is it just a bug in ST’'s autocomplete code? It works perfectly with an underscore instead of a hyphen so it looks as if autocomplete is ignoring this setting. Double-click and Ctrl-D on a word containing a hyphen confirms the setting is working in that context.

0 Likes

#2

What is that thing where you spend ages troubleshooting a problem, googling for a solution, trying a bunch of things and writing it up only to hit on a fix seconds after posting? That just happened. I found a fix for this problem here:

github.com/alienhard/SublimeAll … /issues/18

This does appear to be a bug in ST, but the above mentioned fork of AllAutocomplete works around it.

0 Likes

#3

I’m not sure what the axiom is, but I’m pretty sure one of the corollaries to it is
“You only ever find what you’re looking for in the very last place you look.”
Or maybe that IS the axiom. But I have noticed this phenomenon on more than one occasion.

0 Likes

#4

[quote=“oldwarhorse”]
I’m not sure what the axiom is, but I’m pretty sure one of the corollaries to it is
“You only ever find what you’re looking for in the very last place you look.”
Or maybe that IS the axiom. But I have noticed this phenomenon on more than one occasion.[/quote]

Of course it’s in the last place you look. Why would you look someplace else if you’d already found it? :laughing:

0 Likes