Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot disable reference code lens (FSAC) #77

Open
markusbrammer opened this issue Feb 15, 2024 · 3 comments
Open

Cannot disable reference code lens (FSAC) #77

markusbrammer opened this issue Feb 15, 2024 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@markusbrammer
Copy link

markusbrammer commented Feb 15, 2024

Describe the bug
It doesn't seem possible to disable reference code lens for FSAutoComplete (FSAC).
The FSAC setting FSharp.EnableReferenceCodeLens is included in the Ionide's list of FSAC configs/settings:

\ {'key': 'EnableReferenceCodeLens', 'default': 1},

I am also using lspconfig.

To Reproduce
NA, see expected behaviour

Expected behaviour
I would expect to behave like disabling other FSAC settings:

vim.g['fsharp#unused_declarations_analyzer'] = 0 -- Works
vim.g['fsharp#unused_opens_analyzer'] = 0 -- Works 
vim.g['fsharp#enable_reference_code_lens'] = 0 -- Doesn't work

But it doesn't work, the reference counter is still there, see screenshot.

Screenshots
Want to disable the 1 References part.
image

Environment (please complete the following information):

  • OS: Linux Mint 21.3
  • Neovim version: v0.9.5
  • dotnet SDK version: 8.0.101
  • FSAC version: 0.70.1

Additional context
This might not be a bug if it is not implemented.

@markusbrammer markusbrammer added the bug Something isn't working label Feb 15, 2024
@greggyb
Copy link
Contributor

greggyb commented May 21, 2024

@cannorin , I dug into this a little bit, to the extent of changing the default to this in autoload/fsharp.vim, trying to implement the CodeLens property, which also mentions the reference count. I also removed all properties referencing this reference code lens. I tried these variations with each change:

  1. Change setting and :so $MYVIMRC
  2. Change+source and restart language server
  3. Change and close vim, then re-open.

If you have any pointers, I can continue digging on this one. I didn't have time yet, but my next step will be checking the LSP log when starting up and changing these options.

@cannorin
Copy link
Member

@greggyb It should be enough to call :FSharpUpdateServerConfig to update the LSP server configuration, which calls workspace/didChangeConfiguration under the hood.

My concern is that CodeLens options may not work in workspace/didChangeConfiguration and have to be specified in initializationOptions (which is init_options in Neovim's LSP client). If that is the case, we would have to explicitly add it to initializationOptions as we do for AutomaticWorkspaceInit.
https://github.com/ionide/Ionide-vim/blob/master/lua/ionide/init.lua#L38-L54

I'm going to take a look at this issue on this weekend (since I suspect that setting the CodeLenses option would fix this), but I really appreciate it if you can continue investigating it! Feel free to open a PR if you manage to fix it at your end before I do :)

@joprice
Copy link

joprice commented Jun 13, 2024

According to the changelog, the setting was renamed from FSharp.EnableReferenceCodeLens to FSharp.codeLenses.references.enabled: https://github.com/ionide/FsAutoComplete/blob/edca0ecf0c081b80aec1a135d4fffddcf28fe449/CHANGELOG.md?plain=1#L420.

Here's where it's accessed: https://github.com/ionide/FsAutoComplete/blob/edca0ecf0c081b80aec1a135d4fffddcf28fe449/src/FsAutoComplete/LspServers/AdaptiveFSharpLspServer.fs#L1539

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants