Jezda1337 / nvim-html-css

CSS Intellisense for HTML
115 stars 13 forks source link

Newbie using to install this plugin #12

Closed wouterschiedam closed 8 months ago

wouterschiedam commented 8 months ago

Hi, im quite new to the whole vim experience I came across your plugin and it looks awesome however im having some trouble trying to install it correctly I keep getting the following error:

Error while calling lua chunk: ...ck/packer/start/plenary.nvim/lua/plenary/async/async.lua:18: The coroutine failed with this message: .../site/pack/packer/start/plenary.nvim/lua/plenary/job.lua:405: Failed to spawn process: { _additional_on_exit_callbacks = {}, _shutdown_check = <userdata 1>, _stderr_results = {}, _stdout_results = {}, _user_on_exit = <function 1>, args = { "-sSL", "-D", "/tmp/plenary_curl_f8ef4cfe.headers", "--compressed", "-X", "GET", "http://en.wikipedia.org/wiki/Michael_Col lins_(astronaut)" }, command = "curl", enable_handlers = true, enable_recording = true, interactive = true, pid = "EMFILE: too many open files", stderr = <userdata 2>, stdin = <userdata 3>, stdout = <userdata 4>, user_data = {},

= <1>{ __index = , _create_uv_options = , _execute = , _pipes_are_closed = , _prepare_pipes = , _reset = , _shutdown = , _stop = , add_on_exit_callback = , after = , after_failure = , after_success = , and_then = , and_then_on_failure = , and_then_on_failure_wrap = , and_then_on_success = , and_then_on_success_wrap = , and_then_wrap = , chain = , chain_status = , co_wait = , is_job = , join = , new = , pid = , result = , send = , shutdown = , start = , stderr_result = , sync = , wait = } } stack traceback: .../site/pack/packer/start/plenary.nvim/lua/plenary/job.lua:405: in function '_execute' .../site/pack/packer/start/plenary.nvim/lua/plenary/job.lua:448: in function 'start' ...site/pack/packer/start/plenary.nvim/lua/plenary/curl.lua:288: in function 'get' .../pack/packer/start/nvim-html-css/lua/html-css/remote.lua:24: in function 'get_remote_styles' .../pack/packer/start/nvim-html-css/lua/html-css/remote.lua:41: in function 'init' ...te/pack/packer/start/nvim-html-css/lua/html-css/init.lua:66: in function <...te/pack/packer/start/nvim-html-css/lua/html-c ss/init.lua:65> stack traceback: [C]: in function 'error' ...ck/packer/start/plenary.nvim/lua/plenary/async/async.lua:18: in function 'callback_or_next' ...ck/packer/start/plenary.nvim/lua/plenary/async/async.lua:45: in function 'step' ...ck/packer/start/plenary.nvim/lua/plenary/async/async.lua:48: in function 'execute' ...ck/packer/start/plenary.nvim/lua/plenary/async/async.lua:108: in function 'run' ...te/pack/packer/start/nvim-html-css/lua/html-css/init.lua:65: in function <...te/pack/packer/start/nvim-html-css/lua/html-c ss/init.lua:36> [C]: in function 'require' /Users/wouter/.config/nvim/after/plugin/cmp.lua:31: in main chunk this is my cmp.lua : local cmp_status, cmp = pcall(require, "cmp") ■ Unused local `cmp_status`. 29 cmp.setup({ 28 sources = cmp.config.sources { 27 { 26 name = "html-css", 25 option = { 24 max_count = {}, -- not ready yet 23 enable_on = { 22 "html", 21 "php" 20 }, -- set the file types you want the plugin to work on 19 file_extensions = { "css", "sass", "less" }, 18 style_sheets = { 17 -- example of remote styles, only css no js for now 16 "https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/css/bootstrap.min.css", 15 }, 14 }, 13 }, 12 11 }, 10 -- enable filename path for css config 9 formatting = { 8 format = function(entry, vim_item) 7 if entry.source.name == "html-css" then 6 vim_item.menu = entry.source.menu 5 end 4 return vim_item 3 end 2 } 1 }) 31 require("html-css"):setup(); and this is what I have in my packer.lua : use("Jezda1337/nvim-html-css")
Jezda1337 commented 8 months ago

