Run npm install in the project root to install the development dependencies.
You can also package up the extension with
npm installto install the dependenciesnpm run packagewhich creates an extension package athaskell-<version>.vsix.
Note: that if you get errors running vsce package, it might help running npm run pretest directly, since that gives the actual error output of the TypeScript compilation.
- Launch VS Code, press
File>Open Folder, open thevscode-haskellfolder; - press
F5to open a new window with thevscode-haskellloaded (this will overwrite existing ones, e.g. from the marketplace); - open a Haskell file with the new editor to test the LSP client;
You are now ready to make changes and debug. You can,
- set breakpoints in your code inside
src/extension.tsto debug your extension; - find output from your extension in the debug console;
- make changes to the code, and then
- relaunch the extension from the debug toolbar
Note: you can also reload (Ctrl+R or Cmd+R on macOS) the VS Code window with your extension to load your changes
prettier is automatically run on each commit via husky. If you are developing within VS Code, the settings are set to auto format on save.
The configurations for prettier are located in .prettierrc.
A brief overview of the files,
package.jsoncontains the basic information about the package, see the full manifest for more, such as telling VS Code which scope the LSP works on (Haskell and Literate Haskell in our case), and possible configurationsrc/extension.tsis the main entrypoint to the extension, and handles launching the language server.src/hlsBinaries.tshandles automatically installing the pre-builthaskell-language-serverbinariessrc/utils.tshas some functions for downloading files and checking if executables are on the pathsrc/docsBrowser.tscontains the logic for displaying the documentation browser (e.g. hover over a type likemapM_and clickDocumentationorSource)
We recommend checking out Your First VS Code Extension and Creating a Language Server for some introduction to VS Code extensions.