nimsight

LSP implementation for Nim based on `nim check`


Need help? Read Nimble

Nim Sight 👀

Get insight with NimSight

Nim language server based around nim check

I first started programming Nim using micro which just had a linter for Nim which I found helpful enough so I wanted that same experiences in my other editors. Doesn't support auto-complete and likely never will unless the --suggest option starts working

Tested with Kate and helix, semi tested with NeoVim (I run the test suite with it, but personally dont use it)

Features

This is the list of features that are supported/will eventually be supported

  • Show errors/warnings
  • Show outline of document
  • Basic fixes for some errors
  • Nimble and nimscript files
  • Go-to symbol definition (The code is there, but it basically never works)
  • Find usages
  • Rename symbol
  • Code lens (Nimble tasks, run tests)

Installation

Installation is supported via nimble install nimsight or via the flake github:ire4ever1190/nimsight

Usage

Kate

Add this into the list of LSP servers

{
  "nim": {
    "command": ["nimsight"],
    "path": ["%{ENV:HOME}/.nimble/bin", "%{ENV:USERPROFILE}/.nimble/bin"],
    "rootIndicationFilePatterns": ["*.nimble", "config.nims"],
    "url": "https://github.com/ire4ever1190/nimsight",
    "highlightingModeRegex": "Nim",
    "initializationOptions": {
      "nimBinary": "/path/to/nim"
    }
  }
}

Helix

Add this into your languages.toml file

[[language]]
language-servers = ["nimsight"]
name = "nim"

[language-server.nimsight]
args = []
command = "nimsight"

[language-server.nimsight.config.nimBinary]
path = "/path/to/nim"

Configuration

The following configuration options can be passed via initializationOptions:

  • nimBinary: Path to the Nim binary to use (defaults to nim or nim.exe)
  • nimbleBinary: Path to the Nimble binary to use (defaults to nimble or nimble.exe)

Developing

Code is broken into two main sections

  • src/nimsight.nim: Main entry point, registers all the handlers
  • src/nimsight/: Contains code for Nim related stuff
  • src/nimsight/sdk: Contains an SDK for interacting with language servers. Can be used outside of this

Author: ire4ever1190

Latest versions: 0.1.0 0.2.0

Licence: MIT

Project website

Docs