typed-ember / glint

TypeScript powered tooling for Glimmer templates
https://typed-ember.gitbook.io/glint
MIT License
109 stars 51 forks source link

Syntax-forgiving Parser (auto-complete/diagnostics when syntax invalid) #765

Open machty opened 1 week ago

machty commented 1 week ago

Currently, in both Glint 1 and Volar-ized Glint 2, the presence of any kind of syntax error within a <template> tag (in a gts file) breaks all auto-complete/auto-import functionality. Basically it's very difficult to start typing in a component name within a <template> tag and see any auto-complete/auto-import suggestions unless you awkwardly make the syntax valid for long enough to finish an auto-complete. Examples:

invalid syntax due to unclosed <: no autocomplete: Image

no < at all, ... less obvious case, but guessing we'd still want an auto-complete suggestion? Image

auto complete suggestions kick in, but only after awkwardly typing in correct syntax and going back to open element Image

How to implement

There may be somewhat hacky ways to get this working without changing our gts/glimmer parser to be more forgiving; need to check in the Volar discord. But perhaps we do need/want a forgiving Glimmer parser. Haven't looked into that too deeply though.