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

Missing Code actions and code lenses (Haskell) #3005

Closed
0rphee opened this issue Jul 8, 2022 · 18 comments · May be fixed by #5063
Closed

Missing Code actions and code lenses (Haskell) #3005

0rphee opened this issue Jul 8, 2022 · 18 comments · May be fixed by #5063
Labels
A-language-server Area: Language server client C-bug Category: This is a bug

Comments

@0rphee
Copy link
Contributor

0rphee commented Jul 8, 2022

Summary

Many code actions, and code lenses are not available compared to other text editors.
In this gist two functions with multiple code actions available in Kakoune and VS Code can't be done in Helix.

This issue might refer to the same problem as #2994

In the videos below I show the behavior in helix compared to 1. Kakoune, 2. VS Code.

HLS Code actions (apply hlint fixes)
Helix (left) - Kakoune (right)

code-actions.mov

HLS Code lens (add type signature)
Helix (left) - Kakoune (right)

code-lenses.mov

HLS Code lens and Code actions in VS Code

vscode.mov

Reproduction Steps

  1. Download the gist
  2. Select the whole line of the first function, type <space> + a. Only some actions will be available but not all. Try with each token there.
  3. Try the same with the other function.

Helix log

~/.cache/helix/helix.log
2022-07-07T19:48:23.132 helix_lsp::transport [ERROR] err <- "No 'hie.yaml' found. Try to discover the project type!\n"
2022-07-07T19:48:23.137 helix_lsp::transport [ERROR] err <- "Run entered for haskell-language-server-wrapper(haskell-language-server-wrapper) Version 1.7.0.0 aarch64 ghc-9.2.2\n"
2022-07-07T19:48:23.137 helix_lsp::transport [ERROR] err <- "Current directory: /Users/roger/Documents/Dev/Haskell-Projects/Haskell-Programming-From-First-Principles/ch22\n"
2022-07-07T19:48:23.137 helix_lsp::transport [ERROR] err <- "Operating system: darwin\n"
2022-07-07T19:48:23.137 helix_lsp::transport [ERROR] err <- "Arguments: [\"--lsp\"]\n"
2022-07-07T19:48:23.137 helix_lsp::transport [ERROR] err <- "Cradle directory: /Users/roger/Documents/Dev/Haskell-Projects/Haskell-Programming-From-First-Principles/ch22\n"
2022-07-07T19:48:23.138 helix_lsp::transport [ERROR] err <- "Cradle type: Default\n"
2022-07-07T19:48:23.294 helix_lsp::transport [ERROR] err <- "\n"
2022-07-07T19:48:23.294 helix_lsp::transport [ERROR] err <- "Tool versions found on the $PATH\n"
2022-07-07T19:48:23.295 helix_lsp::transport [ERROR] err <- "cabal:\t\t3.6.2.0\n"
2022-07-07T19:48:23.296 helix_lsp::transport [ERROR] err <- "stack:\t\t2.7.5\n"
2022-07-07T19:48:23.296 helix_lsp::transport [ERROR] err <- "ghc:\t\t8.10.7\n"
2022-07-07T19:48:23.296 helix_lsp::transport [ERROR] err <- "\n"
2022-07-07T19:48:23.296 helix_lsp::transport [ERROR] err <- "\n"
2022-07-07T19:48:23.296 helix_lsp::transport [ERROR] err <- "Consulting the cradle to get project GHC version...\n"
2022-07-07T19:48:23.337 helix_lsp::transport [ERROR] err <- "Project GHC version: 8.10.7\n"
2022-07-07T19:48:23.337 helix_lsp::transport [ERROR] err <- "haskell-language-server exe candidates: [\"haskell-language-server-8.10.7\",\"haskell-language-server\"]\n"
2022-07-07T19:48:23.338 helix_lsp::transport [ERROR] err <- "Launching haskell-language-server exe at:/Users/roger/.ghcup/bin/haskell-language-server-8.10.7\n"
2022-07-07T19:48:25.301 helix_lsp::transport [ERROR] err <- "2022-07-08T00:48:25.301493Z | Info | No log file specified; using stderr.\n"
2022-07-07T19:48:25.302 helix_lsp::transport [ERROR] err <- "2022-07-08T00:48:25.301745Z | Info | haskell-language-server version: 1.7.0.0 (GHC: 8.10.7) (PATH: /Users/roger/.ghcup/hls/1.7.0.0/lib/haskell-language-server-1.7.0.0/bin/haskell-language-server-8.10.7)\n"
2022-07-07T19:48:25.302 helix_lsp::transport [ERROR] err <- "2022-07-08T00:48:25.302120Z | Info | Directory: /Users/roger/Documents/Dev/Haskell-Projects/Haskell-Programming-From-First-Principles/ch22\n"
2022-07-07T19:48:25.302 helix_lsp::transport [ERROR] err <- "2022-07-08T00:48:25.302325Z | Info | Starting (haskell-language-server) LSP server...\n"
2022-07-07T19:48:25.302 helix_lsp::transport [ERROR] err <- "  GhcideArguments {argsCommand = LSP, argsCwd = Nothing, argsShakeProfiling = Nothing, argsTesting = False, argsExamplePlugin = False, argsDebugOn = False, argsLogFile = Nothing, argsThreads = 0, argsProjectGhcVersion = False}\n"
2022-07-07T19:48:25.302 helix_lsp::transport [ERROR] err <- "  PluginIds: [ pragmas\n"
2022-07-07T19:48:25.302 helix_lsp::transport [ERROR] err <- "             , floskell\n"
2022-07-07T19:48:25.302 helix_lsp::transport [ERROR] err <- "             , fourmolu\n"
2022-07-07T19:48:25.302 helix_lsp::transport [ERROR] err <- "             , tactics\n"
2022-07-07T19:48:25.302 helix_lsp::transport [ERROR] err <- "             , ormolu\n"
2022-07-07T19:48:25.302 helix_lsp::transport [ERROR] err <- "             , stylish-haskell\n"
2022-07-07T19:48:25.303 helix_lsp::transport [ERROR] err <- "             , rename\n"
2022-07-07T19:48:25.303 helix_lsp::transport [ERROR] err <- "             , retrie\n"
2022-07-07T19:48:25.303 helix_lsp::transport [ERROR] err <- "             , brittany\n"
2022-07-07T19:48:25.303 helix_lsp::transport [ERROR] err <- "             , callHierarchy\n"
2022-07-07T19:48:25.303 helix_lsp::transport [ERROR] err <- "             , class\n"
2022-07-07T19:48:25.303 helix_lsp::transport [ERROR] err <- "             , haddockComments\n"
2022-07-07T19:48:25.303 helix_lsp::transport [ERROR] err <- "             , eval\n"
2022-07-07T19:48:25.303 helix_lsp::transport [ERROR] err <- "             , importLens\n"
2022-07-07T19:48:25.303 helix_lsp::transport [ERROR] err <- "             , qualifyImportedNames\n"
2022-07-07T19:48:25.303 helix_lsp::transport [ERROR] err <- "             , refineImports\n"
2022-07-07T19:48:25.303 helix_lsp::transport [ERROR] err <- "             , moduleName\n"
2022-07-07T19:48:25.303 helix_lsp::transport [ERROR] err <- "             , hlint\n"
2022-07-07T19:48:25.303 helix_lsp::transport [ERROR] err <- "             , splice\n"
2022-07-07T19:48:25.303 helix_lsp::transport [ERROR] err <- "             , alternateNumberFormat\n"
2022-07-07T19:48:25.303 helix_lsp::transport [ERROR] err <- "             , selectionRange\n"
2022-07-07T19:48:25.303 helix_lsp::transport [ERROR] err <- "             , changeTypeSignature\n"
2022-07-07T19:48:25.303 helix_lsp::transport [ERROR] err <- "             , ghcide-hover-and-symbols\n"
2022-07-07T19:48:25.303 helix_lsp::transport [ERROR] err <- "             , ghcide-code-actions-imports-exports\n"
2022-07-07T19:48:25.303 helix_lsp::transport [ERROR] err <- "             , ghcide-code-actions-type-signatures\n"
2022-07-07T19:48:25.303 helix_lsp::transport [ERROR] err <- "             , ghcide-code-actions-bindings\n"
2022-07-07T19:48:25.303 helix_lsp::transport [ERROR] err <- "             , ghcide-code-actions-fill-holes\n"
2022-07-07T19:48:25.303 helix_lsp::transport [ERROR] err <- "             , ghcide-completions\n"
2022-07-07T19:48:25.303 helix_lsp::transport [ERROR] err <- "             , ghcide-type-lenses\n"
2022-07-07T19:48:25.303 helix_lsp::transport [ERROR] err <- "             , ghcide-core\n"
2022-07-07T19:48:25.304 helix_lsp::transport [ERROR] err <- "             , LSPRecorderCallback ]\n"
2022-07-07T19:48:25.304 helix_lsp::transport [ERROR] err <- "2022-07-08T00:48:25.304040Z | Info | Logging heap statistics every 60.00s\n"
2022-07-07T19:48:25.348 helix_lsp::transport [ERROR] err <- " 2022-07-08T00:48:25.348748Z | Info | Staring LSP server...\n"
2022-07-07T19:48:25.349 helix_lsp::transport [ERROR] err <- "If you are seeing this in a terminal, you probably should have run WITHOUT the --lsp option!\n"
2022-07-07T19:48:25.349 helix_lsp::transport [ERROR] err <- "2022-07-08T00:48:25.349686Z | Info | Started LSP server in 0.00s\n"
2022-07-07T19:48:25.403 helix_lsp::transport [ERROR] err <- "2022-07-08T00:48:25.401452Z | Info | Registering IDE configuration: IdeConfiguration {workspaceFolders = fromList [NormalizedUri 6042087041491829206 \"file:https:///Users/roger/Documents/Dev/Haskell-Projects/Haskell-Programming-From-First-Principles\"], clientSettings = hashed Nothing}\n"
2022-07-07T19:48:25.405 helix_lsp::transport [ERROR] err <- "2022-07-08T00:48:25.405412Z | Info | Cradle path: ch22/ch22.hs\n"
2022-07-07T19:48:25.405 helix_lsp::transport [ERROR] err <- "2022-07-08T00:48:25.405499Z | Warning | No [cradle](https://github.com/mpickering/hie-bios#hie-bios) found for ch22/ch22.hs.\n"
2022-07-07T19:48:25.405 helix_lsp::transport [ERROR] err <- "Proceeding with [implicit cradle](https://hackage.haskell.org/package/implicit-hie).\n"
2022-07-07T19:48:25.405 helix_lsp::transport [ERROR] err <- "You should ignore this message, unless you see a 'Multi Cradle: No prefixes matched' error.\n"
2022-07-07T19:48:25.523 helix_lsp::transport [ERROR] err <- "2022-07-08T00:48:25.518586Z | Info | Interface files cache directory: /Users/roger/.cache/ghcide/main-1a596a151463f2c53ee4feb14ecd276a1ccebfda\n"
2022-07-07T19:48:25.523 helix_lsp::transport [ERROR] err <- "2022-07-08T00:48:25.523667Z | Info | Making new HscEnv. In-place unit ids: [main]\n"
2022-07-07T19:49:03.128 helix_lsp::transport [ERROR] err <- "2022-07-08T00:49:03.127787Z | Info | Reactor thread stopped\n"

