mirror of
https://github.com/ivuorinen/dotfiles.git
synced 2026-01-26 11:14:08 +00:00
chore(nvim): consolidated lsp configs
This commit is contained in:
@@ -120,26 +120,80 @@ mason_lspconfig.setup_handlers({
|
||||
end,
|
||||
})
|
||||
|
||||
-- Bash Language Server
|
||||
require("lsp.bash")
|
||||
|
||||
-- eslint_d + prettierd
|
||||
-- require 'lsp.eslint_d_prettierd'
|
||||
-- Configure language servers for specific languages
|
||||
local lspconfig = require("lspconfig")
|
||||
|
||||
-- Bash Language Server
|
||||
lspconfig.bashls.setup({
|
||||
cmd = {
|
||||
"bash-language-server",
|
||||
"start",
|
||||
},
|
||||
filetypes = { "sh", "zsh" },
|
||||
capabilities = CAPABILITIES,
|
||||
})
|
||||
|
||||
-- HTML
|
||||
require("lsp.html")
|
||||
lspconfig.html.setup({ capabilities = CAPABILITIES })
|
||||
|
||||
-- JSON
|
||||
require("lsp.json")
|
||||
lspconfig.jsonls.setup({
|
||||
settings = {
|
||||
json = {
|
||||
schemas = require("schemastore").json.schemas(),
|
||||
validate = { enable = true },
|
||||
},
|
||||
},
|
||||
capabilities = CAPABILITIES,
|
||||
})
|
||||
|
||||
-- Python
|
||||
require("lsp.python")
|
||||
lspconfig.pylsp.setup({})
|
||||
|
||||
-- CSS + Less + SCSS
|
||||
require("lsp.scss")
|
||||
lspconfig.cssls.setup({
|
||||
cmd = { "vscode-css-language-server", "--stdio" },
|
||||
filetypes = { "css", "scss", "less" },
|
||||
-- root_dir = root_pattern("package.json", ".git") or bufdir,
|
||||
settings = {
|
||||
css = {
|
||||
validate = true,
|
||||
},
|
||||
less = {
|
||||
validate = true,
|
||||
},
|
||||
scss = {
|
||||
validate = true,
|
||||
},
|
||||
},
|
||||
single_file_support = true,
|
||||
capabilities = CAPABILITIES,
|
||||
on_attach = function(client, bufnr)
|
||||
if client.server_capabilities.documentSymbolProvider then require("nvim-navic").attach(client, bufnr) end
|
||||
end,
|
||||
})
|
||||
|
||||
|
||||
-- rome
|
||||
require("lsp.rome")
|
||||
local util = require("lspconfig.util")
|
||||
lspconfig.rome.setup({
|
||||
root_dir = util.root_pattern("rome.json"),
|
||||
single_file_support = true,
|
||||
on_attach = function(client, bufnr)
|
||||
if client.server_capabilities.documentSymbolProvider then require("nvim-navic").attach(client, bufnr) end
|
||||
end,
|
||||
capabilities = CAPABILITIES,
|
||||
})
|
||||
|
||||
|
||||
-- Typescript + Javascript
|
||||
require("lsp.typescript")
|
||||
lspconfig.tsserver.setup({
|
||||
capabilities = CAPABILITIES,
|
||||
on_attach = function(client, bufnr)
|
||||
if client.server_capabilities.documentSymbolProvider then require("nvim-navic").attach(client, bufnr) end
|
||||
end,
|
||||
})
|
||||
|
||||
lspconfig.lua_ls.setup({})
|
||||
lspconfig.yamlls.setup({})
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
require("lspconfig").bashls.setup({
|
||||
cmd = {
|
||||
"bash-language-server",
|
||||
"start",
|
||||
},
|
||||
filetypes = { "sh", "zsh" },
|
||||
capabilities = CAPABILITIES,
|
||||
})
|
||||
@@ -1,25 +0,0 @@
|
||||
local eslint = require("eslint")
|
||||
local null_ls = require("null-ls")
|
||||
-- local sources = { null_ls.builtins.formatting.prettierd }
|
||||
|
||||
null_ls.setup()
|
||||
|
||||
eslint.setup({
|
||||
bin = "eslint_d",
|
||||
code_actions = {
|
||||
enable = true,
|
||||
apply_on_save = {
|
||||
enable = true,
|
||||
types = { "directive", "problem", "suggestion", "layout" },
|
||||
},
|
||||
disable_rule_comment = {
|
||||
enable = true,
|
||||
location = "separate_line", -- or `same_line`
|
||||
},
|
||||
},
|
||||
diagnostics = {
|
||||
enable = true,
|
||||
report_unused_disable_directives = false,
|
||||
run_on = "type", -- or `save`
|
||||
},
|
||||
})
|
||||
@@ -1 +0,0 @@
|
||||
require("lspconfig").html.setup({ capabilities = CAPABILITIES })
|
||||
@@ -1,9 +0,0 @@
|
||||
require("lspconfig").jsonls.setup({
|
||||
settings = {
|
||||
json = {
|
||||
schemas = require("schemastore").json.schemas(),
|
||||
validate = { enable = true },
|
||||
},
|
||||
},
|
||||
capabilities = CAPABILITIES,
|
||||
})
|
||||
@@ -1 +0,0 @@
|
||||
require("lspconfig").pylsp.setup({})
|
||||
@@ -1,31 +0,0 @@
|
||||
local util = require("lspconfig.util")
|
||||
-- local config = require 'lspconfig.configs'
|
||||
|
||||
-- This duplicate exec is just a workaruond, if don't execute at first,
|
||||
-- the nvim will stuck when you first init rome socket
|
||||
-- local rome_cmd = { 'rome', 'lsp-proxy' }
|
||||
|
||||
-- local merged_table = vim.tbl_extend("keep", {
|
||||
-- textDocument = {
|
||||
-- formatting = {
|
||||
-- dynamicRegistration = true
|
||||
-- }
|
||||
-- }
|
||||
-- }, capabilities);
|
||||
--
|
||||
require("lspconfig").rome.setup({
|
||||
-- cmd = rome_cmd,
|
||||
-- filetypes = {
|
||||
-- 'javascript',
|
||||
-- 'javascriptreact',
|
||||
-- 'typescript',
|
||||
-- 'typescriptreact',
|
||||
-- 'json'
|
||||
-- },
|
||||
root_dir = util.root_pattern("rome.json"),
|
||||
single_file_support = true,
|
||||
on_attach = function(client, bufnr)
|
||||
if client.server_capabilities.documentSymbolProvider then require("nvim-navic").attach(client, bufnr) end
|
||||
end,
|
||||
capabilities = CAPABILITIES,
|
||||
})
|
||||
@@ -1,22 +0,0 @@
|
||||
-- CSS + Less + SASS Language Server
|
||||
require("lspconfig").cssls.setup({
|
||||
cmd = { "vscode-css-language-server", "--stdio" },
|
||||
filetypes = { "css", "scss", "less" },
|
||||
-- root_dir = root_pattern("package.json", ".git") or bufdir,
|
||||
settings = {
|
||||
css = {
|
||||
validate = true,
|
||||
},
|
||||
less = {
|
||||
validate = true,
|
||||
},
|
||||
scss = {
|
||||
validate = true,
|
||||
},
|
||||
},
|
||||
single_file_support = true,
|
||||
capabilities = CAPABILITIES,
|
||||
on_attach = function(client, bufnr)
|
||||
if client.server_capabilities.documentSymbolProvider then require("nvim-navic").attach(client, bufnr) end
|
||||
end,
|
||||
})
|
||||
@@ -1,6 +0,0 @@
|
||||
require("lspconfig").tsserver.setup({
|
||||
capabilities = CAPABILITIES,
|
||||
on_attach = function(client, bufnr)
|
||||
if client.server_capabilities.documentSymbolProvider then require("nvim-navic").attach(client, bufnr) end
|
||||
end,
|
||||
})
|
||||
Reference in New Issue
Block a user