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

coc vim "jump to definition" not working with lsp setup? #2211

Closed
xddq opened this issue Sep 19, 2021 · 3 comments
Closed

coc vim "jump to definition" not working with lsp setup? #2211

xddq opened this issue Sep 19, 2021 · 3 comments
Labels
status: needs info Not actionable, because there's missing information type: support User support tickets, questions, help with setup etc.

Comments

@xddq
Copy link

xddq commented Sep 19, 2021

Your environment

Output of haskell-language-server --probe-tools or haskell-language-server-wrapper --probe-tools:

haskell-language-server version: 1.4.0.0 (GHC: 8.10.4) (PATH: /home/xddq/.ghcup/bin/haskell-language-server-wrapper-1.4.0) (GIT hash: 253547816ee216c53ee7dacc0ad3cac43e863d30)
Tool versions found on the $PATH
cabal:		3.4.0.0
stack:		2.7.3
ghc:		8.10.7

Which OS do you use:
Ubuntu 18.04.5
Which lsp-client do you use:
VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Aug 24 2021 00:19:01)
Included patches: 1-3370
Describe your project (alternative: link to the project):
cabal.project I created with cabal init and cabal run
Contents of hie.yaml:

cradle:
  cabal:
    - path: "src"
      component: "lib:haskell-first-steps"

    - path: "app/Main.hs"
      component: "haskell-first-steps:exe:haskell-first-steps"

Steps to reproduce

hover printStrLn and use "jump to definition"

Expected behaviour

jump to the file in which printStrLn is defined

Actual behaviour

coc.nvim "definition not found"

Include debug information

Execute in the root of your project the command haskell-language-server --debug . and paste the logs here:

Debug output:
Run entered for haskell-language-server-wrapper(haskell-language-server-wrapper) Version 1.4.0.0, Git revision 253547816ee216c53ee7dacc0ad3cac43e863d30 (dirty) x86_64 ghc-8.10.4
Current directory: /home/xddq/progproj/gitlab-freedom/haskell-first-steps
Operating system: linux
Arguments: ["--debug","."]
Cradle directory: /home/xddq/progproj/gitlab-freedom/haskell-first-steps
Cradle type: Cabal

Tool versions found on the $PATH
cabal:		3.4.0.0
stack:		2.7.3
ghc:		8.10.7


Consulting the cradle to get project GHC version...
Project GHC version: 8.10.7
haskell-language-server exe candidates: ["haskell-language-server-8.10.7","haskell-language-server"]
Launching haskell-language-server exe at:/home/xddq/.ghcup/bin/haskell-language-server-8.10.7
haskell-language-server version: 1.4.0.0 (GHC: 8.10.7) (PATH: /home/xddq/.ghcup/bin/haskell-language-server-8.10.7~1.4.0) (GIT hash: 253547816ee216c53ee7dacc0ad3cac43e863d30)
 ghcide setup tester in /home/xddq/progproj/gitlab-freedom/haskell-first-steps.
Report bugs at https://github.com/haskell/haskell-language-server/issues

Step 1/4: Finding files to test in /home/xddq/progproj/gitlab-freedom/haskell-first-steps
Found 3 files

Step 2/4: Looking for hie.yaml files that control setup
Found 1 cradle
  (/home/xddq/progproj/gitlab-freedom/haskell-first-steps/hie.yaml)

Step 3/4: Initializing the IDE
2021-09-19 03:31:56.748403578 [ThreadId 7] DEBUG hls:	Initializing exports map from hiedb
2021-09-19 03:31:56.749095575 [ThreadId 7] DEBUG hls:	Done initializing exports map from hiedb (6)

