Jezda1337 / nvim-html-css

CSS Intellisense for HTML
121 stars 14 forks source link

Issue with React Bootstrap #23

Closed Gogiu23 closed 6 months ago

Gogiu23 commented 6 months ago

The plugin works fine. I didn't tested yet deeply with plain html and css works, but seems to me all good. My issue is when using react-bootstrap where doesn't reconize the file and the className="" property. Is there any way to fix that? Thank you

Jezda1337 commented 6 months ago

I forgot to add the className by default, but I have now implemented and tested it. If you are using jsx, you should put javascript in "enable_on". If you are using tsx, you should type typescriptreact. You can check the current buffer's typefile by running this code: :lua print(vim.bo.filetype)

Gogiu23 commented 6 months ago

i have this error now: Error executing luv callback: ...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:18: The coroutine failed with this message: ...im/0.9.5/share/nvim/runtime/lua/vim/treesitter/query.lua:99: /Users/alessandrodominici/.config/nvim/querie s/css/injections.scm: No such file or directory stack traceback: [C]: in function 'error' ...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:18: in function 'callback_or_next' ...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:45: in function <...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:44> [C]: in function 'nvim_exec2' vim/_editor.lua: in function 'cmd' ...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:485: in function <...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:484> [C]: in function 'xpcall' .../.local/share/nvim/lazy/lazy.nvim/lua/lazy/core/util.lua:113: in function 'try' ...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:484: in function 'source' ...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:443: in function 'source_runtime' ...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:411: in function 'packadd' ...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:135: in function 'startup' ...inici/.local/share/nvim/lazy/lazy.nvim/lua/lazy/init.lua:112: in function 'setup' /Users/alessandrodominici/.config/nvim/lua/config/init.lua:18: in main chunk [C]: in function 'require' /Users/alessandrodominici/.config/nvim/init.lua:1: in main chunk i cannot find why works before in a regular html file and now not. My config is:

sources = cmp.config.sources({
                    { name = "nvim_lsp" },
                    { name = "buffer" },
                    { name = "path" },
                    -- { name = "emmet" },
                    {
                        name = "html-css",
                        option = {
                            max_count = {},
                            enable_on = {
                                "html",
                                "css",
                                "javascript",
                            },
                            file_extensions = { "css", "sass", "less" },
                            style_sheets = {
                                "https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css",
                            },
                        },
                    },
                    -- { name = "nvim_lua" },
                }),
{
    "Jezda1337/nvim-html-css",
    dependencies = {
        "nvim-lua/plenary.nvim",
        "nvim-treesitter/nvim-treesitter",
    },
    config = function()
        require("html-css"):setup()
    end,
},
Jezda1337 commented 6 months ago

You need to install CSS parser, you can do that by calling this in cmd, :TSInstall css

Gogiu23 commented 6 months ago

I did have installed the parser for css. Could be anything else?

Jezda1337 commented 6 months ago

I have removed my CSS parser and I get the same error as you. Try removing it completely and installing it again, if that doesn't help remove it manually from the path that you get in the error message. You can install the Sass parser as well because you have it in the options

Gogiu23 commented 6 months ago

I tried to remove from the path. i reinstalled the plugin tree-sitter and reinstalled the parser. There is not sass parser but i tried to remove it from the file-extensions but not working. Could you share your config just to see if i did something wrong or different? Mine is https://github.com/Gogiu23/Lua-Nvim/tree/master/lua Thanks in advance

Jezda1337 commented 6 months ago

Here

When I removed the CSS parser, I received the same error as you. When I reinstalled it, the error disappeared.

Check mine config, but the issue is and should be in CSS parser

Jezda1337 commented 6 months ago

Add this to my plugin event = { "BufReadPre", "BufNewFile" } Events that are used for tree-sitter should be the same for the htm-css plugin, you have this in config.

Gogiu23 commented 6 months ago

Great, it works to add the same event. Thanks. I thought was only if i didn't use the dependencies it will be mandatory add the same lazy event as treesitter. I have another issue, maybe better open another issue and close this one?

Jezda1337 commented 6 months ago

Yes pls, open new issue