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

CSS autocomplete extension is not context aware

Open sergeichestakov opened this issue 2 years ago • 1 comments

See below gif for some examples. Typing in h1 at the top level results in height: 1px being inserted which is unexpected in this context (since h1 is a valid tag that can be selected and not inside a section). In the other case, typing in div.class {} results in div: .class; {} which is also unexpected and can be frustrating since it renders that selector impossible to complete on its own.

GIF Recording 2022-06-21 at 3 55 55 PM(1)

Currently, there are 3 known contexts for CSS in Emmet:

  • global: typing something outside any section or property. In this case, Emmet should provide completions for snippets only. Snippets are code blocks of arbitrary content (like @k for @keyframe { … }.
  • inside section: should provide completions for snippets and properties like p10padding: 10px
  • inside property value: should provide value-specific completions, like #f.5rgba(255, 255, 255, 0.5)

The CM6 extension should respect these contexts to match what's expected and what the equivalent extensions in other editors (e.g. Sublime do).

sergeichestakov avatar Jun 22 '22 22:06 sergeichestakov

Fixed in v0.2.0: it should properly detect context and won’t provide completions as expected

sergeche avatar Aug 08 '22 07:08 sergeche