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

How to Avoid Type Signature Code Lenses in Instance Declarations #3272

Open
julmb opened this issue Oct 8, 2022 · 3 comments
Open

How to Avoid Type Signature Code Lenses in Instance Declarations #3272

julmb opened this issue Oct 8, 2022 · 3 comments
Labels
documentation type: support User support tickets, questions, help with setup etc.

Comments

@julmb
Copy link

julmb commented Oct 8, 2022

Your environment

Which OS do you use?
ArchLinux

Which version of GHC do you use and how did you install it?
8.10.7 from ghcup

Which LSP client (editor/plugin) do you use?
Code OSS from Arch repository

Which version of HLS do you use and how did you install it?
1.8.0.0 from ghcup

What's wrong?

I recently upgraded from HLS 1.6.* (I think) to 1.8.0.0 and now type signature code lenses are displayed for functions in instance declarations, which was not the case before. I would like to retain the former behavior of only showing type signature code lenses for standalone top-level declarations.

I looked at the settings and found haskell.plugin.ghcide-type-lenses.config.mode, which has three possible values always, exported, and diagnostics. The description for the diagnostics value reads "Follows error messages produced by GHC about missing signatures". This sounds to me like type signature code lenses would be displayed in exactly those places where GHC would give a -Wmissing-signatures warning. However, this seems to not be the case and I was in fact unable to find any situation where diagnostics and always produced a different result.

  1. How do I prevent type signature code lenses from being shown in instance declarations?
  2. What is the intended behavior of the diagnostics value?
  3. If the intended behavior of diagnostics is something different than aligning type signature code lenses with -Wmissing-signatures, maybe an option that enables this sort of behavior would be useful?
@julmb julmb added status: needs triage type: support User support tickets, questions, help with setup etc. labels Oct 8, 2022
@michaelpj
Copy link
Collaborator

Unfortunately the plugin options are not well-documented (#3183). I'm not sure what the option is off the top of my head (@July541 ?).

@July541
Copy link
Collaborator

July541 commented Nov 3, 2022

It a little confusing, it turns out code lens for instances belongs to hls-class-plugin. But due to haskell/vscode-haskell#686, you can't disable it in vscode until the next release for vscode-haskell.

It also possible write a config file in the project dir, but I can't find where it is documented...

@julmb
Copy link
Author

julmb commented Jan 24, 2024

I figured I would follow up in case anyone stumbles upon this issue. It seems like now there are four options:

haskell.plugin.importLens.codeLensOn
haskell.plugin.importLens.codeActionsOn
haskell.plugin.class.codeLensOn
haskell.plugin.class.codeActionsOn

Setting both the *.codeActionsOn to false got me the result I wanted.

As far as I am concerned, this issue could be closed now, unless the documentation aspect is still something that needs to be worked on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation type: support User support tickets, questions, help with setup etc.
Projects
None yet
Development

No branches or pull requests

3 participants