Platform

macOS

Terminal Emulator

iTerm2 Build 3.4.16

Helix Version

helix 22.05 (27609f5)

@0rphee 0rphee added the C-bug Category: This is a bug label Jul 8, 2022
@archseer
Copy link
Member

archseer commented Jul 8, 2022

Can you check again now that #3012 is merged?

@0rphee
Copy link
Contributor Author

0rphee commented Jul 9, 2022

I have to build helix locally right? Or is there any other place I can get the new commits?

@sudormrfbin
Copy link
Member

Yeah you would have to checkout master and build locally. We don't have nightly releases yet.

@0rphee
Copy link
Contributor Author

0rphee commented Jul 9, 2022

After building it, #3012 doesn't seem to have solved the issue. The problem persists:

Untitled.mov

@kirawi kirawi added the A-language-server Area: Language server client label Jul 15, 2022
@erasin
Copy link
Contributor

erasin commented Jul 19, 2022

take pull #3096, I checked in typescript that it works ok。

@lcycon
Copy link
Contributor

lcycon commented Sep 19, 2022

I have this same issue. Testing with helix 22.08.1 (5ea78559) and I can still reproduce this issue. Anything I can provide to help debugging?

@lcycon
Copy link
Contributor

lcycon commented Sep 19, 2022

I've managed to track down the issue, PR #3898 is my very quick pass at resolving the issue

