Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
lsp-rust: support rust-analyzer.showReference lens (#2299)
* lsp-rust: support rust-analyzer.showReference lens Add a rust-analyzer specific :action-handler for the showReference lens, which leverages `lsp-show-xrefs'. Refactor: eliminate `lsp-execute-command', because it caused the :title to be lost, which is needed to distinguish between the "references" or "implementations" variants of that lens. Defining a new `lsp-interface' to destructure "rust-analyzer.showReference" was impossible, as the former doesn't support destructuring lists (the :arguments? paramter is a special, 3-element list.). * lsp-lens.el: fix byte-compile warnings * Restore `lsp-execute-command' as an obsolete defun Its original function, being a `cl-defgeneric' that can be overriden per language server is gone; however, PRs were provided to eliminate all uses of it in that context. To remain backwards-compatible, it will still remain as an obsolete `defun' that calls `lsp--execute-command' internally. * Fix byte-compile * Remove `lsp-execute-command' as an obsolete defun Since it wouldn't do what it did previously (being an extension point), restoring that function doesn't actually improve backwards compatibility. Reverts 957a056. * Support `lsp-execute-command' `lsp-execute-command' now works as an extension point again, but a deprecation warning is shown if it is used to handle a command. To implement this, leverage `cl-no-applicable-method': call `lsp-execute-command' first, and then, if there is no implementation, go trough the handler hash tables as usual. * `lsp-execute-command': use `make-obsolete' The proper way to mark a function as deprecated is to use `make-obsolete'; use that instead of `lsp--warn'. * lsp-rust: remove redundant `lsp-interface' comment `lsp-interface' wasn't designed to destructure lists; stating that fact before `lsp-rust--analyzer-show-references' is as such redundant, since that is normal and not noteworthy. * `lsp-lens--create-interactive-command': non-nil The COMMAND? argument of that function mustn't be nil, which is unclear from its name (?). Note that fact in its docstring. The name of that argument is still good though, because it refers to a field name in `CodeAction' and `CodeLens'. Based on a discussion with @kiennq. * Fix `byte-compile': `lsp-execute-command' Unlike previously assumed, calling `lsp-execute-command' causes byte-compile warnings, not just using it in `cl-defmethod'. Wrap the call in `with-no-warnings', since that should be the only use of that function.
- Loading branch information