diff --git a/CHANGELOG.org b/CHANGELOG.org index c3e638c229..47bfab3559 100644 --- a/CHANGELOG.org +++ b/CHANGELOG.org @@ -109,6 +109,8 @@ * Add Hylang support. * Add support for clojure-ts derived modes. * Add support for installing Ada Language Server. + * Add Nushell support + ** Release 8.0.0 * Add ~lsp-clients-angular-node-get-prefix-command~ to get the Angular server from another location which is still has ~/lib/node_modules~ in it. * Set ~lsp-clients-angular-language-server-command~ after the first connection to speed up subsequent connections. diff --git a/clients/lsp-nushell.el b/clients/lsp-nushell.el new file mode 100644 index 0000000000..19855e55eb --- /dev/null +++ b/clients/lsp-nushell.el @@ -0,0 +1,59 @@ +;;; lsp-nushell.el --- lsp-mode ansible integration -*- lexical-binding: t; -*- + +;; Copyright (C) 2024 emacs-lsp maintainers + +;; Author: lsp-mode maintainers +;; Keywords: lsp, nushell + +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see . + +;;; Commentary: + +;; LSP Client for the nushell Language + +;;; Code: + +(require 'lsp-mode) + +(defgroup lsp-nushell nil + "LSP support for nushell." + :group 'lsp-mode + :link '(url-link "https://github.com/nushell/nushell")) + +(defcustom lsp-nushell-language-server-command + '("nu" "--lsp") + "The command that starts the nushell language server." + :type '(repeat :tag "List of string values" string) + :group 'lsp-nushell) + +(lsp-register-client + (make-lsp-client :new-connection (lsp-stdio-connection lsp-nushell-language-server-command) + :activation-fn (lsp-activate-on "nushell") + :priority -1 + :initialized-fn (lambda (workspace) + ;; Nushell server returns an empty list of + ;; completion options at initialization + ;; so completionProvider capability is {} + ;; When using plists, this value is parsed as + ;; null/nil so we need to force it to "t" + ;; to enable completion + (let ((caps (lsp--workspace-server-capabilities workspace))) + (unless (lsp-get caps :completionProvider) + (lsp:set-server-capabilities-completion-provider? caps t)))) + :server-id 'nushell-ls)) + +(lsp-consistency-check lsp-nushell) + +(provide 'lsp-nushell) +;;; lsp-nushell.el ends here diff --git a/docs/lsp-clients.json b/docs/lsp-clients.json index 82e7c4b5f0..b17a6ceb0d 100644 --- a/docs/lsp-clients.json +++ b/docs/lsp-clients.json @@ -654,6 +654,14 @@ "installation": "nix-env -i nil || nix profile install nixpkgs#nil", "debugger": "Not available" }, + { + "name": "nushell", + "full-name": "Nushell", + "server-name": "nu", + "server-url": "https://github.com/nushell/nushell/tree/main/crates/nu-lsp", + "installation": "It is included in Nushell >= 0.87.0", + "debugger": "Not available" + }, { "name": "ocaml", "full-name": "OCaml", diff --git a/lsp-mode.el b/lsp-mode.el index 54d83e977d..f2f77782d5 100644 --- a/lsp-mode.el +++ b/lsp-mode.el @@ -183,7 +183,7 @@ As defined by the Language Server Protocol 3.16." lsp-groovy lsp-haskell lsp-haxe lsp-idris lsp-java lsp-javascript lsp-json lsp-kotlin lsp-latex lsp-ltex lsp-lua lsp-markdown lsp-marksman lsp-mdx lsp-mint lsp-move lsp-nginx lsp-nim lsp-nix lsp-magik lsp-mojo lsp-metals - lsp-mssql lsp-ocaml lsp-openscad lsp-pascal lsp-perl lsp-perlnavigator + lsp-mssql lsp-nushell lsp-ocaml lsp-openscad lsp-pascal lsp-perl lsp-perlnavigator lsp-pls lsp-php lsp-pwsh lsp-pyls lsp-pylsp lsp-pyright lsp-python-ms lsp-purescript lsp-r lsp-racket lsp-remark lsp-ruff-lsp lsp-rf lsp-rubocop lsp-rust lsp-semgrep lsp-shader lsp-solargraph lsp-sorbet lsp-sourcekit @@ -780,6 +780,7 @@ Changes take effect only when a new session is started." ("\\.jq$" . "jq") ("\\.lua$" . "lua") ("\\.mdx\\'" . "mdx") + ("\\.nu$" . "nushell") ("\\.php$" . "php") ("\\.rs\\'" . "rust") ("\\.spec\\'" . "rpm-spec") @@ -954,7 +955,9 @@ Changes take effect only when a new session is started." (wgsl-mode . "wgsl") (jq-mode . "jq") (jq-ts-mode . "jq") - (protobuf-mode . "protobuf")) + (protobuf-mode . "protobuf") + (nushell-mode . "nushell") + (nushell-ts-mode . "nushell")) "Language id configuration.") (defvar lsp--last-active-workspaces nil diff --git a/mkdocs.yml b/mkdocs.yml index 77afccb2bc..9eb1755bfc 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -113,6 +113,7 @@ nav: - Nix (nixd-lsp): page/lsp-nix-nixd.md - Nix (rnix-lsp): page/lsp-nix-rnix.md - Nix (nil): page/lsp-nix-nil.md + - Nushell: page/lsp-nushell.md - OCaml (ocaml-lsp): page/lsp-ocaml-lsp-server.md - OpenSCAD: page/lsp-openscad.md - Pascal/Object Pascal: page/lsp-pascal.md