lsp modifications
This commit is contained in:
parent
9f2d7eb8d8
commit
8b5ec5d4f4
18 changed files with 41 additions and 41 deletions
|
@ -71,13 +71,14 @@ local function lsp_keymaps(bufnr)
|
|||
vim.api.nvim_buf_set_keymap(bufnr, "n", "gca", ":Lspsaga code_action<CR>", opts)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, "n", "[d", ":Lspsaga diagnostic_jump_next<CR>", opts)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, "n", "]d", ":Lspsaga diagnostic_jump_prev<CR>", opts)
|
||||
vim.cmd([[ command! Format execute 'lua vim.lsp.buf.formatting()' ]])
|
||||
end
|
||||
|
||||
M.on_attach = function(client, bufnr)
|
||||
lsp_keymaps(bufnr)
|
||||
lsp_highlight_document(client)
|
||||
attach_navic(client, bufnr)
|
||||
|
||||
vim.cmd([[autocmd BufWritePre * lua vim.lsp.buf.format()]])
|
||||
end
|
||||
|
||||
-- Define Capabilities
|
||||
|
@ -85,7 +86,7 @@ local capabilities = vim.lsp.protocol.make_client_capabilities()
|
|||
capabilities.textDocument.completion.completionItem.snippetSupport = true
|
||||
capabilities.textDocument.foldingRange = {
|
||||
dynamicRegistration = false,
|
||||
lineFoldingOnly = true
|
||||
lineFoldingOnly = true,
|
||||
}
|
||||
|
||||
local status_ok, cmp_nvim_lsp = pcall(require, "cmp_nvim_lsp")
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
require("user.lsp.handlers").setup()
|
||||
require("user.lsp.nlspsettings")
|
||||
require("user.lsp.mason")
|
||||
require("user.lsp.nullls")
|
||||
require("user.lsp.signature")
|
||||
|
|
|
@ -15,12 +15,12 @@ lspconfig.util.default_config = vim.tbl_extend("force", lspconfig.util.default_c
|
|||
capabilities = require("user.lsp.handlers").capabilities,
|
||||
})
|
||||
|
||||
require("user.lsp.settings.sumneko_lua")
|
||||
require("user.lsp.settings.jsonls")
|
||||
require("user.lsp.settings.tsserver")
|
||||
require("user.lsp.settings.yamlls")
|
||||
require("user.lsp.settings.volar")
|
||||
require("user.lsp.settings.dockerls")
|
||||
require("user.lsp.settings.rnix")
|
||||
require("user.lsp.settings.taplo")
|
||||
require("user.lsp.settings.omnisharp")
|
||||
require("user.lsp.settings.lua.sumneko_lua")
|
||||
require("user.lsp.settings.lua.jsonls")
|
||||
require("user.lsp.settings.lua.tsserver")
|
||||
require("user.lsp.settings.lua.yamlls")
|
||||
require("user.lsp.settings.lua.volar")
|
||||
require("user.lsp.settings.lua.dockerls")
|
||||
require("user.lsp.settings.lua.rnix")
|
||||
require("user.lsp.settings.lua.taplo")
|
||||
require("user.lsp.settings.lua.omnisharp")
|
||||
|
|
9
lua/user/lsp/nlspsettings.lua
Normal file
9
lua/user/lsp/nlspsettings.lua
Normal file
|
@ -0,0 +1,9 @@
|
|||
local nlspsettings = require("nlspsettings")
|
||||
|
||||
nlspsettings.setup({
|
||||
config_home = vim.fn.stdpath("config") .. "/lua/user/lsp/settings/json",
|
||||
local_settings_dir = ".nlsp-settings",
|
||||
local_settings_root_markers = { ".git" },
|
||||
append_default_schemas = true,
|
||||
loader = "json",
|
||||
})
|
|
@ -18,15 +18,6 @@ null_ls.setup({
|
|||
formatting.markdownlint,
|
||||
diagnostics.yamllint,
|
||||
formatting.rustfmt,
|
||||
diagnostics.editorconfig_checker,
|
||||
},
|
||||
on_attach = function(client)
|
||||
if client.server_capabilities.documentFormattingProvider then
|
||||
vim.cmd([[
|
||||
augroup LspFormatting
|
||||
autocmd! * <buffer>
|
||||
autocmd BufWritePre <buffer> lua vim.lsp.buf.format()
|
||||
augroup END
|
||||
]])
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
|
3
lua/user/lsp/settings/json/sumneko_lua.json
Normal file
3
lua/user/lsp/settings/json/sumneko_lua.json
Normal file
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"Lua.diagnostics.globals": ["vim"]
|
||||
}
|
9
lua/user/lsp/settings/lua/omnisharp.lua
Normal file
9
lua/user/lsp/settings/lua/omnisharp.lua
Normal file
|
@ -0,0 +1,9 @@
|
|||
local status_ok, lspconfig = pcall(require, "lspconfig")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
lspconfig.omnisharp.setup({
|
||||
organize_imports_on_format = true,
|
||||
enable_import_completion = true,
|
||||
})
|
3
lua/user/lsp/settings/lua/sumneko_lua.lua
Normal file
3
lua/user/lsp/settings/lua/sumneko_lua.lua
Normal file
|
@ -0,0 +1,3 @@
|
|||
local lspconfig = require("lspconfig")
|
||||
|
||||
lspconfig.sumneko_lua.setup({})
|
|
@ -3,4 +3,4 @@ if not status_ok then
|
|||
return
|
||||
end
|
||||
|
||||
lspconfig.omnisharp.setup({})
|
||||
lspconfig.volar.setup({})
|
|
@ -1,11 +0,0 @@
|
|||
local lspconfig = require("lspconfig")
|
||||
|
||||
lspconfig.sumneko_lua.setup({
|
||||
settings = {
|
||||
Lua = {
|
||||
diagnostics = {
|
||||
globals = { "vim" },
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
|
@ -1,8 +0,0 @@
|
|||
local status_ok, lspconfig = pcall(require, "lspconfig")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
lspconfig.volar.setup({
|
||||
filetypes = { "typescript", "javascript", "javascriptreact", "typescriptreact", "vue", "json" },
|
||||
})
|
|
@ -90,6 +90,8 @@ return packer.startup(function(use)
|
|||
use("https://git.sr.ht/~whynothugo/lsp_lines.nvim")
|
||||
use("SmiteshP/nvim-navic")
|
||||
use("kevinhwang91/nvim-ufo")
|
||||
use("tamago324/nlsp-settings.nvim")
|
||||
use("gpanders/editorconfig.nvim")
|
||||
|
||||
-- Rust Dev
|
||||
use({
|
||||
|
|
Reference in a new issue