From 2c6a0e92402708780f18745f98ca128be64bbc78 Mon Sep 17 00:00:00 2001 From: Ivan Yonchovski Date: Wed, 27 Jul 2022 11:13:59 +0300 Subject: [PATCH] Set includeDeclaration to t by default --- CHANGELOG.org | 1 + lsp-mode.el | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.org b/CHANGELOG.org index 701149398c..d0efb1c851 100644 --- a/CHANGELOG.org +++ b/CHANGELOG.org @@ -38,6 +38,7 @@ * Add setting UPDATE_EXPECT=1 when running `expect!` tests ~lsp-rust~ * Add ~lsp-use-workspace-root-for-server-default-directory~. * Add [[https://github.com/artempyanykh/marksman][marksman]] support. + * ~lsp-find-references~ to include declaration by default ** Release 8.0.0 * 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. * Set ~lsp-clients-angular-language-server-command~ after the first connection to speed up subsequent connections. diff --git a/lsp-mode.el b/lsp-mode.el index b4a561f0fc..aa1a8da0c8 100644 --- a/lsp-mode.el +++ b/lsp-mode.el @@ -4956,13 +4956,13 @@ type Location, LocationLink, Location[] or LocationLink[]." ((&Range :start right-start) (lsp--location-range right))) (lsp--position-compare right-start left-start))))) -(defun lsp--make-reference-params (&optional td-position include-declaration) +(defun lsp--make-reference-params (&optional td-position exclude-declaration) "Make a ReferenceParam object. If TD-POSITION is non-nil, use it as TextDocumentPositionParams object instead. -If INCLUDE-DECLARATION is non-nil, request the server to include declarations." +If EXCLUDE-DECLARATION is non-nil, request the server to include declarations." (let ((json-false :json-false)) (plist-put (or td-position (lsp--text-document-position-params)) - :context `(:includeDeclaration ,(or include-declaration json-false))))) + :context `(:includeDeclaration ,(lsp-json-bool (not exclude-declaration)))))) (defun lsp--cancel-request (id) "Cancel request with ID in all workspaces." @@ -6152,11 +6152,11 @@ REFERENCES? t when METHOD returns references." :display-action display-action :references? t)) -(cl-defun lsp-find-references (&optional include-declaration &key display-action) +(cl-defun lsp-find-references (&optional exclude-declaration &key display-action) "Find references of the symbol under point." (interactive "P") (lsp-find-locations "textDocument/references" - (list :context `(:includeDeclaration ,(lsp-json-bool include-declaration))) + (list :context `(:includeDeclaration ,(lsp-json-bool (not exclude-declaration)))) :display-action display-action :references? t))