Skip to content

Language Server throws when textDocument client capability is missing #1251

Closed
@cowboyd

Description

@cowboyd

What version of VS Code are you using?

N/A

What version of Tailwind CSS IntelliSense are you using?

0.14.8

What version of Tailwind CSS are you using?

N/A

What package manager are you using?

npm

What operating system are you using?

macOS

Tailwind config

N/A

VS Code settings
N/A

Reproduction

To reproduce, run the lspx shell against any version of the language server:

deno run -A jsr:@frontside/lspx --interactive --lsp "tailwindcss-language-server --stdio"

Then, when prompted enter the command initialize({"capabilities": {}}) into the prompt:

LSP> initialize({"capabilities": {}})

Describe your issue

The tailwind language server throws an error when there are no textDocument capabilities on the client to which it is attached.

LSP> initialize({"capabilities": {}})
Sending request initialize with params [{"capabilities":{}}]...
Error: Request initialize failed with message: Cannot read properties of undefined (reading 'hover')

The spec indicates that textDocument is an optional property https://github.com/microsoft/vscode-languageserver-node/blob/df05883f34b39255d40d68cef55caf2e93cff35f/protocol/src/common/protocol.ts#L1098

While it is very rare that this should happen, it is still a possibility, and the language server should handle it gracefully.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions