Skip to content

Commit 0aa6ede

Browse files
authored
Merge branch 'master' into fix/lsp-rust-test-no-run
2 parents ce9ba98 + 83c7dd0 commit 0aa6ede

18 files changed

+153
-35
lines changed

.github/workflows/docs.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- name: Checkout
13-
uses: actions/checkout@v4
13+
uses: actions/checkout@v5
1414

1515
- name: CHANGELOG.org -> CHANGELOG.md
1616
uses: docker://pandoc/core:2.9
@@ -19,7 +19,7 @@ jobs:
1919

2020
- uses: jcs090218/setup-emacs@master
2121
with:
22-
version: 28.1
22+
version: 30.2
2323

2424
- uses: emacs-eask/setup-eask@master
2525
with:
@@ -29,7 +29,7 @@ jobs:
2929
run: 'make docs'
3030

3131
- name: Docker Login
32-
uses: docker/login-action@v1.14.1
32+
uses: docker/login-action@v3.6.0
3333
with:
3434
registry: ghcr.io
3535
username: $GITHUB_ACTOR

.github/workflows/lint.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ jobs:
1010
lint:
1111
runs-on: ubuntu-latest
1212
steps:
13-
- uses: actions/checkout@v4
13+
- uses: actions/checkout@v5
1414

15-
- uses: purcell/setup-emacs@master
15+
- uses: jcs090218/setup-emacs@master
1616
with:
17-
version: 29.4
17+
version: 30.2
1818

1919
- uses: emacs-eask/setup-eask@master
2020
with:

.github/workflows/test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
emacs-version:
1919
- 28.2
2020
- 29.4
21-
- 30.1
21+
- 30.2
2222
experimental: [false]
2323
include:
2424
- os: ubuntu-latest
@@ -67,7 +67,7 @@ jobs:
6767
if: matrix.os == 'ubuntu-latest' || matrix.os == 'ubuntu-24.04-arm' || matrix.os == 'macos-latest'
6868
run: "cmake --version"
6969

70-
- uses: actions/setup-python@v5.1.0
70+
- uses: actions/setup-python@v6.0.0
7171
with:
7272
python-version: "3.9"
7373

@@ -87,7 +87,7 @@ jobs:
8787
if: runner.os == 'Linux'
8888
run: "clangd-15 --version"
8989

90-
- uses: actions/checkout@v4
90+
- uses: actions/checkout@v5
9191

9292
- name: Grant execution permission (Unix)
9393
if: matrix.os == 'ubuntu-latest' || matrix.os == 'ubuntu-24.04-arm' || matrix.os == 'macos-latest'

