Skip to content

Commit

Permalink
Add support for Zig (zls) (#2723)
Browse files Browse the repository at this point in the history
  • Loading branch information
rbino authored Mar 18, 2021
1 parent ceaab11 commit ed9308e
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.org
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
`dired` and `lsp-mode` diagnostics.
* Add Grammarly support.
* Add D support.
* Add Zig support.
** Release 7.0.1
* Introduced ~lsp-diagnostics-mode~.
* Safe renamed ~lsp-flycheck-default-level~ -> ~lsp-diagnostics-flycheck-default-level~
Expand Down
36 changes: 36 additions & 0 deletions clients/lsp-zig.el
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
;;; lsp-zig.el --- lsp-mode Zig integration -*- lexical-binding: t; -*-

;; Copyright (C) 2021 Riccardo Binetti

;; Author: Riccardo Binetti <[email protected]>
;; Keywords: languages,tools

;; 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:

;; client for zls, the Zig language server

;;; Code:

(require 'lsp-mode)

(lsp-register-client
(make-lsp-client
:new-connection (lsp-stdio-connection "zls")
:activation-fn (lsp-activate-on "zig")
:server-id 'zls))

(provide 'lsp-zig)
;;; lsp-zig.el ends here
8 changes: 8 additions & 0 deletions docs/lsp-clients.json
Original file line number Diff line number Diff line change
Expand Up @@ -635,5 +635,13 @@
"installation": "npm install -g yaml-language-server",
"lsp-install-server": "yamlls",
"debugger": "Not available"
},
{
"name": "zig",
"full-name": "Zig",
"server-name": "zls",
"server-url": "https://github.com/zigtools/zls",
"installation-url": "https://github.com/zigtools/zls#installation",
"debugger": "Not available"
}
]
5 changes: 3 additions & 2 deletions lsp-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ As defined by the Language Server Protocol 3.16."
lsp-kotlin lsp-lua lsp-nim lsp-nix lsp-metals lsp-ocaml lsp-perl lsp-php lsp-pwsh
lsp-pyls lsp-python-ms lsp-purescript lsp-r lsp-rf lsp-rust lsp-solargraph lsp-sorbet
lsp-tex lsp-terraform lsp-vala lsp-verilog lsp-vetur lsp-vhdl lsp-vimscript lsp-xml
lsp-yaml lsp-sqls lsp-svelte lsp-steep)
lsp-yaml lsp-sqls lsp-svelte lsp-steep lsp-zig)
"List of the clients to be automatically required."
:group 'lsp-mode
:type '(repeat symbol))
Expand Down Expand Up @@ -769,7 +769,8 @@ Changes take effect only when a new session is started."
(prolog-mode . "prolog")
(vala-mode . "vala")
(actionscript-mode . "actionscript")
(d-mode . "d"))
(d-mode . "d")
(zig-mode . "zig"))
"Language id configuration.")

(defvar lsp--last-active-workspaces nil
Expand Down
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ nav:
- Vue: page/lsp-vetur.md
- XML: page/lsp-xml.md
- YAML: page/lsp-yaml.md
- Zig: page/lsp-zig.md
- Debugging:
- https://emacs-lsp.github.io/dap-mode
- Gallery:
Expand Down

0 comments on commit ed9308e

Please sign in to comment.