Closed tonmoy998 closed 8 months ago
Option needs to be inside cmp, like this. Or like this:
sources = 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" }, -- 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",
},
},
},
}),
will it work? { "hrsh7th/nvim-cmp", opts = { sources = { -- trigger_characters is for unocss lsp { name = "nvim_lsp" }, { name = "path" }, { name = "luasnip" }, { name = "buffer" }, { 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", }, }, }, { name = "nvim_lua" }, }, }, },
{ "Jezda1337/nvim-html-css", config = function() require("html-css"):setup() end, },
Still does't work for me without errors.
Do you have package.json file or .git folder inside root folder?
No It's a simple html css file
To trigger plugin you need to have package.json file inside root dir or ./git folder.
Thank you man ,,You cleared my doubts
Really appreciate your work man.
I need help with loading this plugin using the same(NvChad) setup. please let me know if i should create a new issue.
Auto-completion in HTML files gets totally disabled upon adding the plugin. I've tried disabling the HTML, cssls & emmet_language_server LSPs individually and all together, to no help.
i do have .git folder in the root directory.
using: NvChad 2.0 NVIM v0.9.4
plugins.lua:
local overrides = require "custom.configs.overrides"
---@type NvPluginSpec[]
local plugins = {
-- Override plugin definition options
{
"neovim/nvim-lspconfig",
dependencies = {
-- format & linting
{
"jose-elias-alvarez/null-ls.nvim",
config = function()
require "custom.configs.null-ls"
end,
},
},
config = function()
require "plugins.configs.lspconfig"
require "custom.configs.lspconfig"
end, -- Override to setup mason-lspconfig
},
-- override plugin configs
{
"williamboman/mason.nvim",
opts = overrides.mason,
},
{
"nvim-treesitter/nvim-treesitter",
opts = overrides.treesitter,
},
{
"nvim-tree/nvim-tree.lua",
opts = overrides.nvimtree,
},
-- Install a plugin
{
"max397574/better-escape.nvim",
event = "InsertEnter",
config = function()
require("better_escape").setup()
end,
},
{
"NvChad/nvcommunity",
{ import = "nvcommunity.diagnostics.trouble" },
{ import = "nvcommunity.motion.neoscroll" },
{
"neoscroll.nvim",
opts = overrides.neoscroll,
},
},
{
"hrsh7th/nvim-cmp",
opts = {
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" }, -- 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.2/dist/css/bootstrap.min.css",
},
},
},
},
},
},
{
"Jezda1337/nvim-html-css",
config = function()
require("html-css"):setup()
end,
},
--To make a plugin not be loaded
--
-- "NvChad/nvim-colorizer.lua",
-- enabled = false
-- },
-- All NvChad plugins are lazy-loaded by default
-- For a plugin to be loaded, you will need to set either `ft`, `cmd`, `keys`, `event`, or set `lazy = false`
-- If you want a plugin to load on startup, add `lazy = false` to a plugin spec, for example
-- {
-- "mg979/vim-visual-multi",
-- lazy = false,
-- }
}
return plugins
lspconfig.lua:
local on_attach = require("plugins.configs.lspconfig").on_attach
local capabilities = require("plugins.configs.lspconfig").capabilities
local lspconfig = require "lspconfig"
local util = require "lspconfig/util"
-- if you just want default config for the servers then put them in a table
local servers = { "html", "cssls", "tsserver", "clangd", "rust_analyzer", "emmet_language_server" }
for _, lsp in ipairs(servers) do
if lsp == "rust_analyzer" then
lspconfig[lsp].setup {
on_attach = on_attach,
capabilities = capabilities,
filetypes = { "rust" },
root_dir = util.root_pattern "Cargo.toml",
settings = {
["rust-analyzer"] = {
cargo = {
allFeatures = true,
},
},
},
}
elseif lsp == "emmet_language_server" then
lspconfig[lsp].setup {
on_attach = on_attach,
capabilities = capabilities,
filetypes = {
"css",
"eruby",
"html",
"javascript",
"javascriptreact",
"less",
"sass",
"scss",
"pug",
"typescriptreact",
"rust",
},
-- Read more about this options in the [vscode docs](https://code.visualstudio.com/docs/editor/emmet#_emmet-configuration).
-- **Note:** only the options listed in the table are supported.
init_options = {
--- @type string[]
includeLanguages = {},
--- @type string[]
excludeLanguages = {},
--- @type string[]
extensionsPath = {},
--- @type table<string, any> [Emmet Docs](https://docs.emmet.io/customization/preferences/)
preferences = {},
--- @type boolean Defaults to `true`
showAbbreviationSuggestions = true,
--- @type "always" | "never" Defaults to `"always"`
showExpandedAbbreviation = "always",
--- @type boolean Defaults to `false`
showSuggestionsAsSnippets = false,
--- @type table<string, any> [Emmet Docs](https://docs.emmet.io/customization/syntax-profiles/)
syntaxProfiles = {},
--- @type table<string, string> [Emmet Docs](https://docs.emmet.io/customization/snippets/#variables)
variables = {},
},
}
else
lspconfig[lsp].setup {
on_attach = on_attach,
capabilities = capabilities,
}
end
end
@knnmran, Can you open the new issue? and provide the same code that you have here
@Jezda1337 thank you for your response.
this issue is now tracked under Plugin not Loading on NvChad