Skip to content

LSP not working neovim #815

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
codePassion-dot opened this issue Jul 4, 2023 · 26 comments
Closed

LSP not working neovim #815

codePassion-dot opened this issue Jul 4, 2023 · 26 comments
Assignees

Comments

@codePassion-dot
Copy link

What version of VS Code are you using?

not using vscode, using neovim

What version of Tailwind CSS are you using?

v3.3.2

What package manager are you using?

npm

What operating system are you using?

linux

Tailwind config

/** @type {import('tailwindcss').Config} */
module.exports = {
  content: [
    "./pages/**/*.{js,ts,jsx,tsx,mdx}",
    "./components/**/*.{js,ts,jsx,tsx,mdx}",
    "./app/**/*.{js,ts,jsx,tsx,mdx}",
  ],
  theme: {
    colors: {
      purple: "#7C5DFA",
      "purple-light": "#9277FF",
      "blue-pale": "#373B53",
      blue: "#1E2139",
      "blue-medium": "#252945",
      "blue-light": "#7E88C3",
      white: "#F8F8FB",
      "gray-light": "#DFE3FA",
      "gray-medium": "#888EB0",
      dark: "#0C0E16",
      "dark-medium": "#141625",
      orange: "#EC5757",
      "orange-light": "#FF9797",
    },
    extend: {
      backgroundImage: {
        "gradient-radial": "radial-gradient(var(--tw-gradient-stops))",
        "gradient-conic":
          "conic-gradient(from 180deg at 50% 50%, var(--tw-gradient-stops))",
      },
    },
  },
  plugins: [],
};

Reproduction URL
any project just install the lsp and it's broke right now without doing anything

Describe your issue

install tailwindcss lsp, open project with tailwind no lsp and error:
 Error 10:38:02 PM msg_show.lua_error Error executing vim.schedule lua callback: ...b/v0.9.1/nvim-linux64/share/nvim/runtime/lua/vim/lsp.lua:1309: RPC[Error] code_name = InternalError, message = "Request initialize failed with message: Bad file descriptor"
stack traceback:
[C]: in function 'assert'
...b/v0.9.1/nvim-linux64/share/nvim/runtime/lua/vim/lsp.lua:1309: in function ''
vim/_editor.lua: in function <vim/_editor.lua:0>

@nick-vicinity
Copy link

Hello, I am having the same issue. tailwindcss lsp installed via Mason in Neovim.

@jacobo-jaramillo
Copy link

Yesterday trying to figure out what was happening I discover that is not happening in all my projects, trying to use it in old projects it works great and creating another nextjs app from scratch works too but in some projects don't and it's weird because all of the projects are just nextjs no more than that so I haven't figured out why it's working in some of them, maybe cache ?

@dino-rodriguez
Copy link

Getting this issue as well - just installed via Packer and configured default.

@johnrazeur
Copy link

Got the same issue, it's not working in a monorepo in a nextjs package, but it's working on another package not using nextjs on the same monorepo.

@9mm
Copy link

9mm commented Aug 12, 2023

I'm getting this error in Neovim in a vue file

image

@LeNei
Copy link

LeNei commented Aug 17, 2023

I had a similar issue that was resolved by updating the tailwindcss lsp. It seems like create-next-app now configures tailwind with a tailwind.config.ts file instead of a tailwind.config.js file which resulted in my lsp not finding the root correctly. Maybe that helps someone :)

@sethtrain
Copy link

sethtrain commented Aug 19, 2023

I've not figured out what the cause was but I did install the latest nightly build (of neovim) and it seems to have fixed the issue.

@koosty
Copy link

koosty commented Aug 24, 2023

Same here. Using Lazyvim + Mason

    ◍ tailwindcss-language-server
      ▼ Displaying full log
        The system cannot find the path specified.
        Wrote to C:\Users\john\AppData\Local\nvim-data\mason\staging\tailwindcss-language-server\package.json:
        
        {
          "name": "@mason/tailwindcss-language-server",
          "version": "1.0.0",
          "description": "",
          "main": "index.js",
          "scripts": {
            "test": "echo \"Error: no test specified\" && exit 1"
          },
          "keywords": [],
          "author": "",
          "license": "ISC"
        }
        
        
        spawn: npm.cmd failed with exit code 1 and signal 0. 
 

@hansemschnokeloch
Copy link

Same here, but I may have found why. I only have the issue if the project directory contains files that I don't own.
Changing the owner of the files solves the issue in my case.

@big-hero-dev
Copy link

Same here, but I may have found why. I only have the issue if the project directory contains files that I don't own. Changing the owner of the files solves the issue in my case.

This working, my Docker created directory, tks.

@dioklecijan
Copy link

What NodeJS version are you using? I switched from v14 to v18 and the problem is gone.

@badmagick329
Copy link

Same here, but I may have found why. I only have the issue if the project directory contains files that I don't own. Changing the owner of the files solves the issue in my case.

Thank you. After an hour of trying to figure out what was causing the issue, this is what helped. Running a postgres db with docker that had a different owner

@mttrms
Copy link

mttrms commented Oct 27, 2023

Same here, but I may have found why. I only have the issue if the project directory contains files that I don't own. Changing the owner of the files solves the issue in my case.

This working, my Docker created directory, tks.

I experienced the same. Using Remix Blues Stack and docker creates a postgres-data directory.

I ended up having to adjust docker permissions and permissions/owner for that folder to get the errors to go away and get tailwind lsp working.

What version of VS Code are you using?
N/A - NVIM v0.9.1

What version of Tailwind CSS are you using?
v3.3.3

What package manager are you using?
npm

What operating system are you using?
Ubuntu 22.04.3 LTS x86_64
Kernel: 5.15.0-87-generic

Tailwind config

import type { Config } from "tailwindcss";

export default {
  content: ["./app/**/*.{js,jsx,ts,tsx}"],
  theme: {
    extend: {
      colors: {
        'alphabet-blue': '#011627'
      }
    },
  },
  plugins: [],
} satisfies Config;

@thecrypticace
Copy link
Contributor

thecrypticace commented Nov 10, 2023

Hey, so @RobinMalfait who works here also uses Neovim everyday and doesn't encounter any issues. Additionally, several of the issues listed here have been fixed by either updating Neovim or look to be related to file ownership and permissions which is, of course, not something we can do anything about.

I'm going to close this for now but if you encounter further problems using our Language Server with Neovim and can provide:

  1. A repository that you can clone and reproduce these issues in
  2. Details in your Neovim setup / configuration
  3. OS info

I'll happily take another look!

@mttrms
Copy link

mttrms commented Nov 10, 2023

@thecrypticace happy to look into this myself if you've got any debugging tips handy in a neovim environment or else I can figure that out when I have some time.

i've wiped my tailwind config entirely, and when I add a folder and chmod it to 222 and then open a js, ts, or html file I receive the errors mentioned above. If I chmod it to 444 or 777 those errors go away. (my editor / os details are 2 posts up)

it's likely an edge case having folders with limited permissions in them, but it's something a project i work in has (docker generated postgres folder). I can probably fix it by adding that folder to the excluded file array or figure out docker permissions, but I do have 10-15 LSP's installed and tailwind is the only one that has an issue with it, so I do think there's a bug somewhere.

again very happy to look through on my own if you're able to give some direction based on some of this info!

@thecrypticace
Copy link
Contributor

@mttrms Yeah, try adding it to the excluded array. I suspect it has something to do with file watching trying to traverse into a folder that there are no permissions to read.

Now that I understand that one in particular, that by itself seems like a simple-ish thing to look into. I'll see what I can figure out next week.

@thecrypticace thecrypticace reopened this Nov 10, 2023
@mttrms
Copy link

mttrms commented Nov 10, 2023

awesome, thank you! I only recently converted my nvim config so still getting used to some of the config options, but i'll figure that out today and use it as a temp workaround.

I was gonna push up a repo to send over but creating a repo that contains folders without read access is a little strange and git did not like it, wasn't sure that would be 100% reproducible but if you need me to give it a shot LMK.

@thecrypticace thecrypticace self-assigned this Nov 13, 2023
@thecrypticace
Copy link
Contributor

@mttrms I can't reproduce this — but I'm also not great with Vim. I just spun up a VM and installed Neovim, Mason, LSP configs for tailwind, etc… and am able to get completions and what not.

I then created a folder that's owned by root and not readable by the current user (though it is writable because chmod 222 like you mentioned above). I re-opened the project in Neovim and I wasn't greeted with any kind of error. And the language server continues working with completions and everything still working.

Any chance you could set up a repo with like a Dockerfile or some other kind of setup script?

@mttrms
Copy link

mttrms commented Nov 16, 2023

Interesting! Yeah I'll see if I can get this easily repro'd in docker or a setup script for you, sorry you weren't able to see it based on some of the config I shared above, hope it wasn't too much of a time sink.

Not sure how you manage issues, feel free to close if it cleans things up and I can reply with a repo when ready, otherwise will reply once I've got better repro config.

@wxguy
Copy link

wxguy commented Nov 18, 2023

I had the same issue. That was mainly due to the missing npm package. Installed and restated Neovim and all is fine now. Using Arch Linux.

@thecrypticace
Copy link
Contributor

@mttrms closing this for now but will take a look if you can get a repo set up!

@mttrms
Copy link

mttrms commented Feb 2, 2024

@thecrypticace sorry for insane delay here haha, lots of stuff got in the way and I just got used to updating the permissions on my project folder after every restart.

I recently setup a new system though (Ubuntu on WSL) and went through my normal nvim setup and ran into it again.

I decided to try fixing my config for a while, probably spent ~2 hours last night on that with no luck. I ended up installing LazyVim to see if an entirely separate config that seems to work with all LSPs would have the same issue.. and it did.

I totally get not looking into this if it seems obscure or tiny. Last night I also updated my docker config to put the restricted folder outside of my project so at least I don't need to chmod anymore

However I did spin up a little repo with some repro steps if you are interested in taking a look: https://github.com/mttrms/tailwind/tree/main

README has everything you'll need for repro.

Alternatively if you still know how you set your neovim config up I'd love to take a look at that to try that config out on either of my two linux boxes.

@thecrypticace
Copy link
Contributor

Thanks! No worries on the delay — def get that hah. I'll take a look over the weekend!

@andradei
Copy link

andradei commented May 25, 2024

For the issue was the same as what @wxguy said in his comment

I was trying to use the standalone cli version of it but the tailwindcss-language-server doesn't consider it at all.

I wish this was more consistent with the mentioned promise of the standalone cli for those who would only use npm or have a package.json because of tailwind.

@d3vr
Copy link

d3vr commented Jan 1, 2025

For the issue was the same as what @wxguy said in his comment

I was trying to use the standalone cli version of it but the tailwindcss-language-server doesn't consider it at all.

I wish this was more consistent with the mentioned promise of the standalone cli for those who would only use npm or have a package.json because of tailwind.

THANK YOU! I was pulling my hair trying to figure out why completions weren't working in Neovim. As soon as I installed the npm package, things went back to normal!

Is there any way to configure the language server to use the standalone CLI instead ?

@thecrypticace
Copy link
Contributor

Unfortunately, no there is not — sorry! I'd love for this to work in the future but that would require some significant work in the language server and in the CLI to make it possible.

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