|
|
@ -46,18 +46,12 @@ end
|
|
|
|
|
|
|
|
|
|
|
|
local function lsp_highlight_document(client)
|
|
|
|
local function lsp_highlight_document(client)
|
|
|
|
-- Set autocommands conditional on server_capabilities
|
|
|
|
-- Set autocommands conditional on server_capabilities
|
|
|
|
if client.resolved_capabilities.document_highlight then
|
|
|
|
local status_ok, illuminate = pcall(require, "illuminate")
|
|
|
|
vim.api.nvim_exec(
|
|
|
|
if not status_ok then
|
|
|
|
[[
|
|
|
|
return
|
|
|
|
augroup lsp_document_highlight
|
|
|
|
end
|
|
|
|
autocmd! * <buffer>
|
|
|
|
illuminate.on_attach(client)
|
|
|
|
autocmd CursorHold <buffer> lua vim.lsp.buf.document_highlight()
|
|
|
|
-- end
|
|
|
|
autocmd CursorMoved <buffer> lua vim.lsp.buf.clear_references()
|
|
|
|
|
|
|
|
augroup END
|
|
|
|
|
|
|
|
]],
|
|
|
|
|
|
|
|
false
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
local function lsp_keymaps(bufnr)
|
|
|
|
local function lsp_keymaps(bufnr)
|
|
|
@ -76,7 +70,7 @@ local function lsp_keymaps(bufnr)
|
|
|
|
bufnr,
|
|
|
|
bufnr,
|
|
|
|
"n",
|
|
|
|
"n",
|
|
|
|
"gl",
|
|
|
|
"gl",
|
|
|
|
'<cmd>lua vim.lsp.diagnostic.show_line_diagnostics({ border = "rounded" })<CR>',
|
|
|
|
'<cmd>lua vim.diagnostic.open_float({ border = "rounded" })<CR>',
|
|
|
|
opts
|
|
|
|
opts
|
|
|
|
)
|
|
|
|
)
|
|
|
|
vim.api.nvim_buf_set_keymap(bufnr, "n", "]d", '<cmd>lua vim.diagnostic.goto_next({ border = "rounded" })<CR>', opts)
|
|
|
|
vim.api.nvim_buf_set_keymap(bufnr, "n", "]d", '<cmd>lua vim.diagnostic.goto_next({ border = "rounded" })<CR>', opts)
|
|
|
@ -85,6 +79,8 @@ local function lsp_keymaps(bufnr)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
M.on_attach = function(client, bufnr)
|
|
|
|
M.on_attach = function(client, bufnr)
|
|
|
|
|
|
|
|
-- vim.notify(client.name .. " starting...")
|
|
|
|
|
|
|
|
-- TODO: refactor this into a method that checks if string in list
|
|
|
|
if client.name == "tsserver" then
|
|
|
|
if client.name == "tsserver" then
|
|
|
|
client.resolved_capabilities.document_formatting = false
|
|
|
|
client.resolved_capabilities.document_formatting = false
|
|
|
|
end
|
|
|
|
end
|
|
|
|