Step 4/4: Type checking the files
2021-09-19 03:31:56.761781048 [ThreadId 20] DEBUG hls:	hlint:getIdeas:file:NormalizedFilePath "/home/xddq/progproj/gitlab-freedom/haskell-first-steps/src/MyLib.hs"
2021-09-19 03:31:56.762398239 [ThreadId 19] DEBUG hls:	hlint:getIdeas:file:NormalizedFilePath "/home/xddq/progproj/gitlab-freedom/haskell-first-steps/src/FirstSteps.hs"
2021-09-19 03:31:56.762875162 [ThreadId 19] DEBUG hls:	hlint:getIdeas:file:NormalizedFilePath "/home/xddq/progproj/gitlab-freedom/haskell-first-steps/app/Main.hs"
2021-09-19 03:31:56.764023075 [ThreadId 24] INFO hls:	Consulting the cradle for "src/FirstSteps.hs"
Output from setting up the cradle Cradle {cradleRootDir = "/home/xddq/progproj/gitlab-freedom/haskell-first-steps", cradleOptsProg = CradleAction: Cabal}
2021-09-19 03:31:56.814313156 [ThreadId 30] INFO hie-bios:	Build profile: -w ghc-8.10.7 -O1
2021-09-19 03:31:56.814690891 [ThreadId 30] INFO hie-bios:	In order, the following will be built (use -v for more details):
2021-09-19 03:31:56.81476316 [ThreadId 30] INFO hie-bios:	 - haskell-first-steps-0.1.0.0 (lib) (ephemeral targets)
2021-09-19 03:31:56.878623745 [ThreadId 30] INFO hie-bios:	Preprocessing library for haskell-first-steps-0.1.0.0..
2021-09-19 03:31:57.002411755 [ThreadId 24] DEBUG hls:	Session loading result: Right (ComponentOptions {componentOptions = ["-fbuilding-cabal-package","-O0","-outputdir","/home/xddq/.cache/hie-bios/dist-haskell-first-steps-1862fdd71790143f46782e74fbeade0f/build/x86_64-linux/ghc-8.10.7/haskell-first-steps-0.1.0.0/build","-odir","/home/xddq/.cache/hie-bios/dist-haskell-first-steps-1862fdd71790143f46782e74fbeade0f/build/x86_64-linux/ghc-8.10.7/haskell-first-steps-0.1.0.0/build","-hidir","/home/xddq/.cache/hie-bios/dist-haskell-first-steps-1862fdd71790143f46782e74fbeade0f/build/x86_64-linux/ghc-8.10.7/haskell-first-steps-0.1.0.0/build","-stubdir","/home/xddq/.cache/hie-bios/dist-haskell-first-steps-1862fdd71790143f46782e74fbeade0f/build/x86_64-linux/ghc-8.10.7/haskell-first-steps-0.1.0.0/build","-i","-i/home/xddq/.cache/hie-bios/dist-haskell-first-steps-1862fdd71790143f46782e74fbeade0f/build/x86_64-linux/ghc-8.10.7/haskell-first-steps-0.1.0.0/build","-isrc","-i/home/xddq/.cache/hie-bios/dist-haskell-first-steps-1862fdd71790143f46782e74fbeade0f/build/x86_64-linux/ghc-8.10.7/haskell-first-steps-0.1.0.0/build/autogen","-i/home/xddq/.cache/hie-bios/dist-haskell-first-steps-1862fdd71790143f46782e74fbeade0f/build/x86_64-linux/ghc-8.10.7/haskell-first-steps-0.1.0.0/build/global-autogen","-I/home/xddq/.cache/hie-bios/dist-haskell-first-steps-1862fdd71790143f46782e74fbeade0f/build/x86_64-linux/ghc-8.10.7/haskell-first-steps-0.1.0.0/build/autogen","-I/home/xddq/.cache/hie-bios/dist-haskell-first-steps-1862fdd71790143f46782e74fbeade0f/build/x86_64-linux/ghc-8.10.7/haskell-first-steps-0.1.0.0/build/global-autogen","-I/home/xddq/.cache/hie-bios/dist-haskell-first-steps-1862fdd71790143f46782e74fbeade0f/build/x86_64-linux/ghc-8.10.7/haskell-first-steps-0.1.0.0/build","-optP-include","-optP/home/xddq/.cache/hie-bios/dist-haskell-first-steps-1862fdd71790143f46782e74fbeade0f/build/x86_64-linux/ghc-8.10.7/haskell-first-steps-0.1.0.0/build/autogen/cabal_macros.h","-this-unit-id","haskell-first-steps-0.1.0.0-inplace","-hide-all-packages","-Wmissing-home-modules","-no-user-package-db","-package-db","/home/xddq/.cabal/store/ghc-8.10.7/package.db","-package-db","/home/xddq/.cache/hie-bios/dist-haskell-first-steps-1862fdd71790143f46782e74fbeade0f/packagedb/ghc-8.10.7","-package-db","/home/xddq/.cache/hie-bios/dist-haskell-first-steps-1862fdd71790143f46782e74fbeade0f/build/x86_64-linux/ghc-8.10.7/haskell-first-steps-0.1.0.0/package.conf.inplace","-package-id","base-4.14.3.0","-XHaskell2010","MyLib","FirstSteps","-hide-all-packages"], componentRoot = "/home/xddq/progproj/gitlab-freedom/haskell-first-steps", componentDependencies = ["haskell-first-steps.cabal","cabal.project","cabal.project.local"]},"/home/xddq/.ghcup/ghc/8.10.7/lib/ghc-8.10.7")
2021-09-19 03:31:57.071628124 [ThreadId 24] INFO hls:	Using interface files cache dir: /home/xddq/.cache/ghcide/haskell-first-steps-0.1.0.0-inplace-41281cc6b42ea1651a8d79021a05331ddb30057c
2021-09-19 03:31:57.071981707 [ThreadId 24] INFO hls:	Making new HscEnv[haskell-first-steps-0.1.0.0-inplace]
2021-09-19 03:31:57.098796357 [ThreadId 24] DEBUG hls:	New Component Cache HscEnvEq: (([],Just HscEnvEq 5),fromList [("/home/xddq/progproj/gitlab-freedom/haskell-first-steps/hie.yaml",Just 2021-09-19 01:01:46.539742032 UTC),("cabal.project",Nothing),("cabal.project.local",Nothing),("haskell-first-steps.cabal",Just 2021-09-19 00:42:50.035762566 UTC)])
2021-09-19 03:31:57.102989478 [ThreadId 24] DEBUG hls:	Known files updated: fromList [(TargetModule MyLib,fromList ["/home/xddq/progproj/gitlab-freedom/haskell-first-steps/src/MyLib.hs"]),(TargetFile NormalizedFilePath "/home/xddq/progproj/gitlab-freedom/haskell-first-steps/src/FirstSteps.hs",fromList ["/home/xddq/progproj/gitlab-freedom/haskell-first-steps/src/FirstSteps.hs"]),(TargetModule FirstSteps,fromList ["/home/xddq/progproj/gitlab-freedom/haskell-first-steps/src/FirstSteps.hs"])]
2021-09-19 03:31:57.114598026 [ThreadId 14] DEBUG hls:	Finishing build session(exception: AsyncCancelled)
2021-09-19 03:31:57.114715041 [ThreadId 24] DEBUG hls:	Restarting build session for keys [GhcSessionIO; ] (aborting the previous one took 0.01s)
2021-09-19 03:31:57.120935246 [ThreadId 53] INFO hls:	Consulting the cradle for "app/Main.hs"
Output from setting up the cradle Cradle {cradleRootDir = "/home/xddq/progproj/gitlab-freedom/haskell-first-steps", cradleOptsProg = CradleAction: Cabal}
2021-09-19 03:31:57.121893812 [ThreadId 48] DEBUG hls:	hlint:getIdeas:file:NormalizedFilePath "/home/xddq/progproj/gitlab-freedom/haskell-first-steps/app/Main.hs"
2021-09-19 03:31:57.122070479 [ThreadId 48] DEBUG hls:	hlint:getIdeas:file:NormalizedFilePath "/home/xddq/progproj/gitlab-freedom/haskell-first-steps/src/MyLib.hs"
2021-09-19 03:31:57.122199834 [ThreadId 48] DEBUG hls:	hlint:getIdeas:file:NormalizedFilePath "/home/xddq/progproj/gitlab-freedom/haskell-first-steps/src/FirstSteps.hs"
2021-09-19 03:31:57.181271754 [ThreadId 62] INFO hie-bios:	Build profile: -w ghc-8.10.7 -O1
2021-09-19 03:31:57.181398679 [ThreadId 62] INFO hie-bios:	In order, the following will be built (use -v for more details):
2021-09-19 03:31:57.181430967 [ThreadId 62] INFO hie-bios:	 - haskell-first-steps-0.1.0.0 (exe:haskell-first-steps) (first run)
2021-09-19 03:31:57.220618487 [ThreadId 62] INFO hie-bios:	Preprocessing executable 'haskell-first-steps' for haskell-first-steps-0.1.0.0..
2021-09-19 03:31:57.337461264 [ThreadId 53] DEBUG hls:	Session loading result: Right (ComponentOptions {componentOptions = ["-fbuilding-cabal-package","-O0","-outputdir","/home/xddq/.cache/hie-bios/dist-haskell-first-steps-1862fdd71790143f46782e74fbeade0f/build/x86_64-linux/ghc-8.10.7/haskell-first-steps-0.1.0.0/x/haskell-first-steps/build/haskell-first-steps/haskell-first-steps-tmp","-odir","/home/xddq/.cache/hie-bios/dist-haskell-first-steps-1862fdd71790143f46782e74fbeade0f/build/x86_64-linux/ghc-8.10.7/haskell-first-steps-0.1.0.0/x/haskell-first-steps/build/haskell-first-steps/haskell-first-steps-tmp","-hidir","/home/xddq/.cache/hie-bios/dist-haskell-first-steps-1862fdd71790143f46782e74fbeade0f/build/x86_64-linux/ghc-8.10.7/haskell-first-steps-0.1.0.0/x/haskell-first-steps/build/haskell-first-steps/haskell-first-steps-tmp","-stubdir","/home/xddq/.cache/hie-bios/dist-haskell-first-steps-1862fdd71790143f46782e74fbeade0f/build/x86_64-linux/ghc-8.10.7/haskell-first-steps-0.1.0.0/x/haskell-first-steps/build/haskell-first-steps/haskell-first-steps-tmp","-i","-i/home/xddq/.cache/hie-bios/dist-haskell-first-steps-1862fdd71790143f46782e74fbeade0f/build/x86_64-linux/ghc-8.10.7/haskell-first-steps-0.1.0.0/x/haskell-first-steps/build/haskell-first-steps/haskell-first-steps-tmp","-iapp","-i/home/xddq/.cache/hie-bios/dist-haskell-first-steps-1862fdd71790143f46782e74fbeade0f/build/x86_64-linux/ghc-8.10.7/haskell-first-steps-0.1.0.0/x/haskell-first-steps/build/haskell-first-steps/autogen","-i/home/xddq/.cache/hie-bios/dist-haskell-first-steps-1862fdd71790143f46782e74fbeade0f/build/x86_64-linux/ghc-8.10.7/haskell-first-steps-0.1.0.0/x/haskell-first-steps/build/global-autogen","-I/home/xddq/.cache/hie-bios/dist-haskell-first-steps-1862fdd71790143f46782e74fbeade0f/build/x86_64-linux/ghc-8.10.7/haskell-first-steps-0.1.0.0/x/haskell-first-steps/build/haskell-first-steps/autogen","-I/home/xddq/.cache/hie-bios/dist-haskell-first-steps-1862fdd71790143f46782e74fbeade0f/build/x86_64-linux/ghc-8.10.7/haskell-first-steps-0.1.0.0/x/haskell-first-steps/build/global-autogen","-I/home/xddq/.cache/hie-bios/dist-haskell-first-steps-1862fdd71790143f46782e74fbeade0f/build/x86_64-linux/ghc-8.10.7/haskell-first-steps-0.1.0.0/x/haskell-first-steps/build/haskell-first-steps/haskell-first-steps-tmp","-optP-include","-optP/home/xddq/.cache/hie-bios/dist-haskell-first-steps-1862fdd71790143f46782e74fbeade0f/build/x86_64-linux/ghc-8.10.7/haskell-first-steps-0.1.0.0/x/haskell-first-steps/build/haskell-first-steps/autogen/cabal_macros.h","-hide-all-packages","-Wmissing-home-modules","-no-user-package-db","-package-db","/home/xddq/.cabal/store/ghc-8.10.7/package.db","-package-db","/home/xddq/.cache/hie-bios/dist-haskell-first-steps-1862fdd71790143f46782e74fbeade0f/packagedb/ghc-8.10.7","-package-db","/home/xddq/.cache/hie-bios/dist-haskell-first-steps-1862fdd71790143f46782e74fbeade0f/build/x86_64-linux/ghc-8.10.7/haskell-first-steps-0.1.0.0/x/haskell-first-steps/package.conf.inplace","-package-id","base-4.14.3.0","-package-id","haskell-first-steps-0.1.0.0-inplace","-XHaskell2010","app/Main.hs","-hide-all-packages"], componentRoot = "/home/xddq/progproj/gitlab-freedom/haskell-first-steps", componentDependencies = ["haskell-first-steps.cabal","cabal.project","cabal.project.local"]},"/home/xddq/.ghcup/ghc/8.10.7/lib/ghc-8.10.7")
2021-09-19 03:31:57.392166048 [ThreadId 53] INFO hls:	Using interface files cache dir: /home/xddq/.cache/ghcide/main-dea85a5564a8ea7fdf5e2ed822c59177cf2a9989
2021-09-19 03:31:57.392465514 [ThreadId 53] INFO hls:	Using interface files cache dir: /home/xddq/.cache/ghcide/haskell-first-steps-0.1.0.0-inplace-9ab44eee71486a29969afc8898ed014d1ec493b0
2021-09-19 03:31:57.395733936 [ThreadId 53] INFO hls:	Making new HscEnv[main,haskell-first-steps-0.1.0.0-inplace]
2021-09-19 03:31:57.419882331 [ThreadId 53] DEBUG hls:	New Component Cache HscEnvEq: (([],Just HscEnvEq 8),fromList [("/home/xddq/progproj/gitlab-freedom/haskell-first-steps/hie.yaml",Just 2021-09-19 01:01:46.539742032 UTC),("cabal.project",Nothing),("cabal.project.local",Nothing),("haskell-first-steps.cabal",Just 2021-09-19 00:42:50.035762566 UTC)])
2021-09-19 03:31:57.420429384 [ThreadId 53] DEBUG hls:	New Component Cache HscEnvEq: (([],Just HscEnvEq 9),fromList [("/home/xddq/progproj/gitlab-freedom/haskell-first-steps/hie.yaml",Just 2021-09-19 01:01:46.539742032 UTC),("cabal.project",Nothing),("cabal.project.local",Nothing),("haskell-first-steps.cabal",Just 2021-09-19 00:42:50.035762566 UTC)])
2021-09-19 03:31:57.429772379 [ThreadId 53] DEBUG hls:	Known files updated: fromList [(TargetFile NormalizedFilePath "/home/xddq/progproj/gitlab-freedom/haskell-first-steps/app/Main.hs",fromList ["/home/xddq/progproj/gitlab-freedom/haskell-first-steps/app/Main.hs"]),(TargetModule MyLib,fromList ["/home/xddq/progproj/gitlab-freedom/haskell-first-steps/src/MyLib.hs"]),(TargetFile NormalizedFilePath "/home/xddq/progproj/gitlab-freedom/haskell-first-steps/src/FirstSteps.hs",fromList ["/home/xddq/progproj/gitlab-freedom/haskell-first-steps/src/FirstSteps.hs"]),(TargetModule FirstSteps,fromList ["/home/xddq/progproj/gitlab-freedom/haskell-first-steps/src/FirstSteps.hs"])]
2021-09-19 03:31:57.430648162 [ThreadId 41] DEBUG hls:	Finishing build session(exception: AsyncCancelled)
2021-09-19 03:31:57.430787125 [ThreadId 53] DEBUG hls:	Restarting build session for keys [GhcSessionIO; ] (aborting the previous one took 0.00s)
2021-09-19 03:31:57.438515071 [ThreadId 95] DEBUG hls:	hlint:getIdeas:file:NormalizedFilePath "/home/xddq/progproj/gitlab-freedom/haskell-first-steps/app/Main.hs"
2021-09-19 03:31:57.443330197 [ThreadId 97] DEBUG hls:	hlint:getIdeas:file:NormalizedFilePath "/home/xddq/progproj/gitlab-freedom/haskell-first-steps/src/FirstSteps.hs"
2021-09-19 03:31:57.444931528 [ThreadId 97] DEBUG hls:	hlint:getIdeas:file:NormalizedFilePath "/home/xddq/progproj/gitlab-freedom/haskell-first-steps/src/MyLib.hs"
2021-09-19 03:31:57.534163207 [ThreadId 159] INFO hls:	finish: User TypeCheck (took 0.10s)
2021-09-19 03:31:57.5367132 [ThreadId 164] INFO hls:	finish: GetHie (took 0.00s)
2021-09-19 03:31:57.536934864 [ThreadId 165] INFO hls:	finish: GenerateCore (took 0.00s)

