yioneko / nvim-vtsls

181 stars 4 forks source link

[vtsls: -32603] Document Highlight Request Failure with TypeScript Template Literal Types #9

Open Nhjkl opened 4 months ago

Nhjkl commented 4 months ago

I am encountering an issue with the TypeScript language server when using Neovim NVIM version v0.11.0-dev-194+g6c7677e5d. The error occurs specifically when defining a type with template literal types encapsulated in backticks (`), but not when using single quotes for string types.

Environment:

Neovim Version: NVIM v0.11.0-dev-194+g6c7677e5d

Steps to Reproduce:

Open Neovim with the specified version (NVIM v0.11.0-dev-194+g6c7677e5d).

Create or open a TypeScript file.

Define a type using template literal types as follows:

type foo = `${string}` // Error occurs when typing this line

Notice that an error is thrown: vtsls: -32603: Request textDocument/documentHighlight failed with message: TypeScript Server Error (5.4.5)

For comparison, define another type using single quotes:

type bar = 'xxx' // No error occurs with this line

Expected Behavior:

The TypeScript language server should not throw an error when defining types with template literal types.

Actual Behavior:

An error is thrown when using backticks for template literal types, but not with single quotes.

yioneko commented 4 months ago

Cannot reproduce with latest nvim nightly. Needs LSP communication logs (set vim.lsp.set_log_level("DEBUG")) and the plugin or code you use for document highlight feature on client.

Also, this seems like an issue of underlying tsserver. If you can also reproduce the error in VSCode, then we could do nothing to fix it here.