diff options
author | Felicián Németh <felician.nemeth@gmail.com> | 2024-07-30 19:29:03 +0200 |
---|---|---|
committer | Felicián Németh <felician.nemeth@gmail.com> | 2024-07-30 19:46:15 +0200 |
commit | 31cf3e66c1e93107aaa04f1c7e266d84ce3b31ea (patch) | |
tree | 660cde91b55e94c60557905d0a9bbf08d9fffa8f | |
parent | 52e3bc0a61554cb5d616a9576cf4ef1a479f358c (diff) |
Handle the removal of rust-analyzer/shuffleCrateGraph
Even before the removal the method stopped working.
* eglot-x.el (eglot-x--shuffle-crate-graph): Notify about the
situation if the server returns "unknown request".
-rw-r--r-- | eglot-x.el | 16 |
1 files changed, 12 insertions, 4 deletions
@@ -1310,14 +1310,22 @@ non-workspace crates (crates.io dependencies as well as sysroot crates)") (process-send-string (current-buffer) res) (process-send-eof))))))) +;; This was removed at 2024-07-26 by +;; https://github.com/rust-lang/rust-analyzer/commit/7beac14cba1d1ba85011660e5e85159c6f3a136c (defun eglot-x--shuffle-crate-graph (full image-format) "Shuffle the crate IDs in the crate graph then view it. For debugging purposes." (interactive "P\ni") - (jsonrpc-request (eglot--current-server-or-lose) - :rust-analyzer/shuffleCrateGraph - nil) - (eglot-x-view-crate-graph full image-format)) + (let ((ret (condition-case err + (and (jsonrpc-request (eglot--current-server-or-lose) + :rust-analyzer/shuffleCrateGraph + nil) + nil) + (jsonrpc-error err)))) + (if (equal (alist-get 'jsonrpc-error-message ret) "unknown request") + (user-error + "[eglot-x]: Recent rust-analyzer versions removed \"Shuffle\"") + (eglot-x-view-crate-graph full image-format)))) ;;; Expand Macro ;; https://github.com/rust-analyzer/rust-analyzer/blob/master/docs/dev/lsp-extensions.md#expand-macro |