Skip to content

Instantly share code, notes, and snippets.

Last active Apr 29, 2021
What would you like to do?
gsoc proposal

Title Incorporating semantic tokens and call hierarchies into the Haskell Language Server


Version 3.16.0 of the Language Server Protocol (LSP) introduces the notion of semantic tokens and call hierarchies. Semantic tokens allow for coloring of specific tokens in a document by allowing the server to specify their type (ie, function, “static” modifier, type, etc.) Call hierarchies allow programmers to see the incoming and outgoing call sites for functions. Currently, Haskell’s LSP library does not support these two data/request types, and LSP does not surface any information. By the end of this project, I will support these two features in HLS.

Benefits to Community LSP 3.16 is the current version of the language server protocol, and currently, Haskell is on

3.15. There are a total of 6 major features introduced in 3.16, and implementing these two features would be a good start towards 3.16 full compatibility.


Starter tasks (~first week)

  • Clone and compile Haskell’s LSP library
  • Clone and compile HLS
  • Discover how language features are represented in the LSP library. Preliminary research shows me I would need to write modules like DocumentColor.hs but for semantic tokens and call hierarchies. Main deliverables (~next 5 weeks)
  • Write a module for semantic tokens in the LSP library. This would involve thinking about which semantic token types make sense and which don’t.
  • Write a module for call hierarchies in the LSP library.
  • Incorporate the information from semantic tokens in the server.
  • Support Call Hierarchy Incoming Calls on the server. This will involve finding all the call sites of a function.
  • Support Call Hierarchy Outgoing Calls on the server. This will involve finding all the functions our function calls, and returning them as a list.

Stretch goals (~as time allows)

  • Investigate all 3.16 and 3.17 LSP features not present in Haskell’s LSP library. Organize these into issues that the community can then work through in a methodical way.
  • Incorporate as many of these features as I can in the course of GSoC.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment