Skip to content

Commit

Permalink
Add support for Jsonnet (#4283)
Browse files Browse the repository at this point in the history
  • Loading branch information
takeokunn authored Dec 30, 2023
1 parent ac2c416 commit 2fe0244
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.org
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@
* Add buf/protobuf support via [[https://github.com/bufbuild/buf-language-server][bufls]]
* Add Assembly Language support.
* Add Autotools support
* Add Jsonnet 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.
Expand Down
51 changes: 51 additions & 0 deletions clients/lsp-jsonnet.el
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
;;; lsp-jsonnet.el --- lsp client for jsonnet -*- lexical-binding: t; -*-

;; Copyright (C) 2023 emacs-lsp maintainers

;; Author: emacs-lsp maintainers
;; Keywords: lsp, jsonnet

;; 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 <https://www.gnu.org/licenses/>.

;;; Commentary:
;;
;; LSP client for jsonnet language.
;;
;;; Code:

(require 'lsp-mode)

(defgroup lsp-jsonnet nil
"LSP support for jsonnet."
:group 'lsp-mode
:link '(url-link "https://github.com/grafana/jsonnet-language-server"))

(defcustom lsp-clients-jsonnet-server-executable '("jsonnet-language-server")
"The jsonnet language server executable to use."
:group 'lsp-jsonnet
:risky t
:type '(repeat string))

(lsp-register-client
(make-lsp-client
:new-connection (lsp-stdio-connection (lambda () lsp-clients-jsonnet-server-executable))
:activation-fn (lsp-activate-on "jsonnet")
:priority -1
:major-modes '(jsonnet-mode)
:server-id 'jsonnet-lsp))

(lsp-consistency-check lsp-jsonnet)

(provide 'lsp-jsonnet)
;;; lsp-jsonnet.el ends here
9 changes: 9 additions & 0 deletions docs/lsp-clients.json
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,15 @@
"lsp-install-server": "json-ls",
"debugger": "Not available"
},
{
"name": "jsonnet",
"full-name": "Jsonnet",
"server-name": "jsonnet-language-server",
"server-url": "https://github.com/grafana/jsonnet-language-server",
"installation-url": "https://github.com/grafana/jsonnet-language-server?tab=readme-ov-file#installation",
"lsp-install-server": "jsonnet-ls",
"debugger": "Not available"
},
{
"name": "julia",
"full-name": "Julia",
Expand Down
1 change: 1 addition & 0 deletions lsp-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -770,6 +770,7 @@ Changes take effect only when a new session is started."
("\\.java\\'" . "java")
("\\.js$" . "javascript")
("\\.json$" . "json")
("\\.jsonnet$" . "jsonnet")
("\\.jsonc$" . "jsonc")
("\\.jsx$" . "javascriptreact")
("\\.jq$" . "jq")
Expand Down
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ nav:
- JavaScript/TypeScript (theia-ide): page/lsp-typescript.md
- JavaScript Flow: page/lsp-flow.md
- Json: page/lsp-json.md
- Jsonnet: page/lsp-jsonnet.md
- Julia: page/lsp-julia.md
- Kotlin: page/lsp-kotlin.md
- LanguageTool (LTEX): page/lsp-ltex.md
Expand Down

0 comments on commit 2fe0244

Please sign in to comment.