aboutsummaryrefslogtreecommitdiff
path: root/lua/config
diff options
context:
space:
mode:
authorjdhao <jdhao@hotmail.com>2022-10-04 19:32:14 +0800
committerjdhao <jdhao@hotmail.com>2022-10-04 19:34:20 +0800
commitd40d87cb61a723104bbdd0dac533a16ed42eaf4f (patch)
tree5b5cea8ffce4d39af1c357b1cec712ab4311504e /lua/config
parent81663c8f3c5e23b4a6bd3942b3f0f0193241610a (diff)
nvim 0.8 update
Diffstat (limited to 'lua/config')
-rw-r--r--lua/config/lsp.lua14
-rw-r--r--lua/config/treesitter.lua2
2 files changed, 6 insertions, 10 deletions
diff --git a/lua/config/lsp.lua b/lua/config/lsp.lua
index 0fad17a..4fb0c82 100644
--- a/lua/config/lsp.lua
+++ b/lua/config/lsp.lua
@@ -33,11 +33,8 @@ local custom_attach = function(client, bufnr)
end, { desc = "list workspace folder" })
-- Set some key bindings conditional on server capabilities
- if client.resolved_capabilities.document_formatting then
- map("n", "<space>f", vim.lsp.buf.formatting_sync, { desc = "format code" })
- end
- if client.resolved_capabilities.document_range_formatting then
- map("x", "<space>f", vim.lsp.buf.range_formatting, { desc = "range format" })
+ if client.server_capabilities.documentFormattingProvider then
+ map("n", "<space>f", vim.lsp.buf.format, { desc = "format code" })
end
api.nvim_create_autocmd("CursorHold", {
@@ -56,9 +53,8 @@ local custom_attach = function(client, bufnr)
end
local cursor_pos = api.nvim_win_get_cursor(0)
- if
- (cursor_pos[1] ~= vim.b.diagnostics_pos[1] or cursor_pos[2] ~= vim.b.diagnostics_pos[2])
- and #vim.diagnostic.get() > 0
+ if (cursor_pos[1] ~= vim.b.diagnostics_pos[1] or cursor_pos[2] ~= vim.b.diagnostics_pos[2])
+ and #vim.diagnostic.get() > 0
then
vim.diagnostic.open_float(nil, float_opts)
end
@@ -68,7 +64,7 @@ local custom_attach = function(client, bufnr)
})
-- The blow command will highlight the current variable and its usages in the buffer.
- if client.resolved_capabilities.document_highlight then
+ if client.server_capabilities.documentHighlightProvider then
vim.cmd([[
hi! link LspReferenceRead Visual
hi! link LspReferenceText Visual
diff --git a/lua/config/treesitter.lua b/lua/config/treesitter.lua
index 9f7a8a9..92759d3 100644
--- a/lua/config/treesitter.lua
+++ b/lua/config/treesitter.lua
@@ -3,6 +3,6 @@ require("nvim-treesitter.configs").setup {
ignore_install = {}, -- List of parsers to ignore installing
highlight = {
enable = true, -- false will disable the whole extension
- disable = {}, -- list of language that will be disabled
+ disable = { 'help' }, -- list of language that will be disabled
},
}