add livecommand and del specture

This commit is contained in:
gameloader
2022-10-26 15:20:40 +08:00
parent ecbe6a626d
commit c366a7abfd
11 changed files with 125 additions and 18 deletions

35
lua/lsp/config/eslint.lua Normal file
View File

@ -0,0 +1,35 @@
return {
on_setup = function(server)
server.setup({
flags = {
debounce_text_changes = 150,
},
on_attach = function(client, bufnr)
-- 禁用格式化功能,交给专门插件插件处理
client.server_capabilities.document_formatting = false
client.server_capabilities.document_range_formatting = false
vim.api.nvim_create_autocmd("CursorHold", {
buffer = bufnr,
callback = function()
local opts = {
focusable = false,
close_events = { "BufLeave", "CursorMoved", "InsertEnter", "FocusLost" },
border = "rounded",
source = "always",
prefix = " ",
scope = "cursor",
}
vim.diagnostic.open_float(nil, opts)
end,
})
-- local function buf_set_keymap(...)
-- vim.api.nvim_buf_set_keymap(bufnr, ...)
-- end
-- local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end
-- 绑定快捷键
-- require("keybindings").mapLSP(buf_set_keymap)
end,
})
end,
}

35
lua/lsp/config/ts.lua Normal file
View File

@ -0,0 +1,35 @@
return {
on_setup = function(server)
server.setup({
flags = {
debounce_text_changes = 150,
},
on_attach = function(client, bufnr)
-- 禁用格式化功能,交给专门插件插件处理
client.server_capabilities.document_formatting = false
client.server_capabilities.document_range_formatting = false
vim.api.nvim_create_autocmd("CursorHold", {
buffer = bufnr,
callback = function()
local opts = {
focusable = false,
close_events = { "BufLeave", "CursorMoved", "InsertEnter", "FocusLost" },
border = "rounded",
source = "always",
prefix = " ",
scope = "cursor",
}
vim.diagnostic.open_float(nil, opts)
end,
})
-- local function buf_set_keymap(...)
-- vim.api.nvim_buf_set_keymap(bufnr, ...)
-- end
-- local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end
-- 绑定快捷键
-- require("keybindings").mapLSP(buf_set_keymap)
end,
})
end,
}

35
lua/lsp/config/vue.lua Normal file
View File

@ -0,0 +1,35 @@
return {
on_setup = function(server)
server.setup({
flags = {
debounce_text_changes = 150,
},
on_attach = function(client, bufnr)
-- 禁用格式化功能,交给专门插件插件处理
client.server_capabilities.document_formatting = false
client.server_capabilities.document_range_formatting = false
vim.api.nvim_create_autocmd("CursorHold", {
buffer = bufnr,
callback = function()
local opts = {
focusable = false,
close_events = { "BufLeave", "CursorMoved", "InsertEnter", "FocusLost" },
border = "rounded",
source = "always",
prefix = " ",
scope = "cursor",
}
vim.diagnostic.open_float(nil, opts)
end,
})
-- local function buf_set_keymap(...)
-- vim.api.nvim_buf_set_keymap(bufnr, ...)
-- end
-- local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end
-- 绑定快捷键
-- require("keybindings").mapLSP(buf_set_keymap)
end,
})
end,
}

View File

@ -8,13 +8,15 @@ local servers = {
sumneko_lua = require("lsp.config.lua"), -- lua/lsp/config/lua.lua
clangd = require("lsp.config.clangd"),
gopls = require("lsp.config.gopls"),
eslint = require("lsp.config.eslint"),
-- bashls = require("lsp.config.bash"),
pyright = require("lsp.config.pyright"),
vuels = require("lsp.config.vue"),
-- html = require("lsp.config.html"),
-- cssls = require("lsp.config.css"),
-- emmet_ls = require("lsp.config.emmet"),
-- jsonls = require("lsp.config.json"),
-- tsserver = require("lsp.config.ts"),
tsserver = require("lsp.config.ts"),
-- rust_analyzer = require("lsp.config.rust"),
-- yamlls = require("lsp.config.yamlls"),
-- remark_ls = require("lsp.config.markdown"),

View File

@ -2,7 +2,7 @@ vim.diagnostic.config({
virtual_text = false,
signs = true,
underline = true,
update_in_insert = false,
update_in_insert = true,
severity_sort = false,
})