Skip to content

Commit 75b44ed

Browse files
committed
Per #803: Change Rust language server to rust-analyzer
rust-analyzer is the officially blessed Language Server for Rust: rust-lang/rfcs#2912 Also drop the special support code for RLS. * eglot.el (eglot-server-programs): Change rust-mode language server from rls to rust-analyzer. (eglot-rls, jsonrpc-connection-ready-p) (eglot-handle-notification): Delete. * README.md: Update references for RLS to point to rust-analyzer. * NEWS.md: Announce above change.
1 parent b928aba commit 75b44ed

File tree

3 files changed

+9
-23
lines changed

3 files changed

+9
-23
lines changed

NEWS.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ unnecessary code" or "deprecated or obsolete code". Following the
66
rendering suggestions in the protocol, we fade out unnecessary code
77
and strike-through deprecated code.
88

9+
##### The Rust language server is now rust-analyzer by default ([#803][github#803])
10+
Eglot will no longer attempt to start "rls". The special support code
11+
for RLS has been removed.
12+
913
##### New servers have been added to `eglot-server-programs`
1014
- racket-langserver ([#694][github#694])
1115

@@ -327,3 +331,4 @@ and now said bunch of references-->
327331
[github#769]: https://github.com/joaotavora/eglot/issues/769
328332
[github#787]: https://github.com/joaotavora/eglot/issues/787
329333
[github#794]: https://github.com/joaotavora/eglot/issues/794
334+
[github#803]: https://github.com/joaotavora/eglot/issues/803

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ find-library` can help you tell if that happened.
6767
* R's [languageserver][r-languageserver]
6868
* Racket's [racket-langserver][racket-langserver]
6969
* Ruby's [solargraph][solargraph]
70-
* Rust's [rls][rls]
70+
* Rust's [rust-analyzer][rust-analyzer]
7171
* Scala's [metals][metals]
7272
* TeX/LaTeX's [Digestif][digestif]
7373
* VimScript's [vim-language-server][vim-language-server]
@@ -467,7 +467,7 @@ User-visible differences:
467467
connection name;
468468
- Pretty interactive mode-line section for live tracking of server
469469
communication;
470-
- Automatically restarts frequently crashing servers (like RLS);
470+
- Automatically restarts frequently crashing servers;
471471
- Slow-to-start servers start asynchronously in the background;
472472
- Server-initiated edits are confirmed with the user;
473473
- Diagnostics work out-of-the-box (no `flycheck.el` needed);
@@ -517,7 +517,7 @@ Under the hood:
517517
[r-languageserver]: https://cran.r-project.org/package=languageserver
518518
[racket-langserver]: https://github.com/jeapostrophe/racket-langserver
519519
[solargraph]: https://github.com/castwide/solargraph
520-
[rls]: https://github.com/rust-lang-nursery/rls
520+
[rust-analyzer]: https://github.com/rust-analyzer/rust-analyzer
521521
[metals]: https://scalameta.org/metals/
522522
[digestif]: https://github.com/astoff/digestif
523523
[vim-language-server]: https://github.com/iamcco/vim-language-server

eglot.el

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ chosen (interactively or automatically)."
142142
when probe return (cons probe args)
143143
finally (funcall err)))))))
144144

145-
(defvar eglot-server-programs `((rust-mode . (eglot-rls "rls"))
145+
(defvar eglot-server-programs `((rust-mode . ("rust-analyzer"))
146146
(cmake-mode . ("cmake-language-server"))
147147
(vimrc-mode . ("vim-language-server" "--stdio"))
148148
(python-mode
@@ -2983,25 +2983,6 @@ If NOERROR, return predicate, else erroring function."
29832983
(when (eq ?! (aref arg 1)) (aset arg 1 ?^))
29842984
`(,self () (re-search-forward ,(concat "\\=" arg)) (,next)))
29852985

2986-
2987-
;;; Rust-specific
2988-
;;;
2989-
(defclass eglot-rls (eglot-lsp-server) () :documentation "Rustlang's RLS.")
2990-
2991-
(cl-defmethod jsonrpc-connection-ready-p ((server eglot-rls) what)
2992-
"Except for :completion, RLS isn't ready until Indexing done."
2993-
(and (cl-call-next-method)
2994-
(or ;; RLS normally ready for this, even if building.
2995-
(eq :textDocument/completion what)
2996-
(pcase-let ((`(,_id ,what ,done ,_detail) (eglot--spinner server)))
2997-
(and (equal "Indexing" what) done)))))
2998-
2999-
(cl-defmethod eglot-handle-notification
3000-
((server eglot-rls) (_method (eql window/progress))
3001-
&key id done title message &allow-other-keys)
3002-
"Handle notification window/progress."
3003-
(setf (eglot--spinner server) (list id title done message)))
3004-
30052986

30062987
;;; eclipse-jdt-specific
30072988
;;;

0 commit comments

Comments
 (0)