Stalls for large number of LSP completion items

I’m trying to write an LSP extension to integrate with the Tailwind CSS LSP but am facing a persistent issue of Nova freezing up when trying to trigger a completion.

The draft version of the extension can be found here: GitHub - alex-ketch/Nova-Tailwind-LSP: ⚠️ WIP — Not ready for use

To reproduce:

  • Clone repository: GitHub - alex-ketch/Nova-Tailwind-LSP: ⚠️ WIP — Not ready for use
  • Run npm install
  • Open project in Nova
  • From Menu bar select ExtensionsActivate Project as Extension
  • Open one of the test files in /test directory
  • Try to type inside the className attribute or after the @apply text-base directive
  • See infinity spinning beach ball

Current hypothesis based on quote below is that Tailwind returns many thousands of completion options, overwhelming Nova.

tailwindcss server always returns the 9k items
- high ram and cpu usage with tailwindcss


Few other observed errors in the Debug console:

  • -32601 Unhandled method textDocument/codeAction
  • The following dataCorrupted error:
Unhandled exception: dataCorrupted(Swift.DecodingError.Context(codingPath: [CodingKeys(stringValue: "params", intValue: nil), CodingKeys(stringValue: "registrations", intValue: nil)], debugDescription: "Could not decode registration with id 94bd06b3-4969-4317-bc3a-13fdf56a162d, method \"textDocument/documentColor\".", underlyingError: nil))
Error: dataCorrupted(Swift.DecodingError.Context(codingPath: [CodingKeys(stringValue: "params", intValue: nil), CodingKeys(stringValue: "registrations", intValue: nil)], debugDescription: "Could not decode registration with id 94bd06b3-4969-4317-bc3a-13fdf56a162d, method \"textDocument/documentColor\".", underlyingError: nil))
    at Ft (/Users/ketch/Play/Nova/TailwindCSS LSP.novaextension/node_modules/@tailwindcss/language-server/bin/tailwindcss-language-server:139:236)
    at ge (/Users/ketch/Play/Nova/TailwindCSS LSP.novaextension/node_modules/@tailwindcss/language-server/bin/tailwindcss-language-server:138:6875)
    at Immediate.<anonymous> (/Users/ketch/Play/Nova/TailwindCSS LSP.novaextension/node_modules/@tailwindcss/language-server/bin/tailwindcss-language-server:138:6722)
    at process.processImmediate (node:internal/timers:471:21)

Hello!

Sorry for the late reply. I’ll look into investigating why this might be slowing down so badly. 9k items is a lot, I agree, and ideally the tailwind LSP server wouldn’t be sending that much, but theoretically Nova should be able to handle it.

The JSON error is also unexpected. Hopefully that’s easy to fix.

Logan

1 Like

Howdy again @logan, first of all thanks for the v11 goodies!
Before I continue my periodic work into Tailwind LSP support, I wanted reach out to get your opinion on whether you see a potential user-land workaround for the decoding error, or if it’s something that needs to be supported/fixed in Nova first?
Thanks!

There’s some hope at last! TailwindLSP received a PR to fix some dynamic registration recently and that has gotten it working in Nova :tada:

Haven’t tested this beyond the initial validation shown in the screenshot below, but I am hopeful.
The completion docs doesn’t show parse the markdown code block, but that’s minor compared to the LSP not working at all.
No promises on when/if I’ll have a chance to create a full extension, but the POC at the GitHub repo linked above is up to date.

1 Like