Closed Elijah017 closed 3 months ago
Did you do this step?
If you do, pls share, and are there any errors? What does CmpStatus
return?
Does your root project contain a .git folder or package.json file?
I am not to sure about how you intend for the configuration to be applied. I didn't have it originally, however I have just tried implementing it (although I don't think correctly). Even after this implementation of configuration I received the same error. My lua file after adding the configuration looks like
local support = {
"Jezda1337/nvim-html-css",
lazy = true,
event = { 'BufNewFile', 'BufReadPost', },
dependencies = {
"nvim-treesitter/nvim-treesitter",
"nvim-lua/plenary.nvim",
'hrsh7th/nvim-cmp',
'neovim/nvim-lspconfig',
},
config = function()
local Source = require('html-css')
Source.enable_on = { 'html' }
Source.file_extensions = { 'css', 'sass', 'less' }
Source.style_sheets = {}
Source:setup()
end,
}
return support
Any comments or clarity on how the options are actually meant to be implemented would be appreciated
both before and after implementing configuration I received this as the result of CmpStatus:
# unknown source names
- nvim_lsp
- html-css
There is a .git file in the root directory of my nvim conf, however there is no package.json
It depends on your package manager. In the docs I have explained how to install using the lazy. nvim. Here is the simplest installation guide for lazy.nvim: Installing html-css-nvim is the same as installing other plugins. You need to create a table with the name of the plugin, add dependencies, and initialize the plugin. Here is the simple code:
{ "Jezda1337/nvim-html-css",
dependencies = { -- deps that are needed for plugin to work properly
"nvim-treesitter/nvim-treesitter",
"nvim-lua/plenary.nvim"
},
config = function()
require("html-css"):setup() -- here you init the plugin
end
}
To configure the plugin, you need to add this code to the cmp sources table:
{
name = "html-css",
option = {},
},
In option table, you will put config from here, ofc you will need to adapt config to your needs. Here is an example of my cmp source config, basically you just need to copy-paste the already configured configuration from docs and modify it for your needs.
In case your tree-sitter is lazy-loaded, you must also lazy load the html-css plugin in the same way as the tree-sitter; e.g., if you have a lazy-loaded tree-sitter like this: event = { 'BufNewFile', 'BufReadPost', },
then you need to use the same event table on the html-css plugin.
The plugin is only triggered in the workspace that contains the .git folder or package.json file.
I have configured the plugin in the way specified and it seems to be working well most of the time. There seems to only be one situation were I find that error still occuring and that is if I open a file from the root directory of my nvim config, either using nvim <filename>
or nvim .
. If I open neovim somewhere deeper than the root neovim directory or if I open neovim in a different project entirely, then the plugin loads and works fine. I'm not sure if this is a bug or if there is still something wrong with my config, however besides that it is working like a charm and I appreciate all the help.
Can you share the error message?
here is the error message I receive
lazy.nvim
Failed to run `config` for nvim-html-css
.../.local/share/nvim/lazy/plenary.nvim/lua/plenary/job.
.lua:107: fd: Executable not found
stack traceback:
.../.local/share/nvim/lazy/plenary.nvim/lua/plenary/job
b.lua:107: in function 'new'
...cal/share/nvim/lazy/nvim-html-css/lua/html-css/hrefs
s.lua:16: in function 'get_hrefs'
...ocal/share/nvim/lazy/nvim-html-css/lua/html-css/init
t.lua:59: in function <...ocal/share/nvim/lazy/nvim-html
l-css/lua/html-css/init.lua:36>
[C]: in function 'require'
/home/elijah/.config/nvim/lua/plugins/nvim-html-css.lua
a:12: in function 'config'
...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader
r.lua:366: in function <...local/share/nvim/lazy/lazy.nv
vim/lua/lazy/core/loader.lua:364>
[C]: in function 'xpcall'
.../.local/share/nvim/lazy/lazy.nvim/lua/lazy/core/util
l.lua:113: in function 'try'
...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader
r.lua:381: in function 'config'
...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader
r.lua:348: in function '_load'
...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader
r.lua:191: in function 'load'
...hare/nvim/lazy/lazy.nvim/lua/lazy/core/handler/event
t.lua:83: in function <...hare/nvim/lazy/lazy.nvim/lua/l
lazy/core/handler/event.lua:72>
# stacktrace:
- /plenary.nvim/lua/plenary/job.lua:107 _in_ **new**
- lua/plugins/nvim-html-css.lua:12 _in_ **config**
@Elijah017 If you start reading the error message, you will see that the fd
command is missing. Go to docs and find a section Required dependencies and install them.
Thank you for the help, I had fd installed but was apparently running into this issue with it's executable wherein it is called fdfind
on Ubuntu and its derivative systems. I resolved it by just creating a sym-link named fd in my path.
Brief
I am having an issue wherein html-css is unable to run. I am trying to incorporate nvim-html-css into my Neovim config that is already running nvim-lspconfig and nvim-cmp without any issue. Strangely this seems to only occur if the neovim opens in ~/.config/nvim or earlier.
nvrim-html-css config
nvim-cmp config