Skip to content

Commit 7bd9d42

Browse files
authored
Support for Astro language server (#3816)
1 parent 903b790 commit 7bd9d42

File tree

4 files changed

+55
-2
lines changed

4 files changed

+55
-2
lines changed

clients/lsp-astro.el

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
;;; lsp-astro.el --- lsp-mode astro integration -*- lexical-binding: t; -*-
2+
3+
;; Copyright (C) 2022 Paweł Kobojek
4+
5+
;; Author: Paweł Kobojek
6+
;; Keywords: languages,astro
7+
8+
;; This program is free software; you can redistribute it and/or modify
9+
;; it under the terms of the GNU General Public License as published by
10+
;; the Free Software Foundation, either version 3 of the License, or
11+
;; (at your option) any later version.
12+
13+
;; This program is distributed in the hope that it will be useful,
14+
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15+
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16+
;; GNU General Public License for more details.
17+
18+
;; You should have received a copy of the GNU General Public License
19+
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
20+
21+
;;; Commentary:
22+
23+
;; client for astro-ls
24+
25+
;;; Code:
26+
(require 'lsp-mode)
27+
28+
(defgroup lsp-astro nil
29+
"LSP support for Astro.build, using astro-ls."
30+
:group 'lsp-mode
31+
:link '(url-link "https://github.com/withastro/language-tools"))
32+
33+
(lsp-register-client
34+
(make-lsp-client :new-connection (lsp-stdio-connection '("astro-ls" "--stdio"))
35+
:activation-fn (lsp-activate-on "astro")
36+
:server-id 'astro-ls))
37+
38+
39+
40+
(lsp-consistency-check lsp-astro)
41+
(provide 'lsp-astro)
42+
;;; lsp-astro.el ends here

docs/lsp-clients.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,15 @@
3333
"lsp-install-server": "ansible-ls",
3434
"debugger": "Not available"
3535
},
36+
{
37+
"name": "astro",
38+
"full-name": "Astro",
39+
"server-name": "astro-ls",
40+
"server-url": "https://github.com/withastro/language-tools",
41+
"installation": "npm i -g @astrojs/language-server",
42+
"lsp-install-server": "astro-ls",
43+
"debugger": "Not available"
44+
},
3645
{
3746
"name": "bash",
3847
"full-name": "Bash",

lsp-mode.el

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ As defined by the Language Server Protocol 3.16."
174174
:package-version '(lsp-mode . "6.1"))
175175

176176
(defcustom lsp-client-packages
177-
'(ccls lsp-actionscript lsp-ada lsp-angular lsp-ansible lsp-bash lsp-beancount lsp-clangd lsp-clojure
177+
'(ccls lsp-actionscript lsp-ada lsp-angular lsp-ansible lsp-astro lsp-bash lsp-beancount lsp-clangd lsp-clojure
178178
lsp-cmake lsp-crystal lsp-csharp lsp-css lsp-d lsp-dart lsp-dhall lsp-docker lsp-dockerfile
179179
lsp-elm lsp-elixir lsp-emmet lsp-erlang lsp-eslint lsp-fortran lsp-fsharp lsp-gdscript lsp-go
180180
lsp-gleam lsp-graphql lsp-hack lsp-grammarly lsp-groovy lsp-haskell lsp-haxe lsp-idris lsp-java lsp-javascript
@@ -749,6 +749,7 @@ Changes take effect only when a new session is started."
749749
(".*/PKGBUILD$" . "shellscript")
750750
(".*\\.ttcn3$" . "ttcn3")
751751
(".*\\ya?ml$" . "yaml")
752+
(".*\\.astro$" . "astro")
752753
(ada-mode . "ada")
753754
(nxml-mode . "xml")
754755
(sql-mode . "sql")
@@ -1942,7 +1943,7 @@ regex in IGNORED-FILES."
19421943
lsp-python-ms lsp-rescript lsp-sonarlint lsp-sourcekit lsp-tailwindcss lsp-treemacs
19431944
lsp-ui swift-helpful
19441945
;; clients
1945-
lsp-actionscript lsp-ada lsp-angular lsp-bash lsp-beancount lsp-clangd
1946+
lsp-actionscript lsp-ada lsp-angular lsp-astro lsp-bash lsp-beancount lsp-clangd
19461947
lsp-clojure lsp-cmake lsp-crystal lsp-csharp lsp-css lsp-d lsp-dhall
19471948
lsp-dockerfile lsp-elixir lsp-elm lsp-erlang lsp-eslint lsp-fortran lsp-fsharp lsp-gdscript
19481949
lsp-go lsp-gleam lsp-graphql lsp-groovy lsp-hack lsp-haxe lsp-html lsp-idris lsp-javascript lsp-json lsp-kotlin lsp-lua

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ nav:
4949
- Ada: page/lsp-ada.md
5050
- Angular: page/lsp-angular.md
5151
- Ansible: page/lsp-ansible.md
52+
- Astro: page/lsp-astro.md
5253
- Bash: page/lsp-bash.md
5354
- Beancount: page/lsp-beancount.md
5455
- Camel: page/lsp-camel.md

0 commit comments

Comments
 (0)