haskell / haskell-language-server

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

Add local definitions to outline #4312

Open sgillespie opened 2 weeks ago

sgillespie commented 2 weeks ago

Addresses #3628. Adds all local symbols (functions/vars) as children to function document symbols.

There are a few potential issues:

  1. The position/range points to the toplevel function
  2. getFuzzyScope might be abused here (should I create another function like getLocalScope?)

Thoughts?

sgillespie commented 2 weeks ago

This is what the outline looks like in emacs (via imenu-list)

ss-20240611-103517

For a bit of extra context, here is one of the definitions:

f :: a -> a
f x = g x
  where
    g = id
    h = id
michaelpj commented 1 week ago

A test case I'd like to see

f 1 = g
  where g = 2
f _ = g 
  where g = 3