Skip to content

Commit

Permalink
Merge pull request #70 from ionide/fix-69
Browse files Browse the repository at this point in the history
Fix #69: force refresh CodeLens on attach
  • Loading branch information
cannorin authored Jul 17, 2023
2 parents 22a70da + b5f6ddc commit 8435bae
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
2 changes: 1 addition & 1 deletion autoload/fsharp.vim
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ function! fsharp#openFsi(returnFocus)
if a:returnFocus | call s:win_gotoid_safe(current_win) | endif
return s:fsi_buffer
else
echom "[FSAC] Your (neo)vim does not support terminal".
echom "[FSAC] Your (neo)vim does not support terminal."
return 0
endif
endif
Expand Down
19 changes: 16 additions & 3 deletions lua/ionide/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,17 @@ local function get_default_config()
return result
end

M.manager = nil
-- https://github.com/ionide/Ionide-vim/issues/69
local function inject_codelens_refresh(config)
local new_config = tbl_extend("keep", config, {})
new_config.on_attach = function(client, bufnr)
if config.on_attach then
config.on_attach(client, bufnr)
end
vim.lsp.codelens.refresh()
end
return new_config
end

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

M.manager = nil

-- partially adopted from neovim/nvim-lspconfig, see lspconfig.LICENSE.md
local function create_manager(config)
validate {
Expand Down Expand Up @@ -222,10 +234,11 @@ function M._setup_buffer(client_id, bufnr)
end

function M.setup(config)
local new_config = inject_codelens_refresh(config)
if lspconfig_is_present then
return delegate_to_lspconfig(config)
return delegate_to_lspconfig(new_config)
end
return create_manager(config)
return create_manager(new_config)
end

function M.status()
Expand Down

0 comments on commit 8435bae

Please sign in to comment.