@0rphee
Copy link
Contributor Author

0rphee commented Nov 8, 2022

It seems PR #3898 has solved most of the issues. Nevertheless, some actions (at least adding type signatures, #3005 (comment)) aren't yet available in helix...

@matoous matoous mentioned this issue Dec 8, 2022
8 tasks
@Esnos33
Copy link

Esnos33 commented Apr 26, 2023

Even after helix 23 I still have this problem, this is solved problem or not?

@0rphee
Copy link
Contributor Author

0rphee commented Apr 26, 2023

Even after helix 23 I still have this problem, this is solved problem or not?

@Esnos33 what do you mean you still have this problem but you ask if it is solved or it isn't?

I'm pretty sure this is solved, but I had forgot about this issue. Will test later though.

@Esnos33
Copy link

Esnos33 commented Apr 26, 2023

I mean it doesn't work for me, when I select a function and press space + a, then only meaningless actions shows up.

@0rphee
Copy link
Contributor Author

0rphee commented Apr 27, 2023

I mean it doesn't work for me, when I select a function and press space + a, then only meaningless actions shows up.

@Esnos33 maybe it has to do with what helix version are you using? because, at least for the type signature, it works on helix 23.03 (4cdba7c).

type-signature.mov

In the case of other code actions maybe not working correctly ("outdated workspace edit ..."), check this issues: #6543 & haskell/haskell-language-server#3547 (comment)

@Esnos33
Copy link

Esnos33 commented Apr 27, 2023

@0rphee For starters, thanks for response.
I still have problem, as you can see on recording. If that matters, I installed helix from apt package on Pop_OS!

EDIT: Uninstalled whole helix and installed it again from source, still having same issue. Other features, like code completion and going to definition still works, hx --health haskell still gives me same message.

helix.mov

@0rphee
Copy link
Contributor Author

0rphee commented Apr 27, 2023

@Esnos33 hmm that's unfortunate....

What do you mean you installed it again from source? did you uninstall and install it again with the package manager?

have you tried building helix from source yourself?

also, this maaaaaybe has to do with the version of hls and ghc you are using (i doubt it though), could you check their versions? if possible, i will try to reproduce the problem on my machine

@Esnos33
Copy link

Esnos33 commented Apr 27, 2023

@0rphee I installed helix from source as in link. I also checked and I have softwrap, which is feature of latest build, so I think I have good one version of helix. Here are screenshots of softwrap and ghcup tui.
image
image

@0rphee
Copy link
Contributor Author

0rphee commented Apr 29, 2023

@Esnos33 I think I know what's happening. It seems that hls doesn't give as many code actions when it doesn't find a specific project's configuration file (package.yaml or *.cabal).

I just tested it, and when I edit a standalone .hs file, it isn't possible to add type signatures, but when I edit a file inside a stack project this problem doesn't appear.

hs.mov

I think you should file a separate issue in the hls repo, as it seems that this is an issue with the language server, not helix itself.

@Esnos33
Copy link

Esnos33 commented Apr 29, 2023

@0rphee I just checked and you are right, it works for me on stack! I will later write issue in hls git, thanks for help, helix is best.

@0rphee
Copy link
Contributor Author

0rphee commented Oct 24, 2023

I will close this, as the main issue has been resolved, code lenses are not being added into core #7957 (comment), and the issue with hls not working showing more code actions/diagnostics on files outside of a project seems to be an issue with hls itself

@0rphee 0rphee closed this as completed Oct 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-language-server Area: Language server client C-bug Category: This is a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants