-
Notifications
You must be signed in to change notification settings - Fork 2.2k
fix(tailwindcss): only attach to existing files #3875
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
Conversation
should this config specify
|
root_files = util.insert_package_json(root_files, 'tailwindcss', fname) | ||
root_files = util.root_markers_with_field(root_files, { 'mix.lock' }, 'tailwind', fname) | ||
on_dir(vim.fs.dirname(vim.fs.find(root_files, { path = fname, upward = true })[1])) | ||
if vim.uv.fs_stat(fname) ~= nil then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add a 1-line comment giving a hint
if vim.uv.fs_stat(fname) ~= nil then | |
-- tailwind lsp behaves poorly if the buffer is not backed by a file. https://github.com/neovim/nvim-lspconfig/pull/3875 | |
if vim.uv.fs_stat(fname) ~= nil then |
Looks like it will be fixed on the server side, so no need for a workaround here |
Thanks for followup! |
o/ I'm a maintainer of the Tailwind CSS language server. I just did some research into this and the thing I thought was happening is not. It did reveal a bug that causes the exact saome issue but I think Neovim is at fault here as well. When you open file at Can see more details in my comment here: tailwindlabs/tailwindcss-intellisense#1396 (comment) I think detecting a workspace folder of |
What is the lsp client expected to do in that case (arbitrary non-file scheme)? If you feel like opening an issue in core https://github.com/neovim/neovim that will be helpful, I didn't find a tracking issue for this topic. Related: neovim/neovim#19797 |
Hey Justin, I tracked down the root cause of this issue and nvim actually handles these schemes just fine. The issue arises from using I can open an issue to track that, if you see fit. |
The tailwind LSP behaves poorly when attaching to "virtual" buffers. I've noticed that it gets stuck with 100% CPU usage when using the "virtual buffers" from diffview (i.e., via
:DiffviewOpen
).I thought about reporting this issue upstream (tailwind), but I decided to first open a PR here to get some thoughts. There's a related issue on neovim, and I understand that the current method to handle conditional attaching is using the
root_dir
function, but so far I haven't seen any configs using this trick, so I'm not sure if it's welcome here.