Language Server Protocol implementation for nushell
-
the official nushell project (from version 0.79, onwards) is where the language-specific smarts are implemented, e.g.
nu --ide-hover
-
the official extension for Visual Studio Code is an IDE-specific wrapper around
nu --ide-hover
, etc -
similarly,
nuls
(this project) is a wrapper around thenu --ide-hover
, etc, but implements the Language Server Protocol
-
nuls
aims to have all the same LSP-powered features as the Visual Studio Code extension, but also working in any other IDE/editor that can connect to a language server, e.g.helix
,lapce
,neovim
,zed
, etc -
for now, please keep feature requests and bug reports focused on this goal
-
functionality that is not supported by upstream
nu --ide-...
is out-of-scope -
functionality in
vscode-nushell-lang
that goes beyond LSP is out-of-scope
(in no particular order, and open to suggestions)
parity with extension for Visual Studio Code
- textDocument/hover ->
nu --ide-hover
- textDocument/completion ->
nu --ide-complete
- textDocument/definition ->
nu --ide-goto-def
- textDocument/didChange, textDocument/didClose, and textDocument/didOpen
- textDocument/inlayHint ->
nu --ide-check
- textDocument/publishDiagnostics ->
nu --ide-check
- workspace/configuration
- workspace/didChangeConfiguration
- raise a PR for
vscode-nushell-lang
to replace its wrapper/glue code withnuls
- textDocument/diagnostic ->
nu --ide-check
- textDocument/formatting ->
nufmt
- window/workDoneProgress/create and window/workDoneProgress/cancel
-
it's still an open question as to how this project will be distributed and in what form
-
we'd like to tackle those specific in close collaboration with the nushell maintainers (#3), perhaps once we're a little closer to integation with the Visual Studio Code extension (#9)
-
you'll need a stable Rust toolchain
-
cargo install --git https://github.com/jokeyrhyme/nuls.git --locked
-
(optional) follow https://github.com/nushell/tree-sitter-nu/blob/main/installation/helix.md for the treesitter grammar
-
add the following to your languages.toml:
[[language]] name = "nu" auto-format = false comment-token = "#" file-types = [ "nu" ] language-server = { command = "path/to/nuls" } roots = [] scope = "source.nu" shebangs = ["nu"]
helix
with multiple language servers per language
recent-enough commits of helix
now include the nushell grammar and language definition out-of-the-box,
so all we need to do here tell it to use nuls
-
add the following to your languages.toml:
[language-server.nuls] command = "nuls" # or "some/path/to/nuls" [[language]] name = "nu" language-servers = [ "nuls" ]