Open trevorhiley opened 2 years ago
Hi sorry, the plugin wasn't quite done yet, you got here very early 😄
I've gone ahead and updated the README with instructions on how to set things up.
Probably my lack of lsp knowledge (new user to that), but I'm still not totally succeeding.
When I open a file, I get:
Spawning language server with cmd: tailwindcss-language-server
failed. The language server is either not installed, mi
ssing from PATH, or not executable.
I can do the :TailwindColorsAttach and it all works, but trying to get it to "autostart".
I have the lspconfig on_attach function copied from their setup example with the
require("tailwindcss-colors").buf_attach(bufnr)
included at the end of the function:
`local nvim_lsp = require('lspconfig')
-- Use an on_attach function to only map the following keys -- after the language server attaches to the current buffer local on_attach = function(client, bufnr) local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end
-- Enable completion triggered by
-- Mappings. local opts = { noremap=true, silent=true }
-- See :help vim.lsp.*
for documentation on any of the below functions
buf_set_keymap('n', 'gD', '
require("tailwindcss-colors").buf_attach(bufnr) end
-- Use a loop to conveniently call 'setup' on multiple servers and -- map buffer local keybindings when the language server attaches local servers = { 'pyright', 'tailwindcss', 'rustanalyzer', 'tsserver' } for , lsp in ipairs(servers) do nvim_lsp[lsp].setup { on_attach = on_attach, flags = { debounce_text_changes = 150, } } end`
Anybody got an idea of what to check? Thanks!
So from what I can tell, the setup function shouldn't be able to affect the language server startup because the on_attach
function is run after the language server has already been started.
Are you sure the on_attach
function call is what's causing the issue?
If it isn't then as you suspected, it might just be something going on with lsp-config.
So I'm surprised that TailwindColorsAttach
works since it basically just does the same thing. You could setup an autocmd to run whenever you load a javascript/ect. file. It's a bit of a band-aid solution but it could work.
First of all, thank you for making this. I've been working on switching from vscode to neovim and I've been working with Svelte/Tailwind a lot. The one feature I couldn't seem to find was a way to show the colors on the tailwind classes.
I've installed the plugin, and I called require 'tailwindcss-colors'.setup() in a lua script thinking that's what I was missing, but I'm not getting colors on the tailwind classes anywhere. I thought maybe it was a problem using Svelte so I tried html as well.
The tailwindcss lsp is working and I see it running with LspInfo so I know that's not the issue. Any setup instructions I might be missing?