Open cskeeters opened 3 weeks ago
Downgrading neovim can mitigate this error.
The above are not quite related, but fixing warnings that were detected by vscode. One of them, "allowing overlapping tokens", is not implemented by all clients.
See https://github.com/neovim/neovim/issues/30675
Setting offset_encoding = "utf-8"
addresses the issue for me.
lspconfig.tinymist.setup{
on_attach = on_attach,
flags = lsp_flags,
capabilities = capabilities,
offset_encoding = "utf-8",
settings = {
}
}
Setting offset_encoding = "utf-8" addresses the issue for me.
It is rare to set offset_encoding
manually, so this looks like a workaround.
https://github.com/neovim/neovim/issues/30675#issuecomment-2395543389
Yes, the LSP appears to be sending back UTF-8 encoded positions, not UTF-16 encoded positions (default) so you would need to specify that in the set up.
It was previously being masked by this pcall 003b8a2#diff-3b3a433b8799463f3cb0bcfbb0f1b699c0b949e7e31516e82b94a9c6aea3b395L81
But, i think this is the correct behaviour
This brings some smell of neovim (implementation or config) bugs because language server is likely to not respond with utf-8 encoding if the server had handshaked with agreeing position_encoding: Utf16
(by default). I checked it just now, language server responds tokens with utf-16 position encoding in VS Code (by default). Three possible causes:
Hint: You can check the handshake result in the log:
[2024-10-07T05:16:39Z INFO tinymist::server] LanguageState: initialized with config Config { const_config: ConstConfig { position_encoding: Utf16, ... }, ... }
Neovim developers are fixing this bug. We can check it again in the next release of neovim.
A typst file with contents:
Will cause the error
index out of range
@ semantic_tokens.lua:149 in the neovim runtime.NOTE: No error with non-smart quotes.
It looks like Neovim's runtime is parsing tokens from the tinymist LSP and erroring.
Package/Software version:
tinymist extension version:
v0.11.0
. Get it bytinymist --version
in terminal.