Jezda1337 / nvim-html-css

CSS Intellisense for HTML
121 stars 14 forks source link

Failed to run `config` for nvim-html-css #3

Closed sirstanislav closed 1 year ago

sirstanislav commented 1 year ago

Hey man. Can you help to understand what wrong i do?

What i do, it's i'm overriding nvim_cmp image

Add nvim_htm_css dependencies to nvim_cmp image

Then i have this error whith plenary image

.git already initialised. Thanks for any advices

Jezda1337 commented 1 year ago

Hey @sirstanislav, if you look closely to err message you will read "fd: executable not found", and fd command is one that I choose to use for searching the files on the system, here you have to install this: fd. In case you using debian or ubuntu read this.

sirstanislav commented 1 year ago

After installed fd it seems like nothing happening. lsp log are clean, lazy load working as soon as I touching html to edit. Sorry, i'm not enougth understand how all is working. Is there any way wo see what happens inside expect lsp log?

image

Jezda1337 commented 1 year ago

@sirstanislav hey man, yep I just test it and seams opts in cmp doesn't work, you can make plugin to work this way: have separate file for plugin for example: lua/plugins/html-css.lua (or any where you put plugin configs) and put this code inside:

return {
    "Jezda1337/nvim-html-css",
    dependencies = { "nvim-treesitter/nvim-treesitter", "nvim-lua/plenary.nvim" },
    event = { "BufReadPost", "BufNewFile" },
    config = function()
        require("html-css"):setup()
    end,
}

then inside cmp config use this:

require("cmp").setup {
... cmp config,
formatting = {
format = funcion(entry, vim_item)
                        local source = entry.source.name
                    local kind = vim_item.kind

                    if source == "html-css" then
                        source_mapping["html-css"] = entry.completion_item.menu
                    end
                    return vim_item
end
},
sourecs = cmp.config.sources {
                {
                    name = "html-css",
                    option = {
                        max_count = {}, -- not ready yet
                        enable_on = {
                            "html",
                        }, -- set the file types you want the plugin to work on
                        file_extensions = { "css", "sass", "less" },
                        style_sheets = {
                            -- example of remote styles, only css no js for now
                            "https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css",
                            "https://cdn.jsdelivr.net/npm/bulma@0.9.4/css/bulma.min.css",
                        },
                    },
                    },

}
}

pls try this setup and if you find time for feedback would be great, if you encounter on some errors pls comment it or post pic 🫡

sirstanislav commented 1 year ago

It's need install plugin and add new source to existing cmp config of NvChad

Only its's work in not framework project, like in normal single .html page. But not work in .html in Angular. Any idea why?

Jezda1337 commented 1 year ago

Hmm, not sure, I tested on angular as well, and for me working normally. You have to have .git folder in root folder where you open the neovim instance. But if you have angular src code with .git folder in nested folder then won't work. I will work on that soon. But for now only the root folder with .git folder will work. Bdw do you have any errors, and what cmpstatus says?

sirstanislav commented 1 year ago

You are right. It's works only

You have to have .git folder in root folder where you open the neovim instance. But if you have angular src code with .git folder in nested folder then won't work

cmp status on second screen. Both for angular project with .git in root folder(where is works) and where is are nested folders with many modules in each with .git (not works).

Will wait your solution for nested folders. Thank you very much man. Screenshot 2023-08-22 at 00 54 59 Screenshot 2023-08-22 at 00 57 35