I remember that it was possible to press and hold Ctrl and then use click to jump to the defined place, but now it can't.What's going on?
It still works for me. Can you provide more information? Version of hls, what editor+LSP client you're using, what cradle you're using, what actions you're taking, a log from lsp, etc.
It still works for me. Can you provide more information? Version of hls, what editor+LSP client you're using, what cradle you're using, what actions you're taking, a log from lsp, etc.
platform: Linux mint 19.3
editor: vscode latest
haskell tools: stack 2.3.3
ghc:8.8.4
hls version: 0.5.0
Can you also provide a log from hls when the action doesn't work?
Can you also provide a log from hls when the action doesn't work?
2020-10-10 15:46:51.431968962 [ThreadId 25] - Registering ide configuration: IdeConfiguration {workspaceFolders = fromList [NormalizedUri 8449087510257524416 "file:///home/ggx/Documents/hsProject/Hello"], clientSettings = hashed Nothing}
2020-10-10 15:46:51.434102611 [ThreadId 25] - Configuration changed: Object (fromList [("haskell",Object (fromList [("logFile",String "/home/ggx/haskell.log"),("hlintOn",Bool True),("formatOnImportOn",Bool True),("indentationRules",Object (fromList [("enabled",Bool True)])),("liquidOn",Bool False),("languageServerVariant",String "haskell-language-server"),("serverExecutablePath",String "${HOME}/.local/bin/haskell-language-server-8.8.4"),("diagnosticsOnChange",Bool True),("completionSnippetsOn",Bool True),("maxNumberOfProblems",Number 100.0),("formattingProvider",String "ormolu"),("trace",Object (fromList [("server",String "off")]))]))])
2020-10-10 15:46:51.434921106 [ThreadId 25] - Opened text document: file:///home/ggx/Documents/hsProject/Hello/src/Lib.hs
2020-10-10 15:46:51.43553786 [ThreadId 98] - Consulting the cradle for "src/Lib.hs"
2020-10-10 15:46:51.692691209 [ThreadId 118] - Plugin.makeCodeLens (ideLogger)
2020-10-10 15:46:53.363322563 [ThreadId 98] - Using interface files cache dir: /home/ggx/.cache/ghcide/main-abe7a1964ecd974eac24f4db8d41d0595ef1d3e9
2020-10-10 15:46:53.36349205 [ThreadId 98] - Making new HscEnv[main]
2020-10-10 15:46:53.619507193 [ThreadId 239] - finish: CodeAction (took 0.00s)
2020-10-10 15:46:53.846888353 [ThreadId 252] - Plugin.makeCodeLens (ideLogger)
2020-10-10 15:46:53.847159917 [ThreadId 253] - finish: codeLens (took 0.00s)
2020-10-10 15:46:53.847537311 [ThreadId 259] - finish: (took 0.00s)
2020-10-10 15:46:53.850725596 [ThreadId 264] - finish: CodeAction (took 0.00s)
2020-10-10 15:46:54.439574427 [ThreadId 271] - GhcIde.hover entered (ideLogger)
2020-10-10 15:46:54.43972906 [ThreadId 271] - Hover request at position 7:16 in file: /home/ggx/Documents/hsProject/Hello/src/Lib.hs
2020-10-10 15:46:55.235949591 [ThreadId 284] - finish: CodeAction:PackageExports (took 1.62s)
2020-10-10 15:46:55.235920033 [ThreadId 285] - finish: CodeAction:PackageExports (took 1.39s)
2020-10-10 15:46:55.23620155 [ThreadId 286] - finish: importLens (took 0.00s)
2020-10-10 15:46:55.23938695 [ThreadId 288] - finish: retrie (took 0.00s)
2020-10-10 15:46:55.239663513 [ThreadId 290] - finish: tactic (took 0.00s)
2020-10-10 15:46:55.239899498 [ThreadId 296] - finish: tactic (took 0.00s)
2020-10-10 15:46:55.240054617 [ThreadId 297] - finish: tactic (took 0.00s)
2020-10-10 15:46:55.983425099 [ThreadId 302] - DocumentHighlight request at position 12:12 in file: /home/ggx/Documents/hsProject/Hello/src/Lib.hs
2020-10-10 15:46:56.227719285 [ThreadId 309] - finish: CodeAction (took 0.00s)
2020-10-10 15:46:56.227805297 [ThreadId 311] - finish: CodeAction:PackageExports (took 0.00s)
2020-10-10 15:46:56.228070437 [ThreadId 313] - finish: importLens (took 0.00s)
2020-10-10 15:46:56.228286936 [ThreadId 315] - finish: retrie (took 0.00s)
2020-10-10 15:46:56.228521199 [ThreadId 317] - finish: tactic (took 0.00s)
2020-10-10 15:46:56.228623876 [ThreadId 319] - finish: tactic (took 0.00s)
2020-10-10 15:46:56.228699501 [ThreadId 321] - finish: tactic (took 0.00s)
2020-10-10 15:46:56.960154132 [ThreadId 25] - Opened text document: file:///home/ggx/Documents/hsProject/Hello/app/Main.hs
2020-10-10 15:46:56.961154622 [ThreadId 361] - Consulting the cradle for "app/Main.hs"
2020-10-10 15:46:56.961474145 [ThreadId 380] - DocumentHighlight request at position 6:12 in file: /home/ggx/Documents/hsProject/Hello/app/Main.hs
2020-10-10 15:46:57.191498182 [ThreadId 414] - Plugin.makeCodeLens (ideLogger)
2020-10-10 15:46:57.589216565 [ThreadId 425] - Definition request at position 6:15 in file: /home/ggx/Documents/hsProject/Hello/app/Main.hs
2020-10-10 15:46:58.031446888 [ThreadId 430] - Definition request at position 6:11 in file: /home/ggx/Documents/hsProject/Hello/app/Main.hs
2020-10-10 15:46:58.896326577 [ThreadId 361] - Using interface files cache dir: /home/ggx/.cache/ghcide/main-698a8ad6e8b7f0c442d7e4955a29c92f6481da24
2020-10-10 15:46:58.896518948 [ThreadId 361] - Using interface files cache dir: /home/ggx/.cache/ghcide/main-698a8ad6e8b7f0c442d7e4955a29c92f6481da24
2020-10-10 15:46:58.89657934 [ThreadId 361] - Making new HscEnv[main,main]
2020-10-10 15:46:58.913034049 [ThreadId 548] - finish: CodeAction (took 0.00s)
2020-10-10 15:46:58.92933264 [ThreadId 629] - finish: codeLens (took 0.02s)
2020-10-10 15:46:58.9297121 [ThreadId 643] - finish: (took 0.00s)
2020-10-10 15:46:58.944333504 [ThreadId 659] - GhcIde.hover entered (ideLogger)
2020-10-10 15:46:58.944565626 [ThreadId 659] - Hover request at position 6:11 in file: /home/ggx/Documents/hsProject/Hello/app/Main.hs
2020-10-10 15:46:59.992382316 [ThreadId 670] - finish: CodeAction:PackageExports (took 1.08s)
2020-10-10 15:46:59.992620727 [ThreadId 671] - finish: importLens (took 0.00s)
2020-10-10 15:46:59.992790237 [ThreadId 673] - finish: retrie (took 0.00s)
2020-10-10 15:46:59.99291617 [ThreadId 675] - finish: tactic (took 0.00s)
2020-10-10 15:46:59.993027744 [ThreadId 681] - finish: tactic (took 0.00s)
2020-10-10 15:46:59.993157155 [ThreadId 682] - finish: tactic (took 0.00s)
2020-10-10 15:47:00.325997226 [ThreadId 687] - Definition request at position 6:13 in file: /home/ggx/Documents/hsProject/Hello/app/Main.hs
2020-10-10 15:47:00.471736844 [ThreadId 697] - Definition request at position 6:13 in file: /home/ggx/Documents/hsProject/Hello/app/Main.hs
2020-10-10 15:47:00.69421625 [ThreadId 707] - Definition request at position 6:11 in file: /home/ggx/Documents/hsProject/Hello/app/Main.hs
2020-10-10 15:47:01.428227568 [ThreadId 717] - GhcIde.hover entered (ideLogger)
2020-10-10 15:47:01.428349437 [ThreadId 717] - Hover request at position 6:11 in file: /home/ggx/Documents/hsProject/Hello/app/Main.hs
2020-10-10 15:47:01.766099095 [ThreadId 725] - Definition request at position 6:11 in file: /home/ggx/Documents/hsProject/Hello/app/Main.hs
2020-10-10 15:47:01.886367765 [ThreadId 735] - Definition request at position 6:11 in file: /home/ggx/Documents/hsProject/Hello/app/Main.hs
2020-10-10 15:47:02.246442858 [ThreadId 745] - Definition request at position 6:11 in file: /home/ggx/Documents/hsProject/Hello/app/Main.hs
And I just found another problem. I defined a function in a file, and then changed its type. When using this function in another file, the type is still displayed before modification.
jump/go to definition should work for local package definition but for now it does not for libraries definitions (Data.List, Data.Maybe, Data.ByteString, etc), see https://github.com/haskell/ghcide/issues/61
It works for me too in windows (for local ones), did you tried for local or external defs?
jump/go to definition should work for local package definition but for now it does not for libraries definitions (Data.List, Data.Maybe, Data.ByteString, etc), see haskell/ghcide#61
It works for me too in windows (for local ones), did you tried for local or external defs?
Here is the definition of jump local package, not to the library definitions (Data.List, Data.Maybe, Data.ByteString, etc).
the log:
2020-10-11 10:39:38.123086633 [ThreadId 1524] - Definition request at position 7:15 in file: /home/ggx/Documents/hsProject/Hello/app/Main.hs
2020-10-11 10:39:38.12353521 [ThreadId 1525] - finish: C:GetHieAst (took 0.00s)
2020-10-11 10:39:38.123702342 [ThreadId 1528] - finish: C:GetDependencies (took 0.00s)
2020-10-11 10:39:38.123678615 [ThreadId 7] - <--2--{"result":[],"jsonrpc":"2.0","id":72}
2020-10-11 10:39:38.123815444 [ThreadId 1530] - finish: C:GhcSession (took 0.00s)
2020-10-11 10:39:38.450384465 [ThreadId 5] - ---> {"jsonrpc":"2.0","id":73,"method":"textDocument/definition","params":{"textDocument":{"uri":"file:///home/ggx/Documents/hsProject/Hello/app/Main.hs"},"position":{"line":6,"character":13}}}
2020-10-11 10:39:38.450937848 [ThreadId 1534] - Definition request at position 7:14 in file: /home/ggx/Documents/hsProject/Hello/app/Main.hs
2020-10-11 10:39:38.451420314 [ThreadId 1535] - finish: C:GetHieAst (took 0.00s)
2020-10-11 10:39:38.45153378 [ThreadId 1538] - finish: C:GetDependencies (took 0.00s)
2020-10-11 10:39:38.45160356 [ThreadId 1540] - finish: C:GhcSession (took 0.00s)
2020-10-11 10:39:38.451631418 [ThreadId 7] - <--2--{"result":[],"jsonrpc":"2.0","id":73}
Another problem is that the function type I defined in other local files will be modified later. When the function is used in other files, the type is still before modification.
@GordonGgx Maybe it can be related to #478? After upgrading _HLS_ from 0.4.0 to 0.5.x, jump to definition and descriptions on hover stopped working for me as well, and upgrading stack from 2.3.3 to 2.5.0.1 (release candidate) fixed all the issues for me.
@GordonGgx Maybe it can be related to #478? After upgrading _HLS_ from
0.4.0to0.5.x, jump to definition and descriptions on hover stopped working for me as well, and upgrading stack from2.3.3to2.5.0.1(release candidate) fixed all the issues for me.
well, I am try it.
Only note that it is a difference between got no server response at all, not hover, no goto def, etc, and only miss one of the features.
First one usually is due a problem with server initialization and setup.
@vaclavsvejcar Now that I've switched to stack 2.5.0.1, there is still a problem that I can't jump to the definition.
2020-10-13 13:52:06.609495502 [ThreadId 1627] - Definition request at position 6:12 in file: /home/ggx/Documents/hsProject/Hello/app/Main.hs
2020-10-13 13:52:06.675346291 [ThreadId 1637] - Plugin.makeCodeLens (ideLogger)
2020-10-13 13:52:06.676300076 [ThreadId 1638] - finish: codeLens (took 0.00s)
2020-10-13 13:52:06.677533084 [ThreadId 1644] - finish: (took 0.00s)
2020-10-13 13:52:06.980543218 [ThreadId 1649] - finish: CodeAction (took 0.00s)
2020-10-13 13:52:06.98070041 [ThreadId 1651] - finish: CodeAction:PackageExports (took 0.00s)
2020-10-13 13:52:06.980972943 [ThreadId 1653] - finish: importLens (took 0.00s)
2020-10-13 13:52:06.981244223 [ThreadId 1655] - finish: retrie (took 0.00s)
2020-10-13 13:52:06.981483275 [ThreadId 1657] - finish: tactic (took 0.00s)
2020-10-13 13:52:06.981636781 [ThreadId 1659] - finish: tactic (took 0.00s)
2020-10-13 13:52:06.981751348 [ThreadId 1661] - finish: tactic (took 0.00s)
2020-10-13 13:52:06.990394314 [ThreadId 1666] - Definition request at position 6:13 in file: /home/ggx/Documents/hsProject/Hello/app/Main.hs
2020-10-13 13:52:07.720975074 [ThreadId 1677] - finish: CodeAction (took 0.00s)
2020-10-13 13:52:07.721392364 [ThreadId 1679] - finish: CodeAction:PackageExports (took 0.00s)
2020-10-13 13:52:07.722280926 [ThreadId 1681] - finish: importLens (took 0.00s)
2020-10-13 13:52:07.723195904 [ThreadId 1683] - finish: retrie (took 0.00s)
2020-10-13 13:52:07.724014141 [ThreadId 1685] - finish: tactic (took 0.00s)
2020-10-13 13:52:07.724336335 [ThreadId 1687] - finish: tactic (took 0.00s)
2020-10-13 13:52:07.724642381 [ThreadId 1689] - finish: tactic (took 0.00s)
Can you provide the source of your project in some form (e.g. on github) and what definition you're trying to jump to? So we can attempt to reproduce it.
Can you provide the source of your project in some form (e.g. on github) and what definition you're trying to jump to? So we can attempt to reproduce it.
@googleson78 I just tried a demo template project of 'stack new'. Experience the Haskell language service plug-in of vscode. In template engineering, functions are defined inLib.hs, inMain.hsIs used in. InMain.hs the function (for example: someFunc) used by clicking in cannot jump toLib.hsFunction definition.
From the ghcide readme:
# Limitations to Multi-Component support
2. Cross-component features only work if you have loaded at least one file from each component.
I'm facing the same issue, I cannot jump to definition between files unless I opened (And I assume, hls processed) the file. Is there some issue tracking this limitation and the potential workarounds ?
There is an old issue in ghcide about goto definition to external libraries: https://github.com/haskell/ghcide/issues/61
But i've not found any about remove the limitation for local components. I guess the merge of the hiedb branch in ghcide will do it, as it would let the ide jump to external lib code.
If that is the case the pr https://github.com/haskell/ghcide/pull/898 would close this one too.
There is an old issue in ghcide about goto definition to external libraries: haskell/ghcide#61
But i've not found any about remove the limitation for local components. I guess the merge of the hiedb branch in ghcide will do it, as it would let the ide jump to external lib code.
If that is the case the pr haskell/ghcide#898 would close this one too.
No external libraries. Just local files.



@GordonGgx so you have tried the hiedb branch and it does not have jump to external links definitions?
This happens to me too, macos 10.15.7 just as the images @GordonGgx posted display. I have...
I did:
stack new learn-haskell
cd learn-haskell
stack build
stack run
code . (to open vscode)
That works (it prints "someFunc", which makes sense for the tamplate code), so the repro is the standard? way to start a haskell project I guess.
When I navigate to either Main.hs or Lib.hs for the first time, I see a message pop up:
No cradle found for app/Main.hs. Proceeding with implicit cradle. You should ignore this message, unless you see a 'Multi Cradle: No prefixes matched' error.
Even though it says I should not worry, I think it could be the implicit cradle file... But I don't really get half of what I'm doing, so not sure.
Hope it helps.
@GordonGgx so you have tried the hiedb branch and it does not have jump to external links definitions?
@jneira
Yes, I also found it. It seems that this is not a problem. It is really that I did not configure it well. But I don't understand why we can't get there in one step.
@jneira Now you can jump to the definition in a lib library file. Can you provide a solution to jump to other lib files? Thank you
@GordonGgx Sorry, but i dont understand what is the difference between a "lib library file" and "other lib files".