glint icon indicating copy to clipboard operation
glint copied to clipboard

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

Open machty opened this issue 1 year ago • 1 comments

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.

machty avatar Sep 23 '24 02:09 machty

Some of this will be possible with the Error nodes available in this branch of the parser: https://github.com/glimmerjs/glimmer-vm/pull/1690

NullVoxPopuli avatar Mar 23 '25 17:03 NullVoxPopuli