Closed Fausto-Korpsvart closed 1 year ago
Yeah, this is because treesitter is lazy loaded
You can solve this problem in two ways, 1st is to use same lazy options for treesitter and html-css plugins, or 2nd, add dependencies = {"nvim-treesitter/nvim-treesitter"}
for html-css plugin. Pls write here if this work for you.
You can solve this problem in two ways, 1st is to use same lazy options for treesitter and html-css plugins, or 2nd, add
dependencies = {"nvim-treesitter/nvim-treesitter"}
for html-css plugin. Pls write here if this work for you.
I have html-css
as a dependency on CMP
, as in the README.
On the other hand, Treesitter
I don't have it in lazy = true
, I'm using an event: event = { 'BufReadPost', 'BufNewFile' }
.
Another thing I have noticed, is that when the html-css
plugin is enabled and I open any file or just open Neovim, there is a significant delay in loading Neovim or any file I open, I have tried disabling the plugin and Neovim acts normally and everything opens instantly.
Now, after the last update, there is a problem with CMP
when I go into insert mode
and it pops up an error on an autocommand.
@Fausto-Korpsvart Hey,
event = { 'BufReadPost', 'BufNewFile' }
is another way of setting some plugin to be lazy. Here is the config that you need.
{
"Jezda1337/nvim-html-css",
event = { "BufReadPost", "BufNewFile" }, -- this needs to be same as nvim-treesitter event
-- dependencies = { "nvim-treesitter/nvim-treesitter" }, -- or you can go with this one if you don't want same event on both plugins.
init = function()
require("html-css"):setup()
end, -- you have to use init in this case, if you create separate file for the plugin you can use config as well.
},
You can past this to cmp deps and its gonna work. The error from image is related to options. There was break changes in options, check README to see new way of how to setup the plugin.
@Fausto-Korpsvart Hey,
event = { 'BufReadPost', 'BufNewFile' }
is another way of setting some plugin to be lazy. Here is the config that you need.{ "Jezda1337/nvim-html-css", event = { "BufReadPost", "BufNewFile" }, -- this needs to be same as nvim-treesitter event -- dependencies = { "nvim-treesitter/nvim-treesitter" }, -- or you can go with this one if you don't want same event on both plugins. init = function() require("html-css"):setup() end, -- you have to use init in this case, if you create separate file for the plugin you can use config as well. },
You can past this to cmp deps and its gonna work. The error from image is related to options. There was break changes in options, check README to see new way of how to setup the plugin.
That's actually what I have, as I said before, I've already read the README of the new update, I've already changed the configuration and the error persists.
This is my CMP configuration
{
'hrsh7th/nvim-cmp',
event = { 'InsertEnter', 'CmdlineEnter' },
dependencies = {
{ 'hrsh7th/cmp-buffer' },
{ 'hrsh7th/cmp-cmdline' },
{ 'hrsh7th/cmp-nvim-lsp' },
{ 'hrsh7th/cmp-nvim-lua' },
{ 'onsails/lspkind.nvim' },
{ 'saadparwaiz1/cmp_luasnip' },
{ 'FelipeLema/cmp-async-path' },
{ 'lukas-reineke/cmp-rg' },
{
'Jezda1337/nvim-html-css',
-- dependencies = { 'nvim-treesitter/nvim-treesitter' },
event = { "BufReadPost", "BufNewFile" },
init = function()
require('html-css'):setup()
end,
},
},
config = function()
require 'plugins.lsp.cmp'
end,
},
And this is my Treesitter configuration
{
'nvim-treesitter/nvim-treesitter',
build = ':TSUpdate',
cmd = { 'TSInstall', 'TSBufEnable', 'TSBufDisable', 'TSModuleInfo', 'TSToggle' },
event = { 'BufReadPost', 'BufNewFile' },
dependencies = {
{ 'windwp/nvim-ts-autotag' },
{ 'HiPhish/nvim-ts-rainbow2' },
{ 'nvim-treesitter/playground' },
{ 'nvim-treesitter/nvim-treesitter-context' },
{ 'JoosepAlviste/nvim-ts-context-commentstring' },
{ 'nvim-treesitter/nvim-treesitter-textobjects' },
},
config = function()
require 'plugins.ts.treesitter'
end,
},
And removing Treesitter
as a dependency of html-css
brings back the problem with Treesitter
, while the CMP
error when entering insert-mode
still appears; not to mention the delay it causes in Neovim when running Neovim or opening any file.
For the moment I leave it, I will keep it disabled until the Plugin is stable, the truth is quite useful, before the last updates it has been very useful, but at the moment I have a lot of work and I can not be changing my settings in Neovim, when I have a little time I will test and change a little the settings to see where the problem is, although my settings have always worked normally. I hope you can find the solution because the plugin is great, in the few days I've tried it, it has been very useful.
Thanks for your feedback, I would like to know how did you setup the option part, if you can share code or img that would be nice, and I would like to know in which file did you try to run plugin and you get this error from picture.
Regarding to slow performance, I have to ask you did you install fd-find tool? Does your project that you get low performance contain lots css, scss, sass or less files?
In fact, the configuration is the same as it is in the README, I just added some Tailwind
and SASS
CDNs, but to see if that was the problem, I removed them and the error continued, and before the last updates it worked fine even with the CDNs I had added.
The project I have been using it on is a basic web page project with SASS, not a large project.
The error appeared after applying the latest updates, I was editing in the stylesheets of a GTK theme, I thought maybe it was just in CSS, but when I went into my Neovim configuration to check for any errors and switched to insert mode
the error always kept appearing, and it was until I deactivated html-css
that the error disappeared.
Here are the options:
{
name = 'html-css',
option = {
enable_on = {
'html',
},
file_extensions = { 'css', 'sass', 'less' },
style_sheets = {
'https://cdn.jsdelivr.net/npm/bulma@0.9.4/css/bulma.min.css',
'https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css',
-- 'https://unpkg.com/tailwindcss-jit-cdn',
-- 'https://cdnjs.cloudflare.com/ajax/libs/sass.js/0.9.2/sass.min.js',
},
},
},
Thanks for your feedback, I would like to know how did you setup the option part, if you can share code or img that would be nice, and I would like to know in which file did you try to run plugin and you get this error from picture.
Regarding to slow performance, I have to ask you did you install fd-find tool? Does your project that you get low performance contain lots css, scss, sass or less files?
Oh man, I am really sorry, I saw my mistake, I'm so busy I didn't notice I typed enabled_on
instead of enable_on
, what a shame, at this point I'm the real explanation why things fail, because of user error xD.
Well, that fixes the error in insert mode, everything else remains the same, the delay in loading Neovim is a small problem that I guess is caused by the verification of the sources on the internet from the CDNs.
Hey @Fausto-Korpsvart, I'm glad that you find the solution. Yeah, I'm not sure why your neovim get slow at the start , everything in the plugin, like reading the files, getting the external styles are async, and because of that should not slow down your config. But I will investigate a little bit, anyway plugin is still in dev mode, I'm still working on it, adding new stuff, and clean old stuff, in case you experience other problems please open the new issue, I will close this one after I make some change and test performance. Thanks for your feedback I really appreciate <3
Hey @Fausto-Korpsvart, I'm glad that you find the solution. Yeah, I'm not sure why your neovim get slow at the start , everything in the plugin, like reading the files, getting the external styles are async, and because of that should not slow down your config. But I will investigate a little bit, anyway plugin is still in dev mode, I'm still working on it, adding new stuff, and clean old stuff, in case you experience other problems please open the new issue, I will close this one after I make some change and test performance. Thanks for your feedback I really appreciate <3
Thanks to you for making this plugin, it is now one of the necessary plugins in my workflow.
And I hope everything goes well in this project and I hope to see all the features you want to add, It's already a great plugin, with more features it will be even better, have fun with that.
@Jezda1337 i lazyload all of my cmp plugins at insertEnter , cant i do the same with this plugin?
i always get this :
Something is wrong with this update, it breaks the CSS parser in
Treesitter
.I've disabled the plugin and everything works fine, but when I activate it a constant error about CSS parser problems pops up.
Here is a screenshot.