Jezda1337 / nvim-html-css

CSS Intellisense for HTML
115 stars 13 forks source link

Plugin Not Working Despite Following Instructions #16

Open HexNebula opened 5 months ago

HexNebula commented 5 months ago

Plugin Not Displaying Errors or Completions Despite Following Instructions :

followed the instructions in the repository, but unfortunately, I didn't get any results. Here's my config file:

return {
  "Jezda1337/nvim-html-css",
  dependencies = { "nvim-treesitter/nvim-treesitter", "nvim-lua/plenary.nvim" },
  event = { "LazyFile", "VeryLazy" },
  config = function()
    require("html-css"):setup()
  end,
}
Jezda1337 commented 5 months ago

Not enough information to reproduce the problem you are having. Share your configuration.

Jerakin commented 3 weeks ago

Can't get it to work either. Can you see anything wrong with my config?

:CmpStatus lists it under "unavailable source names"

Declaration

  {
    'Jezda1337/nvim-html-css',
    dependencies = {
      'nvim-treesitter/nvim-treesitter',
      'nvim-lua/plenary.nvim',
    },
    config = function()
      require('html-css'):setup()
    end,
    -- event = { 'BufReadPre', 'BufNewFile', 'VeryLazy' }, Tried with these ones too
  },

Configuration

          {
            name = 'html-css',
            option = {
              enable_on = { 'html' },
              file_extensions = { 'css' },
              style_sheets = {
                'https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css',
              },
            },
          },

:checkhealth reports nothing weird.

Jezda1337 commented 3 weeks ago

@Jerakin There are a couple of things that you need to check, do you have a .git folder or package.json file inside ur CWD, this is needed to trigger the plugin. In case you have one of those above, you need to set the same events as you have on tree-sitter, so for example, if you have event = { "BufReadPost", "BufNewFile" } then you need to use the same on the html-css plugin. In case this doesn't work I would appreciate it if you could share your whole config so I can have a better look at details.

Jerakin commented 3 weeks ago

I have a .git folder but no package.json.

I am fairly new to nvim and used nvim-lua/kickstart.nvim to get a base config so it's quite big. However I have not changed a lot from the base config. Only added some filetypes and edited the lua_fs. Is there a particular section of the config you are interested in? (however, it might be easier to check the linked repo).

Jezda1337 commented 3 weeks ago

Oh I see, thanks for sharing, I will take a look into kickstarter config and will comeback, did you change anything with the tree-sitter config or cmp config?

Jerakin commented 3 weeks ago

No, they are all defaults :)

Jezda1337 commented 3 weeks ago

@Jerakin So here is the steps that I have done and it works, I put html-css plugin into lua/custom/init.lua file:

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

then in the cmp sources I have this:

sources = {
  { name = 'nvim_lsp' },
  { name = 'luasnip' },
  { name = 'path' },
  {
    name = 'html-css',
    option = {
      enable_on = {
        'html',
      }, -- set the file types you want the plugin to work on
      file_extensions = { 'css', 'sass', 'less' }, -- set the local filetypes from which you want to derive classes
      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',
      },
    },
  },
},

I have created index.html file inside root folder of kickstarter and everything works, you don't need package.json if you have .git/ folder, so the kickstarter have .git/ folder by default.

Screenshot 2024-06-06 at 13 36 05
Jerakin commented 3 weeks ago

Awesome thank you for even taking the time to download it and everything! I can confirm that it works for me when done that way too!