{"id":13438965,"url":"https://github.com/haskell/haskell-ide-engine","last_synced_at":"2025-10-03T20:31:43.972Z","repository":{"id":55612357,"uuid":"44727837","full_name":"haskell/haskell-ide-engine","owner":"haskell","description":"The engine for haskell ide-integration. Not an IDE","archived":true,"fork":false,"pushed_at":"2020-12-23T06:21:46.000Z","size":6794,"stargazers_count":2370,"open_issues_count":301,"forks_count":206,"subscribers_count":88,"default_branch":"master","last_synced_at":"2025-09-19T22:55:11.868Z","etag":null,"topics":["ghc","haskell","haskell-ide","ide","language-server-protocol","lsp"],"latest_commit_sha":null,"homepage":"","language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/haskell.png","metadata":{"files":{"readme":"README.md","changelog":"Changelog.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-10-22T06:59:33.000Z","updated_at":"2025-09-13T12:04:14.000Z","dependencies_parsed_at":"2022-08-15T04:21:00.109Z","dependency_job_id":null,"html_url":"https://github.com/haskell/haskell-ide-engine","commit_stats":null,"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"purl":"pkg:github/haskell/haskell-ide-engine","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haskell%2Fhaskell-ide-engine","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haskell%2Fhaskell-ide-engine/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haskell%2Fhaskell-ide-engine/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haskell%2Fhaskell-ide-engine/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/haskell","download_url":"https://codeload.github.com/haskell/haskell-ide-engine/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haskell%2Fhaskell-ide-engine/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":276668538,"owners_count":25683073,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-23T02:00:09.130Z","response_time":73,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ghc","haskell","haskell-ide","ide","language-server-protocol","lsp"],"created_at":"2024-07-31T03:01:10.041Z","updated_at":"2025-10-03T20:31:43.529Z","avatar_url":"https://github.com/haskell.png","language":"Haskell","funding_links":[],"categories":["HarmonyOS","Haskell"],"sub_categories":["Windows Manager"],"readme":"# Deprecated\n\nThis repository is now an historical artifact.  It was the original LSP support for haskell, which is now provided by \n\nhttps://github.com/haskell/haskell-language-server\n\n\n# Haskell IDE Engine (HIE)\n\u003cimg src=\"https://github.com/haskell/haskell-ide-engine/raw/master/logos/HIE_logo_512.png\" width=\"256\" style=\"margin:25px;\" align=\"right\"/\u003e\n\n[![License BSD3][badge-license]][license]\n[![CircleCI][badge-circleci]][circleci]\n[![Azure Pipeline][badge-azure-pipeline]][azure-pipeline]\n[![AppVeyor][badge-appveyor]][appveyor]\n[![Open Source Helpers](https://www.codetriage.com/haskell/haskell-ide-engine/badges/users.svg)](https://www.codetriage.com/haskell/haskell-ide-engine)\n\n[badge-license]: https://img.shields.io/badge/license-BSD3-green.svg?dummy\n[license]: https://github.com/haskell/haskell-ide-engine/blob/master/LICENSE\n[badge-circleci]: https://img.shields.io/circleci/project/github/haskell/haskell-ide-engine/master.svg\n[circleci]: https://circleci.com/gh/haskell/haskell-ide-engine/\n[badge-appveyor]: https://ci.appveyor.com/api/projects/status/6hit7mxvgdrao3q0?svg=true\n[appveyor]: https://ci.appveyor.com/project/Bubba/haskell-ide-engine-74xec\n[azure-pipeline]: https://dev.azure.com/hvriedel/hvriedel/_build?definitionId=1\u0026_a=summary\n[badge-azure-pipeline]: https://dev.azure.com/hvriedel/hvriedel/_apis/build/status/haskell.haskell-ide-engine?branchName=master\n\nThis project aims to be __the universal interface__ to __a growing number of Haskell tools__, providing a __fully-featured [Language Server Protocol](https://github.com/Microsoft/language-server-protocol/blob/master/protocol.md) server__ for editors and IDEs that require Haskell-specific functionality.\n\n- [Haskell IDE Engine (HIE)](#haskell-ide-engine-hie)\n  - [Features](#features)\n  - [Installation](#installation)\n    - [Installation with Nix](#installation-with-nix)\n    - [Installation on Arch Linux](#installation-on-arch-linux)\n    - [Installation with GHC and HIE as a VS Code Devcontainer](#installation-with-ghc-and-hie-as-a-vs-code-devcontainer)\n    - [Installation from source](#installation-from-source)\n      - [Common pre-requirements](#common-pre-requirements)\n      - [Linux-specific pre-requirements](#linux-specific-pre-requirements)\n      - [Windows-specific pre-requirements](#windows-specific-pre-requirements)\n      - [Download the source code](#download-the-source-code)\n      - [Building](#building)\n        - [Install via cabal](#install-via-cabal)\n        - [Install cabal using stack](#install-cabal-using-stack)\n        - [Install specific GHC Version](#install-specific-ghc-version)\n        - [Multiple versions of HIE (optional)](#multiple-versions-of-hie-optional)\n  - [Configuration](#configuration)\n  - [Project Configuration](#project-configuration)\n  - [Editor Integration](#editor-integration)\n    - [Using HIE with VS Code](#using-hie-with-vs-code)\n      - [Using VS Code with Nix](#using-vs-code-with-nix)\n    - [Using HIE with Sublime Text](#using-hie-with-sublime-text)\n    - [Using HIE with Vim or Neovim](#using-hie-with-vim-or-neovim)\n      - [Coc](#coc)\n      - [LanguageClient-neovim](#languageclient-neovim)\n        - [vim-plug](#vim-plug)\n        - [Clone the LanguageClient-neovim repo](#clone-the-languageclient-neovim-repo)\n        - [Sample `~/.vimrc`](#sample-vimrc)\n    - [Using HIE with Atom](#using-hie-with-atom)\n    - [Using HIE with Emacs](#using-hie-with-emacs)\n    - [Using HIE with Spacemacs](#using-hie-with-spacemacs)\n    - [Using HIE with Oni](#using-hie-with-oni)\n  - [Docs on hover/completion](#docs-on-hovercompletion)\n  - [Contributing](#contributing)\n    - [Planned Features](#planned-features)\n    - [It's time to join the project!](#its-time-to-join-the-project)\n  - [Documentation](#documentation)\n    - [Architecture](#architecture)\n  - [Troubleshooting](#troubleshooting)\n    - [Emacs](#emacs)\n      - [Parse errors, file state going out of sync](#parse-errors-file-state-going-out-of-sync)\n      - [`emacs-direnv` loads environment too late](#emacs-direnv-loads-environment-too-late)\n    - [DYLD on macOS](#dyld-on-macos)\n    - [macOS: Got error while installing GHC 8.6.1 or 8.6.2 - dyld: Library not loaded: /usr/local/opt/gmp/lib/libgmp.10.dylib](#macos-got-error-while-installing-ghc-861-or-862---dyld-library-not-loaded-usrlocaloptgmpliblibgmp10dylib)\n    - [macOS: Got error while processing diagnostics: unable to load package `integer-gmp-1.0.2.0`](#macos-got-error-while-processing-diagnostics-unable-to-load-package-integer-gmp-1020)\n    - [cannot satisfy -package-id \\\u003cpackage\\\u003e](#cannot-satisfy--package-id-package)\n      - [Is \\\u003cpackage\\\u003e base-x?](#is-package-base-x)\n      - [Is there a hash (#) after \\\u003cpackage\\\u003e?](#is-there-a-hash--after-package)\n      - [Otherwise](#otherwise)\n    - [Liquid Haskell](#liquid-haskell)\n    - [Profiling `haskell-ide-engine`.](#profiling-haskell-ide-engine)\n      - [Using `ghc-events-analyze`](#using-ghc-events-analyze)\n\n## Features\n\n - Supports plain GHC projects, cabal projects(sandboxed and non sandboxed) and stack projects\n - Fast due to caching of compile info\n - Uses LSP, so should be easy to integrate with a wide selection of editors\n - Diagnostics via hlint and GHC warnings/errors\n\n   ![Diagnostics](https://i.imgur.com/1vqm4eF.gif)\n\n - Code actions and quick fixes via apply-refact\n\n   ![Apply Refact](https://i.imgur.com/dBrSi5F.gif)\n\n - Type information and documentation(via haddock) on hover\n\n   ![Hover](https://i.imgur.com/AcvYROv.gif)\n\n - Jump to definition\n\n   ![Find Def](https://i.imgur.com/kmCU2Bz.gif)\n\n - List all top level definitions\n\n   ![Doc Symbols](https://i.imgur.com/GErcYqp.gif)\n\n - Highlight references in document\n\n   ![Doc Highlight](https://i.imgur.com/YLjHs2s.gif)\n\n - Completion\n\n   ![Completion](https://i.imgur.com/wR6IJ7M.gif)\n\n - Formatting via brittany\n\n   ![Formatting](https://i.imgur.com/cqZZ8HC.gif)\n\n - Renaming via HaRe (NOTE: HaRe is temporarily disabled)\n\n   ![Renaming](https://i.imgur.com/z03G2a5.gif)\n\n - Add packages to cabal and hpack package files\n\n   ![Adding package to hpack](https://user-images.githubusercontent.com/2488460/43036067-20ae5964-8cf2-11e8-9951-4fd849b3f735.gif)\n   ![Adding import \u0026 deps](https://user-images.githubusercontent.com/1387653/40287051-b6f987fe-5c5f-11e8-980f-ed7bfa1b2aec.gif)\n\n - Typo quick fixes\n\n   ![Quick fixes](https://user-images.githubusercontent.com/2488460/43036093-746ae176-8cf2-11e8-8b2d-59799b21c283.gif)\n\n - Add missing imports (via hsimport)\n\n   ![Missing imports](https://user-images.githubusercontent.com/2488460/43036113-9bb5d5b0-8cf2-11e8-8e32-20952378cf2b.gif)\n\n\n## Installation\n\n### Installation with Nix\n\nFollow the instructions at https://github.com/Infinisil/all-hies\n\n\n### Installation on Arch Linux\n\nA [haskell-ide-engine](https://aur.archlinux.org/packages/haskell-ide-engine/) package is available on the AUR.\n\nInstall it using [Aura](https://github.com/aurapm/aura):\n\n```\n# aura -A haskell-ide-engine\n```\n\nTo change which GHC versions are supported by HIE, use\n\n```\n# aura -A --hotedit haskell-ide-engine\n```\n\nand modify the value of `_enabled_ghc_versions`.\n\nReducing the number of supported GHC versions makes HIE compile faster.\n\n\n### Installation with GHC and HIE as a VS Code Devcontainer\n\nVS Code provides the ability to develop applications inside of a Docker container (called _Devcontainers_)\nhttps://code.visualstudio.com/docs/remote/containers\n\nThere is a community Devcontainer setup which installs and configures GHC + HIE 8.6.5 and the necessary VS Code extensions to integrate them into the editor.\n\nhttps://github.com/hmemcpy/haskell-hie-devcontainer\n\n\n### Installation from source\n\nTo install HIE, you need stack version \u003e= 2.1.1.\n\nHIE builds from source code, so there's a couple of extra steps.\n\n#### Common pre-requirements\n\n* `stack` must be in your PATH\n* `git` must be in your PATH\n* Stack local bin directory must be in your PATH. Get it with `stack path --local-bin`\n\nTip: you can quickly check if some command is in your path by running the command.\nIf you receive some meaningful output instead of \"command not found\"-like message\nthen it means you have the command in PATH.\n\n#### Linux-specific pre-requirements\n\nOn Linux you will need install a couple of extra libraries (for Unicode ([ICU](http://site.icu-project.org/)) and [NCURSES](https://www.gnu.org/software/ncurses/)):\n\n**Debian 9/Ubuntu 18.04 or earlier**:\n\n```bash\nsudo apt install libicu-dev libtinfo-dev libgmp-dev\n```\n\n**Debian 10/Ubuntu 18.10 or later**:\n\n```bash\nsudo apt install libicu-dev libncurses-dev libgmp-dev # also zlib1g-dev if not installed\n```\n\n**Fedora**:\n\n```bash\nsudo dnf install libicu-devel ncurses-devel # also zlib-devel if not already installed\n```\n\n#### Windows-specific pre-requirements\n\nIn order to avoid problems with long paths on Windows you can do either one of the following:\n\n1. Clone the `haskell-ide-engine` to a short path, for example the root of your logical drive (e.g. to\n   `C:\\hie`). If this doesn't work or you want to use a longer path, try the second option.\n\n2. If the `Local Group Policy Editor` is available on your system, go to: `Local Computer Policy -\u003e Computer Configuration -\u003e Administrative Templates -\u003e System -\u003e Filesystem` set `Enable Win32 long paths` to `Enabled`. If you don't have the policy editor you can use regedit by using the following instructions [here](https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file#enable-long-paths-in-windows-10-version-1607-and-later). You also need to configure git to allow longer paths by using unicode paths. To set this for all your git repositories use `git config --system core.longpaths true` (you probably need an administrative shell for this) or for just this one repository use `git config core.longpaths true`.\n\nIn addition make sure `hie.exe` is not running by closing your editor, otherwise in case of an upgrade the executable can not be installed.\n\n#### Download the source code\n\n```bash\ngit clone https://github.com/haskell/haskell-ide-engine --recurse-submodules\ncd haskell-ide-engine\n```\n\n#### Building\n\nUses the [shake](https://shakebuild.com/) build system for predictable builds.\n\nNote, on first invocation of the build script, a GHC is being installed for execution.\nThe GHC used for the `install.hs` can be adjusted in `shake.yaml` by using a different resolver.\n\nAvailable commands can be seen with:\n\n```bash\nstack ./install.hs help\n```\n\nRemember, this will take time to download a Stackage-LTS and an appropriate GHC. However, afterwards all commands should work as expected.\n\n##### Install via cabal\n\nThe install-script can be invoked via `cabal` instead of `stack` with the command\n\n```bash\ncabal v2-run ./install.hs --project-file install/shake.project \u003ctarget\u003e\n```\n\nor using the existing alias script\n\n```bash\n./cabal-hie-install \u003ctarget\u003e\n```\n\nRunning the script with cabal on windows requires a cabal version greater or equal to `3.0.0.0`.\n\nFor brevity, only the `stack`-based commands are presented in the following sections.\n\n##### Install specific GHC Version\n\nInstall hie for the latest available and supported GHC version (and hoogle docs):\n\n```bash\nstack ./install.hs hie\n```\n\nInstall hie for a specific GHC version (and hoogle docs):\n\n```bash\nstack ./install.hs hie-8.6.5\nstack ./install.hs data\n```\n\nThe Haskell IDE Engine can also be built with `cabal v2-build` instead of `stack build`.\nThis has the advantage that you can decide how the GHC versions have been installed.\nTo see what GHC versions are available, the command `cabal-hie-install ghcs` can be used.\nIt will list all GHC versions that are on the path and their respective installation directory.\nIf you think, this list is incomplete, you can try to modify the PATH variable, such that the executables can be found.\nNote, that the targets `hie` and `data` depend on the found GHC versions.\nThey install Haskell IDE Engine only for the found GHC versions.\n\nAn example output is:\n\n```bash\n\u003e cabal-hie-install ghcs\n******************************************************************\nFound the following GHC paths:\nghc-8.4.4: /opt/bin/ghc-8.4.4\nghc-8.6.2: /opt/bin/ghc-8.6.2\n\n******************************************************************\n```\n\nIf your desired ghc has been found, you use it to install Haskell IDE Engine.\n\n```bash\ncabal-hie-install hie-8.4.4\ncabal-hie-install data\n```\n\nIn general, executing targets with `cabal` instead of `stack` have the same behaviour, except they do not install a GHC if it is missing but fail.\n\n##### Multiple versions of HIE (optional)\n\nIf you installed multiple versions of HIE then you will need to use a wrapper script.\nWrapper script will analyze your project, find suitable version of HIE and launch it.\nEnable it by editing VS Code settings like this:\n\n```json\n\"haskell.useCustomHieWrapper\": true,\n\"haskell.useCustomHieWrapperPath\": \"hie-wrapper\",\n```\n\n## Configuration\nThere are some settings that can be configured via a `settings.json` file:\n\n```\n{\n    \"haskell\": {\n        \"hlintOn\": Boolean,\n        \"maxNumberOfProblems\": Number\n        \"diagnosticsDebounceDuration\" : Number\n        \"liquidOn\"                    : Bool (default False)\n        \"completionSnippetsOn\"        : Bool (default True)\n        \"formatOnImportOn\"            : Bool (default True)\n        \"formattingProvider\"          : String (default \"brittany\",\n                                                alternate \"floskell\")\n    }\n}\n```\n\n- VS Code: These settings will show up in the settings window\n- LanguageClient-neovim: Create this file in `$projectdir/.vim/settings.json` or set `g:LanguageClient_settingsPath`\n\n## Project Configuration\n\n**For a full explanation of possible configurations, refer to [hie-bios/README](https://github.com/mpickering/hie-bios/blob/master/README.md).**\n\nHIE will attempt to automatically detect your project configuration and set up\nthe environment for GHC.\n\n| `cabal.project` | `stack.yaml` | `*.cabal` | Project selected |\n|-----------------|--------------|-----------|------------------|\n| ✅              | -            | -         | Cabal v2         |\n| ❌              | ✅           | -         | Stack            |\n| ❌              | ❌           | ✅        | Cabal (v2 or v1) |\n| ❌              | ❌           | ❌        | None             |\n\nHowever, you can also place a `hie.yaml` file in the root of the workspace to\n**explicitly** describe how to setup the environment. For example, to state that\nyou want to use `stack` then the configuration file would look like:\n\n```yaml\ncradle:\n  stack:\n    component: \"haskell-ide-engine:lib\"\n```\n\nIf you use `cabal` then you probably need to specify which component you want\nto use.\n\n```yaml\ncradle:\n  cabal:\n    component: \"lib:haskell-ide-engine\"\n```\n\nIf you have a project with multiple components, you can use a cabal-multi\ncradle:\n\n```yaml\ncradle:\n  cabal:\n    - path: \"./test/dispatcher/\"\n      component: \"test:dispatcher-test\"\n    - path: \"./test/functional/\"\n      component: \"test:func-test\"\n    - path: \"./test/unit/\"\n      component: \"test:unit-test\"\n    - path: \"./hie-plugin-api/\"\n      component: \"lib:hie-plugin-api\"\n    - path: \"./app/MainHie.hs\"\n      component: \"exe:hie\"\n    - path: \"./app/HieWrapper.hs\"\n      component: \"exe:hie-wrapper\"\n    - path: \"./\"\n      component: \"lib:haskell-ide-engine\"\n```\n\nEquivalently, you can use stack:\n\n```yaml\ncradle:\n  stack:\n    - path: \"./test/dispatcher/\"\n      component: \"haskell-ide-engine:test:dispatcher-test\"\n    - path: \"./test/functional/\"\n      component: \"haskell-ide-engine:test:func-test\"\n    - path: \"./test/unit/\"\n      component: \"haskell-ide-engine:test:unit-test\"\n    - path: \"./hie-plugin-api/\"\n      component: \"hie-plugin-api:lib\"\n    - path: \"./app/MainHie.hs\"\n      component: \"haskell-ide-engine:exe:hie\"\n    - path: \"./app/HieWrapper.hs\"\n      component: \"haskell-ide-engine:exe:hie-wrapper\"\n    - path: \"./\"\n      component: \"haskell-ide-engine:lib\"\n```\n\nOr you can explicitly state the program which should be used to collect\nthe options by supplying the path to the program. It is interpreted\nrelative to the current working directory if it is not an absolute path.\n\n```yaml\ncradle:\n  bios:\n    program: \".hie-bios\"\n```\n\nThe complete configuration is a subset of\n\n```yaml\ncradle:\n  cabal:\n    component: \"optional component name\"\n  stack:\n    component: \"optional component name\"\n  bios:\n    program: \"program to run\"\n    dependency-program: \"optional program to run\"\n  direct:\n    arguments: [\"list\",\"of\",\"ghc\",\"arguments\"]\n  default:\n  none:\n\ndependencies:\n  - someDep\n```\n\nThere is also support for multiple cradles in a single `hie.yaml`. An example configuration for Haskell IDE Engine:\n\n```yaml\ncradle:\n  multi:\n    - path: ./test/dispatcher/\n      config:\n        cradle:\n          cabal:\n            component: \"test:dispatcher-test\"\n    - path: ./test/functional/\n      config:\n        cradle:\n          cabal:\n            component: \"test:func-test\"\n    - path: ./test/unit/\n      config:\n        cradle:\n          cabal:\n            component: \"test:unit-test\"\n    - path: ./hie-plugin-api/\n      config:\n        cradle:\n          cabal:\n            component: \"lib:hie-plugin-api\"\n    - path: ./app/MainHie.hs\n      config:\n        cradle:\n          cabal:\n            component: \"exe:hie\"\n    - path: ./app/HieWrapper.hs\n      config:\n        cradle:\n          cabal:\n            component: \"exe:hie-wrapper\"\n    - path: ./\n      config:\n        cradle:\n          cabal:\n            component: \"lib:haskell-ide-engine\"\n```\n\n## Editor Integration\n\nNote to editor integrators: there is now a `hie-wrapper` executable, which is installed alongside the `hie` executable.  When this is invoked in the project root directory, it attempts to work out the GHC version used in the project, and then launch the matching `hie` executable.\n\nAll of the editor integrations assume that you have already installed HIE (see above) and that `stack` put the `hie` binary in your path (usually `~/.local/bin` on linux and macOS).\n\n### Using HIE with VS Code\n\nInstall from\n[the VSCode marketplace](https://marketplace.visualstudio.com/items?itemName=alanz.vscode-hie-server), or manually from the repository [vscode-hie-server](https://github.com/alanz/vscode-hie-server).\n\n#### Using VS Code with Nix\n\n`.config/nixpkgs/config.nix` sample:\n\n``` nix\nwith import \u003cnixpkgs\u003e {};\n\nlet\n  hie = (import (fetchFromGitHub {\n                   owner=\"domenkozar\";\n                   repo=\"hie-nix\";\n                   rev=\"e3113da\";\n                   sha256=\"05rkzjvzywsg66iafm84xgjlkf27yfbagrdcb8sc9fd59hrzyiqk\";\n                 }) {}).hie84;\nin\n{\n  allowUnfree = true;\n  packageOverrides = pkgs: rec {\n\n    vscode = pkgs.vscode.overrideDerivation (old: {\n      postFixup = ''\n        wrapProgram $out/bin/code --prefix PATH : ${lib.makeBinPath [hie]}\n      '';\n    });\n\n  };\n}\n```\n\n### Using HIE with Sublime Text\n\n* Make sure HIE is installed (see above) and that the directory stack put the `hie` binary in is in your path\n  * (usually `~/.local/bin` on unix)\n* Install [LSP](https://packagecontrol.io/packages/LSP) using [Package Control](https://packagecontrol.io/)\n* From Sublime Text, press Command+Shift+P and search for Preferences: LSP Settings\n* Paste in these settings. Make sure to change the command path to your `hie`\n\n```\n{\n\"clients\": {\n  \"haskell-ide-engine\": {\n    \"command\": [\"hie\", \"--lsp\"],\n    \"scopes\": [\"source.haskell\"],\n    \"syntaxes\": [\"Packages/Haskell/Haskell.sublime-syntax\"],\n    \"languageId\": \"haskell\",\n  },\n},\n}\n```\n\nNow open a Haskell project with Sublime Text. You should have these features available to you:\n\n1. Errors are underlined in red\n2. LSP: Show Diagnostics will show a list of hints and errors\n3. LSP: Format Document will prettify the file\n\n### Using HIE with Vim or Neovim\n\nAs above, make sure HIE is installed.\nThen you can use [Coc](https://github.com/neoclide/coc.nvim), [LanguageClient-neovim](https://github.com/autozimu/LanguageClient-neovim)\nor any other vim Langauge server protocol client.\nCoc is recommend since it is the only complete LSP implementation for Vim and Neovim and offers snippets and floating documentation out of the box.\n\n#### Coc\nFollow Coc's [installation instructions](https://github.com/neoclide/coc.nvim),\nThen issue `:CocConfig` and add the following to your Coc config file.\n\n```jsonc\n\"languageserver\": {\n  \"haskell\": {\n    \"command\": \"hie-wrapper\",\n    \"args\": [\"--lsp\"],\n    \"rootPatterns\": [\n      \"*.cabal\",\n      \"stack.yaml\",\n      \"cabal.project\",\n      \"package.yaml\"\n    ],\n    \"filetypes\": [\n      \"hs\",\n      \"lhs\",\n      \"haskell\"\n    ],\n    \"initializationOptions\": {\n      \"haskell\": {\n      }\n    }\n  }\n}\n```\n\n#### LanguageClient-neovim\n\n##### vim-plug\nIf you use [vim-plug](https://github.com/junegunn/vim-plug), then you can do this by e.g.,\nincluding the following line in the Plug section of your `init.vim` or `~/.vimrc`:\n\n```\nPlug 'autozimu/LanguageClient-neovim', {\n    \\ 'branch': 'next',\n    \\ 'do': './install.sh'\n    \\ }\n```\n\nand issuing a `:PlugInstall` command within Neovim or Vim.\n\n##### Clone the LanguageClient-neovim repo\nAs an alternative to using [vim-plug](https://github.com/junegunn/vim-plug) shown above, clone [LanguageClient-neovim](https://github.com/autozimu/LanguageClient-neovim)\ninto `~/.vim/pack/XXX/start/`, where `XXX` is just a name for your \"plugin suite\".\n\n##### Sample `~/.vimrc`\n\n```vim\nset rtp+=~/.vim/pack/XXX/start/LanguageClient-neovim\nlet g:LanguageClient_serverCommands = { 'haskell': ['hie-wrapper', '--lsp'] }\n```\n\nYou'll probably want to add some mappings for common commands:\n\n```vim\nnnoremap \u003cF5\u003e :call LanguageClient_contextMenu()\u003cCR\u003e\nmap \u003cLeader\u003elk :call LanguageClient#textDocument_hover()\u003cCR\u003e\nmap \u003cLeader\u003elg :call LanguageClient#textDocument_definition()\u003cCR\u003e\nmap \u003cLeader\u003elr :call LanguageClient#textDocument_rename()\u003cCR\u003e\nmap \u003cLeader\u003elf :call LanguageClient#textDocument_formatting()\u003cCR\u003e\nmap \u003cLeader\u003elb :call LanguageClient#textDocument_references()\u003cCR\u003e\nmap \u003cLeader\u003ela :call LanguageClient#textDocument_codeAction()\u003cCR\u003e\nmap \u003cLeader\u003els :call LanguageClient#textDocument_documentSymbol()\u003cCR\u003e\n```\n\nUse \u003ckbd\u003eCtrl+x\u003c/kbd\u003e\u003ckbd\u003eCtrl+o\u003c/kbd\u003e (`\u003cC-x\u003e\u003cC-o\u003e`) to open up the auto-complete menu,\nor for asynchronous auto-completion, follow the setup instructions on\n[LanguageClient](https://github.com/autozimu/LanguageClient-neovim).\n\nIf you'd like diagnostics to be highlighted, add a highlight group for `ALEError`/`ALEWarning`/`ALEInfo`,\nor customize ` g:LanguageClient_diagnosticsDisplay`:\n\n```vim\nhi link ALEError Error\nhi Warning term=underline cterm=underline ctermfg=Yellow gui=undercurl guisp=Gold\nhi link ALEWarning Warning\nhi link ALEInfo SpellCap\n```\n\nIf you're finding that the server isn't starting at the correct project root,\nit may also be helpful to also specify root markers:\n\n```vim\nlet g:LanguageClient_rootMarkers = ['*.cabal', 'stack.yaml']\n```\n\n### Using HIE with Atom\n\nMake sure HIE is installed, then install the two Atom packages [atom-ide-ui](https://atom.io/packages/atom-ide-ui) and [ide-haskell-hie](https://atom.io/packages/ide-haskell-hie),\n\n```bash\n$ apm install language-haskell atom-ide-ui ide-haskell-hie\n```\n\n### Using HIE with Emacs\n\nInstall HIE along with the following emacs packages:\n\n[lsp-mode](https://github.com/emacs-lsp/lsp-mode)\n[lsp-ui](https://github.com/emacs-lsp/lsp-ui)\n[lsp-haskell](https://github.com/emacs-lsp/lsp-haskell)\n\nMake sure to follow the instructions in the README of each of these packages.\n\n### Using HIE with Spacemacs\n\nInstall HIE, and then add the following to your `.spacemacs` config,\n\n```lisp\n(defun dotspacemacs/layers ()\n  \"...\"\n  (setq-default\n   ;; ...\n   dotspacemacs-configuration-layers\n   '(\n     (haskell :variables haskell-completion-backend 'lsp)\n     lsp\n     )\n    ))\n```\n\nNow you should be able to use HIE in Spacemacs.\n\n### Using HIE with Oni\n\n[Oni](https://www.onivim.io/) (a Neovim GUI) added built-in support for HIE, using stack, in [#1918](https://github.com/onivim/oni/pull/1918/files). If you need to change the configuration for HIE, you can overwrite the following settings in your `~/.config/oni/config.tsx` file (accessible via the command palette and `Configuration: Edit User Config`),\n\n```js\nexport const configuration = {\n  \"language.haskell.languageServer.command\": \"stack\",\n  \"language.haskell.languageServer.arguments\": [\"exec\", \"--\", \"hie\"],\n  \"language.haskell.languageServer.rootFiles\": [\".git\"],\n  \"language.haskell.languageServer.configuration\": {},\n}\n```\n\n## Docs on hover/completion\n\nHIE supports fetching docs from haddock on hover. It will fallback on using a hoogle db(generally located in ~/.hoogle on linux)\nif no haddock documentation is found.\n\nTo generate haddock documentation for stack projects:\n\n```bash\n$ cd your-project-directory\n$ stack haddock --keep-going\n```\n\nTo enable documentation generation for cabal projects, add the following to your ~/.cabal/config\n\n```\ndocumentation: True\n```\n\nTo generate a hoogle database that hie can use\n\n```bash\n$ cd haskell-ide-engine\n$ stack --stack-yaml=\u003cstack.yaml you used to build hie\u003e exec hoogle generate\n```\n\nOr you can set the environment variable `HIE_HOOGLE_DATABASE` to specify a specific database.\n\n## Contributing\n\nPlease see the [note above](#integration-with-ghcide-the-new-haskell-ide) about the new `haskell-language-server` project.\n\nThis project is not started from scratch:\n\n1. See why [we should supersede previous tools](/docs/Challenges.md)\n2. Check the [list of existing tools and functionality](/docs/Tools.md)\n3. See more [other tools and IDEs for inspiration](/docs/Inspirations.md)\n\n\n### It's time to join the project!\n\n:heart: Haskell tooling dream is near, we need your help! :heart:\n\n - Register in [our google group mailing list](https://groups.google.com/forum/#!forum/haskell-ide).\n - Join [our IRC channel](https://webchat.freenode.net/?channels=haskell-ide-engine) at `#haskell-ide-engine` on `freenode`.\n - Fork this repo and hack as much as you can.\n - Ask @alanz or @hvr to join the project.\n\n### Hacking on haskell-ide-engine\n\nHaskell-ide-engine can be used on its own project.  We have supplied\npreset samples of `hie.yaml` files for stack and cabal, simply copy\nthe appropriate template to `hie.yaml` and it shoule work.\n\n- `hie.yaml.cbl` for cabal\n- `hie.yaml.stack` for stack\n\n## Documentation\n\nAll the documentation is in [the docs folder](/docs) at the root of this project.\n\n### Architecture\n\nHave a look at\n\n - the [Architecture discussion](docs/Architecture.md),\n - [Protocol discussion](docs/Protocol.md) and\n - [Design discussion](docs/Design.md).\n\n## Troubleshooting\n\n### Emacs\n\n#### Parse errors, file state going out of sync\nWith the `lsp-mode` client for Emacs, it seems that the document can very easily get out of sync between, which leads to parse errors being displayed. To fix this, enable full document synchronization with\n\n```elisp\n(setq lsp-document-sync-method 'full)\n```\n\n#### [`emacs-direnv`](https://github.com/wbolster/emacs-direnv) loads environment too late\n`emacs-direnv` sometimes loads the environment too late, meaning `lsp-mode` won't be able to find correct GHC/cabal versions. To fix this, add a direnv update hook *after* adding the lsp hook for `haskell-mode` (meaning the direnv hook is executed first, because hooks are LIFO):\n```elisp\n(add-hook 'haskell-mode-hook 'lsp)\n(add-hook 'haskell-mode-hook 'direnv-update-environment)\n```\n\n### DYLD on macOS\n\nIf you hit a problem that looks like ```can't load .so/.DLL for: libiconv.dylib (dlopen(libiconv.dylib, 5): image not found)```, it means that libraries cannot be found in the library path. We can hint where to look for them and append more paths to `DYLD_LIBRARY_PATH`.\n\n```\nexport DYLD_LIBRARY_PATH=\"$DYLD_LIBRARY_PATH:/usr/lib:/usr/local/lib\"\n```\n\nOn practice `/usr/local/lib` is full of dylibs linked by `brew`. After you amend `DYLD_LIBRARY_PATH`, some of the previously compiled application might not work and yell about incorrect linking, for example, `dyld: Symbol not found: __cg_jpeg_resync_to_restart`. You may need to look up where it comes from and remove clashing links, in this case it were clashing images libs:\n\n```sh\n$ brew unlink libjpeg\n$ brew unlink libtiff\n$ brew unlink libpng\n```\n\nRecompile.\n\n### macOS: Got error while installing GHC 8.6.1 or 8.6.2 - dyld: Library not loaded: /usr/local/opt/gmp/lib/libgmp.10.dylib\n\nThese builds have a dependency on [homebrew](https://brew.sh)'s `gmp` library. Install with brew: `brew install gmp`.\n[Should be fixed in GHC 8.6.3.](https://ghc.haskell.org/trac/ghc/ticket/15769)\n\n### macOS: Got error while processing diagnostics: unable to load package `integer-gmp-1.0.2.0`\n\n[Rename the file](https://github.com/alanz/vscode-hie-server/issues/89#issuecomment-398212122) at `~/.stack/programs/x86_64-osx/ghc-8.4.3/lib/ghc-8.4.3/integer-gmp-1.0.2.0/HSinteger-gmp-1.0.2.0.o` to a temporary name.\n[Should be fixed in GHC 8.8.1.](https://ghc.haskell.org/trac/ghc/ticket/15105)\n\n\n### cannot satisfy -package-id \\\u003cpackage\\\u003e\n\n#### Is \\\u003cpackage\\\u003e base-x?\nMake sure that the GHC version of HIE matches the one of the project. After that run\n```\n$ cabal configure\n```\n\nand then restart HIE (e.g. by restarting your editor).\n\n#### Is there a hash (#) after \\\u003cpackage\\\u003e?\nDelete any `.ghc.environment*` files in your project root and try again. (At the time of writing, cabal new-style projects are not supported with ghc-mod)\n\n#### Otherwise\nTry running `cabal update`.\n\n### Liquid Haskell\n\nLiquid Haskell requires an SMT solver on the path. We do not take care of installing one, thus, Liquid Haskell will not run until one is installed.\nThe recommended SMT solver is [z3](https://github.com/Z3Prover/z3). To run the tests, it is also required to have an SMT solver on the path, otherwise the tests will fail for Liquid Haskell.\n\n### Profiling `haskell-ide-engine`.\n\nIf you think `haskell-ide-engine` is using a lot of memory then the most useful\nthing you can do is prepare a profile of the memory usage whilst you're using\nthe program.\n\n1. Add `profiling: True` to the cabal.project file of `haskell-ide-engine`\n2. `cabal new-build hie`\n3. (IMPORTANT) Add `profiling: True` to the `cabal.project` file of the project you want to profile.\n4. Make a wrapper script which calls the `hie` you built in step 2 with the additional options `+RTS -hd -l-au`\n5. Modify your editor settings to call this wrapper script instead of looking for `hie` on the path\n6. Try using `h-i-e` as normal and then process the `*.eventlog` which will be created using  [`eventlog2html`](http://hackage.haskell.org/package/eventlog2html).\n7. Repeat the process again using different profiling options if you like.\n\n#### Using `ghc-events-analyze`\n\n`haskell-ide-engine` contains the necessary tracing functions to work with [`ghc-events-analyze`](http://www.well-typed.com/blog/2014/02/ghc-events-analyze/). Each\nrequest which is made will emit an event to the eventlog when it starts and finishes. This way you\ncan see if there are any requests which are taking a long time to complete or are blocking.\n\n1. Make sure that `hie` is linked with the `-eventlog` option. This can be achieved by adding the flag\nto the `ghc-options` field in the cabal file.\n2. Run `hie` as normal but with the addition of `+RTS -l`. This will produce an eventlog called `hie.eventlog`.\n3. Run `ghc-events-analyze` on the `hie.eventlog` file to produce the rendered SVG. Warning, this might take a while and produce a big SVG file.\n\nThe default options for `ghc-events-analyze` will produce quite a wide chart which is difficult to view. You can try using less buckets in order\nto make the chart quicker to generate and faster to render.\n\n```\nghc-events-analyze hie.eventlog -b 100\n```\n\nThis support is similar to the logging capabilities [built into GHC](https://www.haskell.org/ghc/blog/20190924-eventful-ghc.html).\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhaskell%2Fhaskell-ide-engine","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhaskell%2Fhaskell-ide-engine","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhaskell%2Fhaskell-ide-engine/lists"}