From fc52e86ef482c2db5a7b75707a407730245d3a63 Mon Sep 17 00:00:00 2001 From: Briain O'Driscoll Date: Mon, 9 May 2022 19:15:51 +0100 Subject: [PATCH] amend global on_attach function --- lua/user/lsp/handlers.lua | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/lua/user/lsp/handlers.lua b/lua/user/lsp/handlers.lua index fb8b7f8..035e7d4 100644 --- a/lua/user/lsp/handlers.lua +++ b/lua/user/lsp/handlers.lua @@ -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! * - autocmd CursorHold lua vim.lsp.buf.document_highlight() - autocmd CursorMoved lua vim.lsp.buf.clear_references() - augroup END - ]], - false - ) - end + -- 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