Skip to content

Intellisene doesn't work in LazyVim #884

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
leoyhk opened this issue Dec 17, 2023 · 7 comments
Closed

Intellisene doesn't work in LazyVim #884

leoyhk opened this issue Dec 17, 2023 · 7 comments

Comments

@leoyhk
Copy link

leoyhk commented Dec 17, 2023

What version of VS Code are you using?

LazyVim

What version of Tailwind CSS IntelliSense are you using?

LSP version is 0.0.14 (installed with Mason)

What version of Tailwind CSS are you using?

3.3.5

What package manager are you using?

pnpm

What operating system are you using?

MacOS Sonoma 14.2

Tailwind config

import type { Config } from "tailwindcss";

export default {
  content: [""],
  theme: {
    extend: {},
  },
  plugins: [],
} satisfies Config;

VS Code settings

{
  "editor.codeActionsOnSave": {
    "source.fixAll.eslint": "explicit"
  },
  "editor.defaultFormatter": "esbenp.prettier-vscode",
  "editor.formatOnSave": true,
  "eslint.rules.customizations": [{ "rule": "*", "severity": "warn" }],
  "eslint.workingDirectories": [
    { "pattern": "apps/*/" },
    { "pattern": "packages/*/" }
  ],
  "typescript.tsdk": "node_modules/typescript/lib",
  "typescript.enablePromptUseWorkspaceTsdk": true,
  "tailwindCSS.experimental.configFile": "./packages/config/tailwind/index.ts",
  "[prisma]": {
    "editor.defaultFormatter": "Prisma.prisma"
  }
}

Reproduction URL
https://github.com/leoyhk/tailwind-lsp-not-working/tree/main

Describe your issue
IDE: Lazyvim

LSP Version: 0.0.14 (Installed with Mason)

Bug observed: LSP does not work when "tailwindCSS.experimental.configFile": "./packages/config/tailwind/index.ts", is active in .vscode/setting.json

Expected behavior: LSP provides suggestions and auto completion

How to Recreate:

  1. Open the dir with nvim (i'm using the Lazyvim distribution), open any .tsx file. LSP does not provide any TailwindCSS related suggestions when typing the classnames.
  2. Enter .vscode/setting.json and comment "tailwindCSS.experimental.configFile": "./packages/config/tailwind/index.ts"
  3. Restart nvim and open any .tsx file, the LSP should work normally
    P.S. I'm searching for a solution / config that could make LSP work in lazyvim/nvim without changing the project settings (since it is a team project), i.e. i shall not treat commenting the line as the solution.

LspInfo shows tailwindcss is up and running, but no suggestions are given while typing
image

@rmerli
Copy link

rmerli commented Feb 5, 2024

Currently having the same issue, I checked the LspLog and when starting the lsp server I get this error:
[ERROR][2024-02-05 19:02:38] ...lsp/handlers.lua:535 "Unhandled exception: Bad file descriptor\nError: Bad file descriptor"

@rob32
Copy link

rob32 commented Mar 21, 2024

same here with django (htmldjango)

...lsp/handlers.lua:535 "Unhandled exception: Bad file descriptor\nError: Bad file descriptor"

htmldjango-lsp-tailwindcss

@Picalines
Copy link

I came across the same thing while working on my project. The application is wrapped in Docker, the database container saves files to a local volume. I cloned the repository onto 2 machines and downloaded identical nvim configurations and tailwind LSPs. The tailwind LSP works correctly only where docker has not yet created the volume. On another machine, a line appears in the logs:

[ERROR][2024-05-14 18:21:02] ...lsp/handlers.lua:535	"Unhandled exception: Bad file descriptor\nError: Bad file descriptor"

The local volume folder definitely has special file permissions; repro in #815 shows how, due to some file permissions, the server receives an unhandled exception

Thoughts on this: perhaps the tailwind server should not look in directories ignored by git? I did not open files in volume on purpose - maybe the server is trying to get a list of files available to it?

@zackAJ
Copy link

zackAJ commented Aug 25, 2024

latest updates broke it for me as well, I use Neovim btw.

@ar7casper
Copy link

@leoyhk Have you found a solution?

@rmerli
Copy link

rmerli commented Nov 28, 2024

My issue is related to the permission of a docker generated folder. I have a postgres container and it creates a data folder where postgres is the owner. For some reasons tailwind tries to access it and is it causing the error. My current very annoying solution is to chmod the folder every time I bring up the container. Hopefully it will get fixed soon, idk

@thecrypticace
Copy link
Contributor

The original issue here is very likely a configuration problem with the neovim LSP setup — though I can't speak to exactly what that issue is. I've got a setup with LazyVim on Ubuntu 22 that's working perfectly (based on the repro from #815).

Aside, about the "bad file descriptor", the only way I've seen this happen is if:

  • You're on linux;
  • Your LSP client does not support watching for changed files;
  • Your environment supports Parcel Watcher;
  • The workspace folder being passed to the language server does not exist or isn't accessible
  • (note: macOS does produce something similar but the error message is actually descriptive)

In which case we'll get through some initialization steps, eventually attempt to initialize Parcel Watcher, and it throws that error. This does prevent the workspace folder from initializing but in a multi-root workspace the others should still initialize if they're valid and accessible. Also, if the client sends a workspace folder change event we'll still attempt to re-initialize the folder so the server itself is still responding to requests as expected.

I can't get this to happen where the server stops working. I could do an fs.access(…) on the workspace folder for a better error message but that's about it (I've done that in #1276).

Notably, I'm also unable to reproduce the case of a folder that contains files and/or folders with other permissions causing completions to stop working — even with the reproduction in #815. I used an Ubuntu VM through Parallels on macOS (Apple Silicon) and WSL2 (Ubuntu 24.04.2 LTS) on Windows 11 on x86_64 (AMD Ryzen 3700X).

Gonna close this one — if someone can provide another reproduction though I will definitely take a look.

thecrypticace added a commit that referenced this issue Mar 20, 2025
On Linux when using a LSP client that does not support watching files on
behalf of the server, we'll use Parcel Watcher (if possible). If we
start the watcher with a non-existent or inaccessible directory, it will
throw an error with a very unhelpful message: "Bad file descriptor".

The best thing we can do is an initial check for access to the directory
and log a more helpful error message if it fails:

<img width="1013" alt="Screenshot 2025-03-20 at 12 33 29"
src="https://github.com/user-attachments/assets/425c1fac-cd5e-492f-89bf-76d3a733670d"
/>

See
#884 (comment)

---------

Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants