enhancement: update lsp syntax to support both stable and nightly

This commit is contained in:
Thieu Nguyen 2022-07-06 10:23:37 +07:00 committed by Sidhanth Rathod
parent 71f30f72c0
commit 1500ff1516
1 changed files with 11 additions and 2 deletions

View File

@ -12,8 +12,17 @@ local utils = require "core.utils"
require "ui.lsp" require "ui.lsp"
M.on_attach = function(client, bufnr) M.on_attach = function(client, bufnr)
client.resolved_capabilities.document_formatting = false local vim_version = vim.version()
client.resolved_capabilities.document_range_formatting = false
if vim_version.minor > 7 then
-- nightly
client.server_capabilities.documentFormattingProvider = false
client.server_capabilities.documentRangeFormattingProvider = false
else
-- stable
client.resolved_capabilities.document_formatting = false
client.resolved_capabilities.document_range_formatting = false
end
local lsp_mappings = utils.load_config().mappings.lspconfig local lsp_mappings = utils.load_config().mappings.lspconfig
utils.load_mappings({ lsp_mappings }, { buffer = bufnr }) utils.load_mappings({ lsp_mappings }, { buffer = bufnr })