Skip to content

Commit b5f6ddc

Browse files
committed
Fix #69: force refresh CodeLens on attach
1 parent b7ec680 commit b5f6ddc

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

autoload/fsharp.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,7 @@ function! fsharp#openFsi(returnFocus)
580580
if a:returnFocus | call s:win_gotoid_safe(current_win) | endif
581581
return s:fsi_buffer
582582
else
583-
echom "[FSAC] Your (neo)vim does not support terminal".
583+
echom "[FSAC] Your (neo)vim does not support terminal."
584584
return 0
585585
endif
586586
endif

lua/ionide/init.lua

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,17 @@ local function get_default_config()
5353
return result
5454
end
5555

56-
M.manager = nil
56+
-- https://github.com/ionide/Ionide-vim/issues/69
57+
local function inject_codelens_refresh(config)
58+
local new_config = tbl_extend("keep", config, {})
59+
new_config.on_attach = function(client, bufnr)
60+
if config.on_attach then
61+
config.on_attach(client, bufnr)
62+
end
63+
vim.lsp.codelens.refresh()
64+
end
65+
return new_config
66+
end
5767

5868
local function autostart_if_needed(m, config)
5969
local auto_setup = (vim.g['fsharp#lsp_auto_setup'] == 1)
@@ -78,6 +88,8 @@ local function delegate_to_lspconfig(config)
7888
lspconfig.ionide.setup(config)
7989
end
8090

91+
M.manager = nil
92+
8193
-- partially adopted from neovim/nvim-lspconfig, see lspconfig.LICENSE.md
8294
local function create_manager(config)
8395
validate {
@@ -222,10 +234,11 @@ function M._setup_buffer(client_id, bufnr)
222234
end
223235

224236
function M.setup(config)
237+
local new_config = inject_codelens_refresh(config)
225238
if lspconfig_is_present then
226-
return delegate_to_lspconfig(config)
239+
return delegate_to_lspconfig(new_config)
227240
end
228-
return create_manager(config)
241+
return create_manager(new_config)
229242
end
230243

231244
function M.status()

0 commit comments

Comments
 (0)