Haskell-language-server: Navigation between multiple components

Created on 17 Feb 2020  路  9Comments  路  Source: haskell/haskell-language-server

It would be nice to be able to navigate between symbols of different components in a multi cradle setup. Currently it says "no definition found".

I created a simple test project to try this out: https://github.com/backuitist/nix-haskell-multi-package

This issue was originally raised on HIE: https://github.com/haskell/haskell-ide-engine/issues/1656

ghcide enhancement

All 9 comments

I don't know if this belongs here or in another issue: one feature we LOVE in my team with Intellij-Haskell is the capacity to also navigate to library code using "Jump to definition". This is incredibly useful to learn the language and/or learn how to use a library.

Let me know if this is a completely different matter and I'll open another issue

Afaict, this should work now. Both components need to be loaded, e.g. a file from each component has been opened at some point, and then goto cross component works.

We just tested with a coworker today, and none of us succeeded in navigating between 2 components (from a test component to a main one) 馃 Have you successfully made it work on some project?
If so, we can try to pull together a minimal scenario to reproduce... But I'm curious to know if anyone has seen this feature work?

Yeah, I am positive that I've seen this feature work (and I am actively using it). A reproducible example would be great!

I keep look at this thread and thinking there is a mis-communication. Please forgive me if I'm wrong.

The behavior I observe:

  1. Clone the repository.
  2. Edit tta/src/Main.hs
  3. Try to jump to helloBla or hello2's definition.

This fails and that failure is expected.

  1. Edit tta/src/Main.hs
  2. Open in a new tab (or other editor abstraction) tt1/src/Hello1.hs
  3. In Main.hs jump to definition of helloBla.

This works because both tta and tt1 (the source of the definition) have been loaded.

@TomMD don't worry, I was well-aware of this limitation!

I just tested on an empty project and indeed, cross component (from a test to a main component) seems to work fine.

Maybe this doesn't work on our project because we see some typecheck errors (which I will report in other issues, because compilation in shell works just fine)? Could this impact navigation?

@Sir4ur0n

Maybe this doesn't work on our project because we see some typecheck errors

Yeah, that could be a problem

This only works for me if I the language server uses cabal, it doesn't work with stack.

@Sir4ur0n @akshaymankar @backuitist Maybe we should close this one as too generic and open new issues it it does not work for some cases, as the navigation between components should work.

Was this page helpful?
0 / 5 - 0 ratings