codemirror6-plugin icon indicating copy to clipboard operation
codemirror6-plugin copied to clipboard

Limit Emmet CSS autocomplete suggestions

Open shshaw opened this issue 1 year ago • 8 comments

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.

Screenshot 2024-07-03 at 2 14 57 PM

If you accept the completion, about half of the time it ends up with something like this: Screenshot 2024-07-03 at 2 17 40 PM

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?

shshaw avatar Jul 03 '24 19:07 shshaw

Hmm, definitely it’s a but, Emmet should’t provide any completions in this case. Will take a look

sergeche avatar Jul 03 '24 19:07 sergeche

Should be fixed in v0.3.2

sergeche avatar Aug 05 '24 08:08 sergeche

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.

Screenshot 2024-08-05 at 11 21 54 AM

https://github.com/user-attachments/assets/a41f49c2-a15e-4adb-b957-4d90f38b107e

shshaw avatar Aug 05 '24 16:08 shshaw

Oh, it’s an issue with abbreviation tracking, it should stop right after abbreviation becomes invalid. Will check it out

sergeche avatar Aug 06 '24 08:08 sergeche

Thanks, Sergey!

shshaw avatar Aug 06 '24 11:08 shshaw

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

shshaw avatar Sep 06 '24 15:09 shshaw

Oh, that’s weird, will check it out

sergeche avatar Sep 09 '24 12:09 sergeche

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

sergeche avatar Sep 18 '24 09:09 sergeche

Even with the new version and option set, there are the occasional odd suggestions. Any way to improve that?

Screenshot 2024-10-03 at 4 17 23 PM

image

shshaw avatar Oct 03 '24 21:10 shshaw

@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]

sergeche avatar Oct 10 '24 08:10 sergeche

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.

Screenshot 2024-10-18 at 7 17 04 AM

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!

shshaw avatar Oct 18 '24 12:10 shshaw