DEV Community

Bradley Nash
Bradley Nash

Posted on

Introducing minlsp

I’ve heard so many Nim devs complain about LSP servers being slow, pinning the CPU at 100%, or just getting stuck.

The reason behind this is usually the same: the server has to build a massive graph of the entire project, including the standard library, project source, and all dependencies. This gets even worse when it encounters macro-heavy code.

I first ran into this a while back when I was working on a PR for nimlsp. I found the project used macros and templates heavily, and the LSP just struggled—interestingly, the lsp server itself crashed many times in vscode, the moment I converted those to general procs, it worked fine.

After hearing the same frustrations pop up in Discord again recently, I decided to polish up an unfinished project I had sitting around. After a solid "vibe coding" session this morning, I’m ready to share minlsp.

What is minlsp?

minlsp provides IDE-like features for Nim code by leveraging ctags for fast and accurate symbol indexing. Unlike traditional LSP servers that require complex AST analysis, I built minlsp to use a tag-based approach for quick symbol lookup and navigation.

By using ntagger to extract symbols directly, I’ve created a server that prioritizes speed and low memory overhead without sacrificing the features we use most.

Key Features:

  • Lightning Fast: Symbol identification and navigation are nearly instant.
  • Low Resource Footprint: It stays out of your way and won't spin up your fans just because you opened a file.
  • Essential IDE Support: Includes Code Completion, Hover Info, Go to Definition, Find References, Signature Help, and Document Symbols.
  • Macro-Resilient: It doesn't get "stuck" on complex macros or templates because it doesn't need to expand them to find symbols.

Limitations & Trade-offs

To keep minlsp lightweight, I’ve made some intentional design choices:

  • No Semantic Analysis: It doesn't perform type-checking or real-time error reporting (diagnostics).
  • Scoped References: "Find References" currently searches through open files rather than the full workspace.
  • No Refactoring: Features like "Rename" or automatic code formatting are not currently supported.

Choosing the Right Tool

If you need full-scale compiler integration and deep refactoring, nimlangserver remains the standard. But if you want a responsive, "no-lag" workflow—especially in massive codebases or macro-dense projects where other servers choke—minlsp offers a snappier, more stable alternative.

The project is under active development. If you’ve been frustrated by LSP lag, I’d love for you to give it a try.


Resources & Links

Top comments (0)