CHANGELOG.org

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
* Changelog
22
** Unreleased 9.0.1
3+
* Fix Accommodate renaming of lsp-postgres binaries
4+
* Fix =lsp-org= for org >= 9.7 (see #4300)
35
* Add format on save support
46
* Fix beancount journal file init option
57
* Add support for [[https://github.com/glehmann/earthlyls][earthlyls]]
@@ -43,6 +45,8 @@
4345
* Make lsp-headerline--check-breadcrumb public
4446
* Added Odin langauge server support [[https://github.com/DanielGavin/ols][ols]]
4547
* Fix bug in lsp-odin where ~f-join~ collapses double slashes. Using ~format~ instead.
48+
* Fix missing gopls inlay hints when ~lsp-use-plist~ is true
49+
* Fix bug where persist was attempted when lsp-session-file is nil
4650
* Debugging tests in Rust no longer runs all the tests prior to launching debug session.
4751

4852
** 9.0.0

clients/lsp-eslint.el

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,12 @@ stored."
245245
:type 'string
246246
:package-version '(lsp-mode . "8.0.0"))
247247

248+
(defcustom lsp-eslint-multi-root nil
249+
"If non nil, `eslint' will be started in multi-root mode."
250+
:type 'boolean
251+
:safe #'booleanp
252+
:package-version '(lsp-mode . "9.0.1"))
253+
248254
(defun lsp--find-eslint ()
249255
(or
250256
(when-let* ((workspace-folder (lsp-find-session-folder (lsp-session) default-directory)))
@@ -422,7 +428,7 @@ to allow or deny it.")
422428
:priority -1
423429
:completion-in-comments? t
424430
:add-on? t
425-
:multi-root t
431+
:multi-root lsp-eslint-multi-root
426432
:notification-handlers (ht ("eslint/status" #'lsp-eslint-status-handler))
427433
:request-handlers (ht ("workspace/configuration" #'lsp-eslint--configuration)
428434
("eslint/openDoc" #'lsp-eslint--open-doc)

clients/lsp-go.el

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,13 @@ Will update if UPDATE? is t"
449449
:after-open-fn (lambda ()
450450
;; https://github.com/golang/tools/commit/b2d8b0336
451451
(setq-local lsp-completion-filter-on-incomplete nil))
452-
:download-server-fn #'lsp-go--cls-download-server))
452+
:download-server-fn #'lsp-go--cls-download-server
453+
:initialized-fn (lambda (workspace)
454+
(let ((caps (lsp--workspace-server-capabilities workspace)))
455+
(unless (lsp-get caps :inlayHintProvider)
456+
(lsp:set-server-capabilities-inlay-hint-provider? caps t))
457+
(unless (lsp-get caps :codeLensProvider)
458+
(lsp:set-server-capabilities-code-lens-provider? caps t))))))
453459

454460
(lsp-consistency-check lsp-go)
455461

clients/lsp-graphql.el

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,18 @@
4848
:type '(repeat string)
4949
:group 'lsp-graphql)
5050

51+
(defcustom lsp-graphql-activated-modes '(js-mode js2-mode typescript-mode typescript-ts-mode)
52+
"List of major modes that can activate the GraphQL language server.
53+
When a buffer is in one of these modes, the GraphQL language server
54+
may be activated if appropriate GraphQL content is detected."
55+
:type '(repeat symbol)
56+
:group 'lsp-graphql)
57+
5158
(defun lsp-graphql-activate-p (filename &optional _)
5259
"Check if the GraphQL language server should be enabled based on FILENAME."
5360
(let ((target-extensions (mapconcat 'identity lsp-graphql-target-file-extensions "\\|")))
5461
(or (string-match-p (format "\\.\\(?:%s\\)\\'" target-extensions) filename)
55-
(and (derived-mode-p 'js-mode 'js2-mode 'typescript-mode 'typescript-ts-mode)
56-
(not (derived-mode-p 'json-mode))))))
62+
(apply 'derived-mode-p lsp-graphql-activated-modes))))
5763

5864

5965
(lsp-register-client

clients/lsp-javascript.el

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -824,6 +824,15 @@ to run the command in."
824824
(lsp-clients-typescript-require-resolve (f-parent (lsp-package-path 'typescript)))
825825
(lsp-package-path 'typescript))))
826826

827+
(lsp-defun lsp-clients-typescript-handle-interactive-actions ((&Command :arguments? [args]))
828+
(pcase (lsp-get args :action)
829+
("Move to file"
830+
(let* ((directory (file-name-directory (buffer-file-name)))
831+
(target-file-name (expand-file-name (read-file-name "Destination file: " directory))))
832+
(lsp-put args
833+
:interactiveRefactorArguments
834+
`((targetFile . ,target-file-name)))))))
835+
827836
(lsp-register-client
828837
(make-lsp-client :new-connection (lsp-stdio-connection (lambda ()
829838
`(,(lsp-package-path 'typescript-language-server)
@@ -845,6 +854,7 @@ to run the command in."
845854
(list :plugins lsp-clients-typescript-plugins))
846855
(when lsp-clients-typescript-preferences
847856
(list :preferences lsp-clients-typescript-preferences))
857+
(list :supportsMoveToFileCodeAction t)
848858
`(:tsserver ( :path ,(lsp-clients-typescript-server-path)
849859
,@lsp-clients-typescript-tsserver))))
850860
:initialized-fn (lambda (workspace)
@@ -858,6 +868,7 @@ to run the command in."
858868
(format-enable (or lsp-javascript-format-enable lsp-typescript-format-enable)))
859869
(lsp:set-server-capabilities-document-formatting-provider? caps format-enable)
860870
(lsp:set-server-capabilities-document-range-formatting-provider? caps format-enable)))
871+
:action-filter 'lsp-clients-typescript-handle-interactive-actions
861872
:ignore-messages '("readFile .*? requested by TypeScript but content not available")
862873
:server-id 'ts-ls
863874
:request-handlers (ht ("_typescript.rename" #'lsp-javascript--rename))

clients/lsp-magik.el

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@
200200
"-jar"
201201
(substitute-in-file-name lsp-magik-ls-path)
202202
"--debug")))
203-
:activation-fn (lsp-activate-on "magik")
203+
:activation-fn (lsp-activate-on "magik" "sw-product-def" "sw-module-def" "sw-load-list")
204204
:initialized-fn (lambda (workspace)
205205
(with-lsp-workspace workspace
206206
(lsp--set-configuration (lsp-configuration-section "magik"))))

clients/lsp-ocaml.el

Lines changed: 47 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,7 @@
122122
123123
OCaml-lsp custom protocol documented here
124124
https://github.com/ocaml/ocaml-lsp/blob/master/ocaml-lsp-server/docs/ocamllsp/switchImplIntf-spec.md"
125-
(-if-let* ((params (lsp-make-ocaml-lsp-switch-impl-intf-params
126-
:uri (lsp--buffer-uri)))
125+
(-if-let* ((params (make-vector 1 (lsp--buffer-uri)))
127126
(uris (lsp-request "ocamllsp/switchImplIntf" params)))
128127
uris
129128
(lsp--warn "Your version of ocaml-lsp doesn't support the switchImplIntf extension")))
@@ -158,6 +157,18 @@ https://github.com/ocaml/ocaml-lsp/blob/master/ocaml-lsp-server/docs/ocamllsp/ge
158157
(lsp-request "ocamllsp/getDocumentation" params)
159158
(lsp--warn "Your version of ocaml-lsp doesn't support the getDocumentation extension")))
160159

160+
(defun lsp-ocaml--infer-intf ()
161+
"Infer the interface of the given URI.
162+
163+
The URI should correspond to an implementation file, not an interface one.
164+
165+
OCaml-lsp protocol is documented here:
166+
https://github.com/ocaml/ocaml-lsp/blob/master/ocaml-lsp-server/docs/ocamllsp/inferIntf-spec.md"
167+
(-if-let* ((params (make-vector 1 (lsp--buffer-uri)))
168+
(result (lsp-request "ocamllsp/inferIntf" params)))
169+
result
170+
(lsp--warn "Your version of ocaml-lsp doesn't support the inferIntf extension")))
171+
161172
;;; -------------------
162173
;;; OCaml-lsp general utilities
163174
;;; -------------------
@@ -170,6 +181,15 @@ https://github.com/ocaml/ocaml-lsp/blob/master/ocaml-lsp-server/docs/ocamllsp/ge
170181
;;; OCaml-lsp URI utilities
171182
;;; -------------------
172183

184+
(defun lsp-ocaml--is-interface (uri)
185+
"Return non-nil if the given URI is an interface, nil otherwise."
186+
(let ((path (lsp--uri-to-path uri)))
187+
(string-match-p "\\.\\(mli\\|rei\\|eliomi\\)\\'" path)))
188+
189+
(defun lsp-ocaml--on-interface ()
190+
"Return non-nil if the current URI is an interface, nil otherwise."
191+
(lsp-ocaml--is-interface (lsp--buffer-uri)))
192+
173193
(defun lsp-ocaml--load-uri (uri &optional other-window)
174194
"Check if URI exists and open its buffer or create a new one.
175195
@@ -328,6 +348,31 @@ If TYPE is a single-line that represents a module type, reformat it."
328348

329349
;;; The following functions are interactive implementations of the OCaml-lsp requests
330350

351+
(defun lsp-ocaml-infer-interface ()
352+
"Infer the interface for the current file."
353+
(interactive)
354+
(let* ((current-uri (lsp--buffer-uri))
355+
(intf-uri (if (lsp-ocaml--is-interface current-uri)
356+
current-uri
357+
(lsp-ocaml--find-alternate-uri)))
358+
(impl-uri (if (lsp-ocaml--is-interface current-uri)
359+
(lsp-ocaml--find-alternate-uri)
360+
current-uri))
361+
(intf-path (lsp--uri-to-path intf-uri))
362+
(impl-path (lsp--uri-to-path impl-uri)))
363+
(if (lsp-ocaml--load-uri impl-uri) ; the impl file needs to be loaded
364+
(when (y-or-n-p
365+
(format "Try to generate an interface for %s? " impl-path))
366+
(let ((result (lsp-ocaml--infer-intf)))
367+
(with-current-buffer (get-buffer-create intf-path)
368+
(when (or (= (buffer-size) 0)
369+
(y-or-n-p "The buffer is not empty, overwrite it? "))
370+
(erase-buffer)
371+
(insert result)
372+
;; Create the file if it doesn’t exist
373+
(unless (file-exists-p intf-path)
374+
(write-file intf-path)))))))))
375+
331376
(defun lsp-ocaml-find-alternate-file ()
332377
"Return the URI corresponding to the alternate file if there's only one or prompt for a choice."
333378
(interactive)

0 commit comments

Comments
 (0)