Skip to content

Plugin in config files #2166

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 8, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions docs/contributing/plugin-tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -381,13 +381,16 @@ generateLens pId uri minImports (L src imp)

## Wrapping up

There's only one code change left to do at this point: "link" the plugin in the `Main` HLS module.
There's only one haskell code change left to do at this point: "link" the plugin in the `Main` HLS module.
However integrating the plugin in haskell-language-server itself will need some changes in config files. The best way is looking for the id (f.e. `hls-tactics-plugin`) of an existing plugin:
- `./cabal*.project` and `./stack*.yaml`: add the plugin package in the `packages` field
- `./haskell-language-server.cabal`: add a conditional block with the plugin package dependency
- `./.github/workflows/test.yml`: add a block to run the test suite of the plugin
- `./.github/workflows/hackage.yml`: add the plugin to the component list to release the plugin package to hackage
- `./*.nix`: add the plugin to nix builds

The full code as used in this tutorial, including imports, can be found in [this Gist](https://gist.github.com/pepeiborra/49b872b2e9ad112f61a3220cdb7db967) as well as in this [branch](https://github.com/pepeiborra/ide/blob/imports-lens/src/Ide/Plugin/ImportLens.hs)

I hope this has given you a taste of how easy and joyful it is to write plugins for HLS.
If you are looking for ideas for contributing, here are some cool ones found in the HLS issue tracker:
- [#205](https://github.com/haskell/haskell-language-server/issues/205) Integrate code synthesis tools (djinn, hoogle+)
- [#258](https://github.com/haskell/haskell-language-server/issues/258) Integration with [Stan](https://github.com/kowainik/stan)
- [#282](https://github.com/haskell/haskell-language-server/issues/282) High-level refactorings (rename, move, extract)
- [#323](https://github.com/haskell/haskell-language-server/issues/323) Case splitting
- https://github.com/haskell/haskell-language-server/issues?q=is%3Aopen+is%3Aissue+label%3A%22type%3A+possible+new+plugin%22