Skip to content

Commit

Permalink
✨ add some css lsp
Browse files Browse the repository at this point in the history
  • Loading branch information
hemedani committed Dec 14, 2022
1 parent 95446ed commit 76667ec
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 15 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ you can read a little bit more about the above utils in [this article](https://m

- For installing `tsserver` LSP just run: `npm install -g typescript typescript-language-server`. You can read the rest of its doc [here](https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#tsserver)

- For installing `cssls` LSP just run: `npm i -g vscode-langservers-extracted`. You can read the rest of its doc [here](https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#cssls)

- For installing `emmet-ls` LSP just run: `npm install -g emmet-ls`. You can read the rest of its doc [here](https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#emmet_ls)

- For installing `sumneko_lua` LSP read [this doc](https://github.com/sumneko/lua-language-server/wiki/Build-and-Run) and [this doc](https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#sumneko_lua)
Expand Down
52 changes: 37 additions & 15 deletions lua/lsp/config/css.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,48 @@ local configs = require("lspconfig/configs")

-- Setup lspconfig.

lspconfig.cssls.setup({
capabilities = setup.capabilities,
filetypes = { "css", "scss", "less", "jsx", "tsx", "javascriptreact", "typescriptreact" },
--Enable (broadcasting) snippet capability for completion
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities.textDocument.completion.completionItem.snippetSupport = true

require("lspconfig").cssls.setup({
capabilities = capabilities,
filetypes = {
"css",
"scss",
"less",
"jsx",
"js",
"ts",
"tsx",
"javascriptreact",
"typescriptreact",
"javascript",
"typescript",
},
on_attach = require("lsp.lsp-attach").on_attach,
})

-- lspconfig.cssls.setup({
-- capabilities = setup.capabilities,
-- filetypes = { "css", "scss", "less", "jsx", "tsx", "javascriptreact", "typescriptreact" },
-- })

lspconfig.html.setup({
capabilities = setup.capabilities,
on_attach = require("lsp.lsp-attach").on_attach,
capabilities = setup.capabilities,
on_attach = require("lsp.lsp-attach").on_attach,
})

if not lspconfig.emmet_ls then
configs.emmet_ls = {
default_config = {
cmd = { "emmet-ls", "--stdio" },
filetypes = { "html", "css", "blade", "jsx", "tsx", "javascriptreact", "typescriptreact" },
root_dir = function(fname)
return vim.loop.cwd()
end,
settings = {},
},
}
configs.emmet_ls = {
default_config = {
cmd = { "emmet-ls", "--stdio" },
filetypes = { "html", "css", "blade", "jsx", "tsx", "javascriptreact", "typescriptreact" },
root_dir = function(fname)
return vim.loop.cwd()
end,
settings = {},
},
}
end
lspconfig.emmet_ls.setup({ capabilities = setup.capabilities })

0 comments on commit 76667ec

Please sign in to comment.