From 790ca30d939af093e5e83f55e6ba9e2cbcb98585 Mon Sep 17 00:00:00 2001 From: sigmaSd Date: Tue, 23 Aug 2022 17:47:03 +0100 Subject: fix(denols): revert "remove unneeded lsp attach" #2070 I found the root cause of denols problems: https://github.com/neovim/neovim/pull/19797 With that pr applied (and with this revert) denols works perfectly almost identical to vscode deno, its missing some features but I imagine those are out of scope for lspconfig. Problems will reappear until nvim fixes: https://github.com/neovim/nvim-lspconfig/issues/1998 This is an ok tradeoff because `single_file_support=true` causes other issues: https://github.com/neovim/nvim-lspconfig/issues/2069 --- lua/lspconfig/server_configurations/denols.lua | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'lua') diff --git a/lua/lspconfig/server_configurations/denols.lua b/lua/lspconfig/server_configurations/denols.lua index e8e2688d..1986a3ec 100644 --- a/lua/lspconfig/server_configurations/denols.lua +++ b/lua/lspconfig/server_configurations/denols.lua @@ -8,7 +8,7 @@ local function buf_cache(bufnr, client) client.request_sync('deno/cache', params) end -local function virtual_text_document_handler(uri, res) +local function virtual_text_document_handler(uri, res, client) if not res then return nil end @@ -25,6 +25,7 @@ local function virtual_text_document_handler(uri, res) vim.api.nvim_buf_set_option(bufnr, 'readonly', true) vim.api.nvim_buf_set_option(bufnr, 'modified', false) vim.api.nvim_buf_set_option(bufnr, 'modifiable', false) + lsp.buf_attach_client(bufnr, client.id) end local function virtual_text_document(uri, client) @@ -34,7 +35,7 @@ local function virtual_text_document(uri, client) }, } local result = client.request_sync('deno/virtualTextDocument', params) - virtual_text_document_handler(uri, result) + virtual_text_document_handler(uri, result, client) end local function denols_handler(err, result, ctx) @@ -58,8 +59,6 @@ end return { default_config = { cmd = { 'deno', 'lsp' }, - -- single file support is required for now to make the lsp work correctly, see #2000 - single_file_support = true, filetypes = { 'javascript', 'javascriptreact', -- cgit v1.2.3-70-g09d2