|
|
@ -46,18 +46,13 @@ 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
|
|
|
|
-- if client.server_capabilities.document_highlight then
|
|
|
|
vim.api.nvim_exec(
|
|
|
|
local status_ok, illuminate = pcall(require, "illuminate")
|
|
|
|
[[
|
|
|
|
if not status_ok then
|
|
|
|
augroup lsp_document_highlight
|
|
|
|
return
|
|
|
|
autocmd! * <buffer>
|
|
|
|
end
|
|
|
|
autocmd CursorHold <buffer> lua vim.lsp.buf.document_highlight()
|
|
|
|
illuminate.on_attach(client)
|
|
|
|
autocmd CursorMoved <buffer> lua vim.lsp.buf.clear_references()
|
|
|
|
-- end
|
|
|
|
augroup END
|
|
|
|
|
|
|
|
]],
|
|
|
|
|
|
|
|
false
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
local function lsp_keymaps(bufnr)
|
|
|
|
local function lsp_keymaps(bufnr)
|
|
|
@ -85,9 +80,11 @@ local function lsp_keymaps(bufnr)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
M.on_attach = function(client, bufnr)
|
|
|
|
M.on_attach = function(client, bufnr)
|
|
|
|
if client.name == "tsserver" then
|
|
|
|
-- vim.notify(client.name .. " starting...")
|
|
|
|
client.resolved_capabilities.document_formatting = false
|
|
|
|
-- TODO: refactor this into a method that checks if string in list
|
|
|
|
end
|
|
|
|
-- if client.name == "tsserver" then
|
|
|
|
|
|
|
|
-- client.resolved_capabilities.document_formatting = false
|
|
|
|
|
|
|
|
-- end
|
|
|
|
lsp_keymaps(bufnr)
|
|
|
|
lsp_keymaps(bufnr)
|
|
|
|
lsp_highlight_document(client)
|
|
|
|
lsp_highlight_document(client)
|
|
|
|
end
|
|
|
|
end
|
|
|
|