Skip to content

Unable to initialise language server due to missing rootPath #724

Closed
@airblade

Description

@airblade

What version of Tailwind CSS IntelliSense are you using?

v0.0.10 of the npm package (via npm install -g tailwindcss-language-server)

What version of Tailwind CSS are you using?

v3.2.7

What package manager are you using?

npm

What operating system are you using?

macOS

Tailwind config

/** @type {import('tailwindcss').Config} */
module.exports = {
  content: ['./index.html'],
  plugins: [],
}

VS Code Vim settings

I'm using Vim 9.0.472 and the vim-lsc plugin. My vimrc config is:

let g:lsc_server_commands = {'html': 'tailwindcss-language-server --stdio'}

Describe your issue

I have a single index.html file in my Tailwind project directory. Tailwind's CLI works fine because it detects my classes and generates the stylesheet as expected.

I want to be able to (a) autocomplete Tailwind's classes and (b) hover over a class to see the actual CSS it corresponds to.

I assume the language server is the best way to achieve this? Or is there a way to generate a stylesheet with every possible Tailwind CSS class, which I could then use a source for autocompletions?

Anyway, when I open my index.html in vim, I see the error message No workspace folders found, not initializing.

I believe this error comes from here:

if (!this.initializeParams.rootPath) {
console.error('No workspace folders found, not initializing.')
return
}

Logging shows me that vim-lsc sends this to the language server:

{"method":"initialize","jsonrpc":"2.0","id":1,"params":{"rootUri":"file:///path/to/my/project","capabilities":{"workspace":{"configuration":true,"applyEdit":true},"textDocument":{"completion":{"completionItem":{"snippetSupport":false,"tagSupport":{"valueSet":[1]},"deprecatedSupport":true}},"synchronization":{"willSaveWaitUntil":false,"willSave":false,"didSave":false},"codeAction":{"codeActionLiteralSupport":{"codeActionKind":{"valueSet":["quickfix","refactor","source"]}}},"signatureHelp":{"dynamicRegistration":false},"hover":{"contentFormat":["plaintext","markdown"]},"definition":{"dynamicRegistration":false}}},"clientInfo":{"name":"vim-lsc"},"processId":62896,"trace":"off"}}Content-Length: 52

{"method":"initialized","jsonrpc":"2.0","params":{}}Content-Length: 20281

{"method":"textDocument/didOpen","jsonrpc":"2.0","params":{"textDocument":{"uri":"file:///path/to/my/project/index.html","version":1,"languageId":"html","text":"..."}}}Content-Length: 44

{"method":"shutdown","jsonrpc":"2.0","id":2}Content-Length: 33

{"method":"exit","jsonrpc":"2.0"}

And gets these responses:

{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":1,"message":"No workspace folders found, not initializing."}}Content-Length: 276

{"jsonrpc":"2.0","id":1,"result":{"capabilities":{"textDocumentSync":1,"hoverProvider":true,"colorProvider":true,"codeActionProvider":true,"documentLinkProvider":{},"completionProvider":{"resolveProvider":true,"triggerCharacters":["\"","'","`"," ",".","(","[","!","/",":"]}}}}Content-Length: 38

{"jsonrpc":"2.0","id":2,"result":null}

Do you think the problem is with what Vim is sending to the language server? Should it be including a rootPath parameter somewhere in the initial message? (I tried including one inside the params, with the same value as the rootUri parameter, but then I got an Unhandled exception: No such file or directory error messsage.)

I'd be grateful for any suggestions – thanks!

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions