An open API service indexing awesome lists of open source software.

https://github.com/foxoman/zed-nim

Nim support for Zed Editor
https://github.com/foxoman/zed-nim

nim nim-lang zed-editor zed-extension

Last synced: 8 months ago
JSON representation

Nim support for Zed Editor

Awesome Lists containing this project

README

          

# 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](https://github.com/nim-lang/langserver). Alternatively you can configure it to use [nimlsp](https://github.com/PMunch/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.

Extensions

### Dev / Manual install
Download the source and follow the instructions in the [Zed documentation](https://zed.dev/docs/extensions/developing-extensions#developing-an-extension-locally).

## 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](https://github.com/nim-lang/langserver?tab=readme-ov-file#configuration-options).

```json
"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):

```json
"lsp": {
"nim": {
"binary": {
"path": "/your/path/to/.nimble/bin/nimlsp",
"args": []
},
...
}
}
```

### Formatting
To use [nph](https://github.com/arnetheduck/nph) as a formatter, add this to your settings:

```json
"languages": {
"Nim": {
"formatter": {
"external": {
"command": "nph",
"arguments": ["-"]
}
}
}
}
```

### Jupyter

Zed provides support for [notebooks as scripts](https://zed.dev/docs/repl). To use [jupyternim](https://github.com/stisa/jupyternim) as a kernel, add it in your settings:

```json
"jupyter": {
"kernel_selections": {
"nim": "jupyternimspec"
}
}
```

## Screenshots

| Diagnostics | Inlay hints |
|:---:|:---:|
| Diagnostics | Inlay Hints |

| Tasks | Buttons |
|:---:|:---:|
| Tasks | Runnables |