Skip to content

Commit 6d3fb63

Browse files
authored
feat(clients): Add Autotools support (#4263)
* feat: Add Autotools support * fix typo
1 parent 02b5061 commit 6d3fb63

File tree

5 files changed

+90
-1
lines changed

5 files changed

+90
-1
lines changed

CHANGELOG.org

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@
101101
* Add golangci-lint add-on client using [[https://github.com/nametake/golangci-lint-langserver][golangci-lint-langserver]]
102102
* Add buf/protobuf support via [[https://github.com/bufbuild/buf-language-server][bufls]]
103103
* Add Assembly Language support.
104+
* Add Autotools support
104105
** Release 8.0.0
105106
* 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.
106107
* Set ~lsp-clients-angular-language-server-command~ after the first connection to speed up subsequent connections.

clients/lsp-autotools.el

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
;;; lsp-autotools.el --- Support configure.ac, Makefile.am, Makefile -*- lexical-binding: t; -*-
2+
3+
;; Copyright (C) 2023 Jen-Chieh Shen
4+
5+
;; Author: Jen-Chieh Shen <[email protected]>
6+
;; Keywords: autotools lsp
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+
;; Support configure.ac, Makefile.am, Makefile
24+
25+
;;; Code:
26+
27+
(require 'lsp-mode)
28+
29+
(defgroup lsp-autotools nil
30+
"LSP support for Autotools."
31+
:group 'lsp-mode
32+
:link '(url-link "https://github.com/Freed-Wu/autotools-language-server")
33+
:package-version `(lsp-mode . "8.0.1"))
34+
35+
(defcustom lsp-autotools-active-modes
36+
'( autoconf-mode
37+
makefile-mode
38+
makefile-automake-mode
39+
makefile-gmake-mode
40+
makefile-makepp-mode
41+
makefile-bsdmake-mode
42+
makefile-imake-mode)
43+
"List of major mode that work with Autotools."
44+
:type 'list
45+
:group 'lsp-autotools)
46+
47+
(defun lsp-autotools--download-server (_client callback error-callback update?)
48+
"Install/update Autotools language server using `pip
49+
50+
Will invoke CALLBACK or ERROR-CALLBACK based on result.
51+
Will update if UPDATE? is t."
52+
(lsp-async-start-process
53+
callback
54+
error-callback
55+
"pip" "install" "autotools-language-server" (when update? "-U")))
56+
57+
(defun lsp-autotools--server-command ()
58+
"Startup command for Autotools language server."
59+
(list "autotools-language-server"))
60+
61+
(defun lsp-autotools--test-present ()
62+
"Return non-nil if Autotools language server is installed globally."
63+
(executable-find "autotools-language-server"))
64+
65+
(lsp-register-client
66+
(make-lsp-client
67+
:new-connection (lsp-stdio-connection
68+
#'lsp-autotools--server-command
69+
#'lsp-autotools--test-present)
70+
:major-modes lsp-autotools-active-modes
71+
:priority -1
72+
:server-id 'autotools-ls
73+
:download-server-fn #'lsp-autotools--download-server))
74+
75+
(lsp-consistency-check lsp-autotools)
76+
77+
(provide 'lsp-autotools)
78+
;;; lsp-autotools.el ends here

docs/lsp-clients.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,15 @@
5151
"lsp-install-server": "astro-ls",
5252
"debugger": "Not available"
5353
},
54+
{
55+
"name": "autotools",
56+
"full-name": "Autotools",
57+
"server-name": "autotools-language-server",
58+
"server-url": "https://github.com/Freed-Wu/autotools-language-server",
59+
"installation": "pip install autotools-language-server",
60+
"lsp-install-server": "autotools-ls",
61+
"debugger": "Not available"
62+
},
5463
{
5564
"name": "awk",
5665
"full-name": "AWK",

lsp-mode.el

Lines changed: 1 addition & 1 deletion
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-awk lsp-asm lsp-astro
177+
'( ccls lsp-actionscript lsp-ada lsp-angular lsp-ansible lsp-autotools lsp-awk lsp-asm lsp-astro
178178
lsp-bash lsp-beancount lsp-bufls lsp-clangd lsp-clojure lsp-cmake lsp-credo
179179
lsp-crystal lsp-csharp lsp-css lsp-cypher lsp-d lsp-dart lsp-dhall lsp-docker
180180
lsp-dockerfile lsp-elm lsp-elixir lsp-emmet lsp-erlang lsp-eslint lsp-fortran

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ nav:
5151
- Ansible: page/lsp-ansible.md
5252
- Assembly: page/lsp-asm.md
5353
- Astro: page/lsp-astro.md
54+
- Autotools: page/lsp-autotools.md
5455
- AWK: page/lsp-awk.md
5556
- Bash: page/lsp-bash.md
5657
- Beancount: page/lsp-beancount.md

0 commit comments

Comments
 (0)