Limit Emmet CSS autocomplete suggestions
Are there any ways to tone down Emmet's autocomplete suggestions, particularly for CSS?
Right now, typing out color: CanvasColor (valid CSS) has a suggestion for Emmet abbreviation.
If you accept the completion, about half of the time it ends up with something like this:
The other half of the time it doesn't do... anything?
Neither is ideal. If Emmet doesn't have anything helpful to add, can it not offer an autocompletion?
Hmm, definitely it’s a but, Emmet should’t provide any completions in this case. Will take a look
Should be fixed in v0.3.2
It does seem to be better about not jacking up the expansion, though it does still weirdly offer to expand the property as an abbreviation even after you've given the property a value. Hitting enter to complex the expansion results in the value getting bumped outside the semicolon.
https://github.com/user-attachments/assets/a41f49c2-a15e-4adb-b957-4d90f38b107e
Oh, it’s an issue with abbreviation tracking, it should stop right after abbreviation becomes invalid. Will check it out
Thanks, Sergey!
Another example of the abbreviation tracking problem: Emmet tries to expand max-inline-size: 300px; and for whatever reason, that expands to max: inline size; 300px;
https://github.com/user-attachments/assets/49bdc37f-879d-4104-a237-52d73b4e74e0
Oh, that’s weird, will check it out
Just published v0.3.3 that should have this issue fixed. Note that for max-inline-size example, you should set new option 'stylesheet.strictMatch': true (see main.ts for example), this will prevent Emmet to convert unmatched abbreviations to CSS properties
Even with the new version and option set, there are the occasional odd suggestions. Any way to improve that?
@shshaw can’t reproduce that on demo page of current repo. Emmet completion disappers when I type font. Maybe you can demo a video?
Also please make sure you have most recent core Emmet package [email protected]
I ensured all packages are updated. Same behavior on 2.4.11
It's definitely better; I can't get font-weight: 500; to expand oddly, but Emmet is still offering to expand font-weight: to font: weight; until you add a space after the colon :. Same with background-color: and other dash separated properties.
https://github.com/user-attachments/assets/6039fc9e-431f-47ee-b86f-34d40033410d
It looks like that's the way Emmet behaves in CodeMirror 5 so I think this isn't technically a bug, it's just a bit more visible now in the CM6 autocomplete menu.
https://github.com/user-attachments/assets/ce7857b2-4cb0-4661-ab32-cd3a9cdedb1c
I think I'll close this for now and we can see if we get any user feedback about it. Thanks, Sergey!