haskell / haskell-language-server

Official haskell ide support via language server (LSP). Successor of ghcide & haskell-ide-engine.
Apache License 2.0
2.72k stars 368 forks source link

Add a handler for "Go To Declaration" #3087

Open michaelpj opened 2 years ago

michaelpj commented 2 years ago

At the moment we mostly just use "go to definition", but LSP also has "go to declaration". I think the concept of a declaration does actually make sense in Haskell, namely:

  1. For entities that have a type/kind signature, go to declaration could go to the signature (which can be in a different location)
  2. For typeclass methods, go to declaration could go to the declaration in the class, and go to definition could go to the definitions in the instances
  3. Anything else?
develop7 commented 1 month ago

"go to declaration" could navigate to relevant import statement for a non-local symbol; rarely used, but could be useful

typeclass-wise, there's also "go to implementation" request, which sounds semantically correct