I didn't test on Packer but, can you try this? and do you have installed dependencies? use { "Jezda1337/nvim-html-css" requires = {"nvim-treesitter/nvim-treesitter", "nvim-lua/plenary.nvim"}, config = function() require("html-css"):setup() end, }

wouterschiedam commented 8 months ago

Thanks for the quick response! The error seems to go away with this ^ . However when I try it in a html file it doesn't work. I have installed the dependencies aswel "nvim-lua/plenary.vim" and "nvim-treesitter/nvim-treesitter"

Jezda1337 commented 8 months ago

You need to install this as well: fd

wouterschiedam commented 8 months ago

I've read in another issue about this I installed it already with brew install fd.

Jezda1337 commented 8 months ago

Can you share CmpStatus log?

wouterschiedam commented 8 months ago

when I run :CmpStatus I get this:

ready source names

  • buffer
  • path
  • luasnip

unavailable source names

  • nvim_lsp:lua_ls

unused source names

  • calc
  • emoji
  • look
  • nvim_lua
  • ultisnips
  • spell
  • TabNine
Jezda1337 commented 8 months ago

Do you have .git/ folder or pacakge.json file inside ur root project? this two trigger plugin to be active in current work directory

wouterschiedam commented 8 months ago

yes I have a .git/ folder in the root of my documents this is also where I open nvim

Jezda1337 commented 8 months ago

Okay, later today I will test with packer and will try to reproduce your problem

wouterschiedam commented 8 months ago

Awesome thanks for the help! I'm new to vim so it is all quite new to me

Jezda1337 commented 8 months ago

Hey @wouterschiedam here is my packer example which works: https://gist.github.com/Jezda1337/d74c22070e523a59885ba4d3c71af2dd

wouterschiedam commented 8 months ago

Thanks for taking ur time to help me out! I think I got a step closer to getting it to work however now I have this error:

Error while calling lua chunk: .../site/pack/packer/start/plenary.nvim/lua/plenary/job.lua:499: 'fd -a -e html --exclude node_modules' was unable to complete in 5000 ms

in main chunk cmp.lua line 82: require("html-css"):setup();

Jezda1337 commented 8 months ago

How many html files you have in your root folder?

wouterschiedam commented 8 months ago

In the root 0, but I have a lot in sub folders

Jezda1337 commented 8 months ago

Ye, the moment when you open neovim in root folder, plugin start scanning for all html files in root or in sub folders, then start parsing each file, so I believe that you have too much html files, and the plugin can't parse them all at once. This is issue with the plugin, if you check in some other project where you have less html files its gonna work. I'm currently soo busy with the work, but I will give my best to find time and work on the plugin.

wouterschiedam commented 8 months ago

Hmmm that makes sense. No worries. I've created a new folder with a ./git folder and an index.html file but it still doesn't work :(

Jezda1337 commented 8 months ago

Strange, do you have your neovim config somewhere on the internet, so I can take a look and investigate more? what CmpStatus said now?

wouterschiedam commented 8 months ago

This is what my CmpStatus says:

ready source names

  • buffer
  • path
  • luasnip

unused source names

  • cmdline
  • nvim_lua
  • html-css

unknown source names

  • nvim_lsp
Jezda1337 commented 8 months ago

Can you make a package.json file inside the root folder and try again?

wouterschiedam commented 8 months ago

Still not working im, gonna publish my nvim setup maybe u can see what I'm doing wrong

Jezda1337 commented 8 months ago

That would be the best

Jezda1337 commented 8 months ago

@wouterschiedam The problem is in lsp-zero v1, not sure what is the problem, to solve that I need to dig in the source code of lsp-zero, but the easiest solution is to migrate to version 3. I manage to run the plugin with this change: branch = 'v3.x',

wouterschiedam commented 8 months ago

Yess it works now in html files but the option for other files isn't. thanks for helping out! still a bit curious how did u debug this problem?

Jezda1337 commented 8 months ago

Reading the code and trying couple of times, I was 100% that the plugin is loaded but the it being ignored for some reason, then I load developer version and put some logs but nothing happened, then I notice lsp-zero v1 and I know there was huge upgrade v3. V1 for some reason was blocking external plugins like nvim-html-css so I just end up upgrading the plugin and works, I try as well to add my plugin as dependencies to lsp-zero that din't work in v1, didn't try for v3.