This section helps you install and configure the Noir Language Server.
The Server component is provided by the Nargo command line tool that you installed at the beginning of this guide. As long as Nargo is installed and you've used it to run other commands in this guide, it should be good to go!
If you'd like to verify that the
nargo lsp command is available, you can run
nargo --help and look for
lsp in the list of commands. If you see it, you're using a version of Noir with LSP support.
The Client component is usually an editor plugin that launches the Server. It communicates LSP messages between the editor and the Server. For example, when you save a file, the Client will alert the Server, so it can try to compile the project and report any errors.
Note: Noir's Language Server Protocol support currently assumes users' VSCode workspace root to be the same as users' Noir project root (i.e. where Nargo.toml lies).
If LSP features seem to be missing / malfunctioning, make sure you are opening your Noir project directly (instead of as a sub-folder) in your VSCode instance.
When your language server is running correctly and the VSCode plugin is installed, you should see handy codelens buttons for compilation, measuring circuit size, execution, and tests:
You should also see your tests in the
- Noir: Enable LSP - If checked, the extension will launch the Language Server via
nargo lspand communicate with it.
- Noir: Nargo Flags - Additional flags may be specified if you require them to be added when the extension calls
- Noir: Nargo Path - An absolute path to a Nargo binary with the
lspcommand. This may be useful if Nargo is not within the
PATHof your editor.
- Noir > Trace: Server - Setting this to
"verbose"will log LSP messages between the Client and Server. Useful for debugging.