amend global on_attach function

pull/144/head^2
Briain O'Driscoll 3 years ago
parent 21877b4ced
commit fc52e86ef4

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

Loading…
Cancel
Save