There are two moving parts.
- Server: A node server written in Typescript that implements the Language Server Protocol (LSP).
Client: A Visual Studio Code (vscode) extension which wraps the LSP server.
The project has a root package.json
file which is really just there for
convenience - it proxies to the package.json
files in the vscode-client
and
server
folders.
This guide presumes you have the following dependencies installed:
Run the following in the root of the project
pnpm install
This uses the postinstall
hook to install the dependencies in each of the
sub-projects.
To make sure that everything is configured correctly run the following command to compile both the client and the server once
pnpm compile
Now, depending on which part you want to work on follow the relevant section below.
To support a good develop workflow we set up eslint, Prettier and integration tests using Jest:
pnpm verify # (runs lint, prettier and tests)
pnpm lint
pnpm test
pnpm test:coverage
Working on the client is simply a matter of starting vscode and using the Debug
View to launch the Launch Client
task. This will open a new vscode window with the
extension loaded. It also looks for changes to your client code and recompiles
it whenever you save your changes.
See the ide-bash package for Atom. Due to how Atom packages are published the client lives in a separate repository.
As the server is embedded into the VS Code client, you can link any server changes into the local installation of your VS Code client by running this once:
pnpm link-server
After that follow the steps above to work on the client.
If you are working on the server outside of VS Code, then simply compile and install the server globally whenever you've made a change, and then reload your vscode window to re-launch the server.
pnpm reinstall-server
If you for some reason cannot get access to logs through the client,
then you can hack the server/util/logger
with:
const fs = require('fs')
const util = require('util')
const log_file = fs.createWriteStream(`/tmp/bash-language-server-debug.log`, {
flags: 'w',
})
// inside log function
log_file.write(`${severity} ${util.format(message)}\n`)
To analyze the performance of the extension or server using the Chrome inspector:
- In Code start debugging "Run -> Start debugging"
- Open
chrome://inspect
in Chrome and ensure the portlocalhost:6009
is added