@@ -37,7 +37,7 @@ local on_attach = function(client, bufnr)
37
37
38
38
-- Conditional capabilities
39
39
-- ref: https://github.com/tjdevries/config_manager/blob/0ebe4c3232b61674aad0e4708228797b681fa2a7/xdg_config/nvim/lua/tj/lsp/init.lua#L100
40
- if client .resolved_capabilities . document_highlight then
40
+ if client .server_capabilities . documentHighlightProvider then
41
41
vim .api .nvim_exec (
42
42
[[
43
43
augroup lsp_document_highlight
@@ -54,20 +54,20 @@ local on_attach = function(client, bufnr)
54
54
local opts = { noremap = true , silent = true }
55
55
56
56
-- general
57
- if client .resolved_capabilities . rename then
57
+ if client .server_capabilities . renameProvider then
58
58
buf_set_keymap (" n" , " <S-r>" , " <cmd>lua vim.lsp.buf.rename()<CR>" , opts )
59
59
end
60
- if client .resolved_capabilities . hover then
60
+ if client .server_capabilities . hoverProvider then
61
61
buf_set_keymap (" n" , " ?" , " <Cmd>lua vim.lsp.buf.hover()<CR>" , opts )
62
62
end
63
- if client .resolved_capabilities . document_formatting then
63
+ if client .server_capabilities . documentFormattingProvider then
64
64
if not vim .tbl_contains (vim .tbl_keys (efm_config ), client .name ) then
65
65
print (" Using efm instead of " .. client .name .. " for formatting" )
66
- client .resolved_capabilities . document_formatting = false
66
+ client .server_capabilities . documentFormattingProvider = false
67
67
else
68
68
end
69
- buf_set_keymap (" n" , " <S-f>" , " <cmd>lua vim.lsp.buf.formatting( )<CR>" , opts )
70
- vim .cmd (" autocmd BufWritePost <buffer> lua vim.lsp.buf.formatting( )" )
69
+ buf_set_keymap (" n" , " <S-f>" , " <cmd>lua vim.lsp.buf.format({async = true}) )<CR>" , opts )
70
+ vim .cmd (" autocmd BufWritePost <buffer> lua vim.lsp.buf.format({async = true} )" )
71
71
end
72
72
73
73
-- issues navigation
0 commit comments