Skip to content

Instantly share code, notes, and snippets.

@VenInf
Last active August 26, 2024 00:41
Show Gist options
  • Save VenInf/ae0d45074742f88db7505659d0eb837b to your computer and use it in GitHub Desktop.
Save VenInf/ae0d45074742f88db7505659d0eb837b to your computer and use it in GitHub Desktop.
Final submission for VenInf's Google Summer of Code Project "Haskell Language Server Cabal Plugin Continuation"

GSoC Submission

Account: VenInf on GitHub

The goal of my Google Summer of Code project was to introduce multiple features and changes to the Cabal Plugin of the Haskell Language Server (HLS for short).

Cabal is a system for building and packaging Haskell libraries and programs, and the Cabal Plugin helps users interact with it from a code editor. For example, it can correct a field in a cabal file, if it was written with typos in them, or even autocomplete it.

Originally I planned to add the following features:

  • Cabal-add integration
  • Completion of local and non-local package names
  • Prompt to add unknown modules to exposed-modules and other-modules sections

We have decided to leave the last two points and focus on other possible features. For example, the last feature entailed considerable complexity, and to implement it, it will be necessary to add functionality of adding modules to the Cabal-add tool, since the task of adding a new module without altering formatting is not trivial.

What's implemented

In the end, we have decided to focus our attention on the following tasks:

Everything is implemented, tested, reviewed, and merged (except for hover, which will be merged on the final day of the program). To see more about the implementation details or see what these additions do "in motion", feel free to follow the provided links above.

Some of the shortcomings

Some aspects of the solutions above aren't perfect due to lack of time or currently available tooling.

The current implementation of go-to definition returns the definition file without highlighting the name of the module. Since parsing the Haskell file will be necessary to find it, I have decided it will be clunky in the implementation, and the highlight is not strictly necessary. But if other contributors find this tradeoff unacceptable, it will be easy to add.

What's next?

I think that my contribution opens up a lot of ways to improve the plugin further:

  • documentation on hover can pick up the required version and provide the link to specific versions of a package
  • documentation on hover for other parts like default-extensions, ghc-options and others
  • Cabal-add can be integrated for other error messages like "missing module" (currently it works only on a "hidden module" error)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment