codemirror6-plugin
codemirror6-plugin copied to clipboard
CSS autocomplete extension is not context aware
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.
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
p10
→padding: 10px
- inside property value: should provide value-specific completions, like
#f.5
→rgba(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).
Fixed in v0.2.0: it should properly detect context and won’t provide completions as expected