zed-nim
zed-nim copied to clipboard
Nim support for Zed Editor
Zed Nim
Nim extension for Zed Editor
Features
- Syntax highlighting
- Code completion
- Runnable buttons
- Inlay hints
- Tasks
- Diagnostics
- Go to definition and references
- Hover
- Outline
- Code actions (restart nimsuggest)
Install
Prerequisites
By default this extension uses nimlangserver. Alternatively you can configure it to use nimlsp (see below), though support for it is limited. Make sure to install one of the language servers.
Editor
Nim support has been officially integrated into the Zed editor through this extension. To enable it, search for "Nim" in the Zed extensions and install it.
Dev / Manual install
Download the source and follow the instructions in the Zed documentation.
Configuration
LSP Parameters
To change settings of the nimlangserver add the following to your settings. List of options can be found in nimlangserver's description.
"lsp": {
"nim": {
"settings": {
// Add your settings here:
"timeout": 10000,
"projectMapping": [
{
"projectFile": "tests/all\\.nim",
"fileRegex": "tests/.*\\.nim"
}
],
"maxNimsuggestProcesses": 1,
"notificationVerbosity": "warning"
}
}
}
Switching LSPs
Zed allows to specify the binary to use as a language server (such as nimlsp):
"lsp": {
"nim": {
"binary": {
"path": "/your/path/to/.nimble/bin/nimlsp",
"args": []
},
...
}
}
Formatting
To use nph as a formatter, add this to your settings:
"languages": {
"Nim": {
"formatter": {
"external": {
"command": "nph",
"arguments": ["-"]
}
}
}
}
Jupyter
Zed provides support for notebooks as scripts. To use jupyternim as a kernel, add it in your settings:
"jupyter": {
"kernel_selections": {
"nim": "jupyternimspec"
}
}
Screenshots
| Diagnostics | Inlay Hints |
| Tasks | Runnables |