Closed thufschmitt closed 3 weeks ago
The specialness of `
comes from the fact that some parse errors are recoverable and others aren't, and we cache imports differently depending on whether the import completely failed to parse vs parsed with some errors. I'm not sure why `
triggers a complete failure but other characters don't...
(yeah, convoluted title, but the repro is somewhat convoluted too, although I'm sure there could be a simpler one if I really understood the problem)
Describe the bug
If
bar.ncl
importsbaz.ncl
, and I modifybaz.ncl
in certain ways, then the LSP panics with a typechecking-related error.See the gif below:
The LSP crashes the instant I type the backtick character. Not every character triggers the crash. From some quick testing, it seems that at least the alphanumeric characters,
&
,/
and@
don't cause it (but everything else I've tried, including things that are part of the grammar like'
cause it).LSP log and backtrace
``` 2024-06-05T17:35:26.450 helix_lsp::transport [INFO] nls -> {"jsonrpc":"2.0","method":"textDocument/didChange","params":{"contentChanges":[{"text":"{\n '\n x,\n}\n"}],"textDocument":{"uri":"file:///tmp/tmp.MTYXidOIhu/baz.ncl","version":18}}} 2024-06-05T17:35:26.450 helix_lsp::transport [ERROR] nls err <- "thread 'main' panicked at core/src/typecheck/mod.rs:2793:26:\n" 2024-06-05T17:35:26.450 helix_lsp::transport [ERROR] nls err <- "Internal error: resolved import not found during typechecking.\n" 2024-06-05T17:35:26.450 helix_lsp::transport [ERROR] nls err <- "stack backtrace:\n" 2024-06-05T17:35:26.450 helix_lsp::transport [INFO] nls <- {"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"diagnostics":[{"message":"unexpected token","range":{"end":{"character":3,"line":1},"start":{"character":2,"line":1}},"relatedInformation":[],"severity":1},{"message":"","range":{"end":{"character":3,"line":1},"start":{"character":2,"line":1}},"severity":4}],"uri":"file:///tmp/tmp.MTYXidOIhu/baz.ncl"}} 2024-06-05T17:35:26.454 helix_lsp::transport [ERROR] nls err <- " 0: 0x5583fe667f77 -To Reproduce
x
inbaz.ncl
Expected behavior A clear and concise description of what you expected to happen.
Environment
Additional context
That looks like it could be related to https://github.com/tweag/nickel/issues/1935 . Not 100% sure though