Completed (3 files worked, 0 files failed)

Paste the logs from the lsp-client, e.g. for VS Code

LSP logs:
I did not figure out how to get logs for haskell-lsp with vim
@jneira
Copy link
Member

jneira commented Sep 19, 2021

Hi, thanks to post here the issue, will paste my response in irc for completeness:

Hi! jump to definition is the unique feature you miss?
Rest of common ones like error diagnostics, info on hover and code actions works?
Actually hls cant jump to definition for external definitions, only between definitions in local packages (i.e. with the actual source code in your proyect). Does that work for you?

It is a common feature in other langs and a long standing feature request here 😟
#708

You will have some info about external defs like putStrLn on hover

@jneira jneira added editor: vim/neovim type: support User support tickets, questions, help with setup etc. status: needs info Not actionable, because there's missing information labels Sep 19, 2021
@xddq
Copy link
Author

xddq commented Sep 19, 2021

Hey, thanks for the quick response!

It feels a bit weird. When I write something like Prelude.putStrLn. While I am typing it I can see the definition and get suggestions.

But I do not get something after finishing it and then hovering it? (Probably a setting that I will have to specifically enable?)

Thanks for linking the issue, did not stumble upon that one while searching. I will check out the workarounds suggested there.

Error diagnostics and go to definition for local code works, exactly.

@michaelpj
Copy link
Collaborator

Dupe of #708

@michaelpj michaelpj closed this as not planned Won't fix, can't repro, duplicate, stale Mar 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs info Not actionable, because there's missing information type: support User support tickets, questions, help with setup etc.
Projects
None yet
Development

No branches or pull requests

3 participants