Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Definition is not declaration (#3655) #4613

Merged
merged 1 commit into from
Nov 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions lsp-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,12 @@ If this is set to nil, `eldoc' will show only the symbol information."
:type 'boolean
:group 'lsp-mode)

(defcustom lsp-references-exclude-definition nil
(define-obsolete-variable-alias
'lsp-references-exclude-definition
'lsp-references-exclude-declaration
"9.0.1")

(defcustom lsp-references-exclude-declaration nil
"If non-nil, exclude declarations when finding references."
:type 'boolean
:group 'lsp-mode)
Expand Down Expand Up @@ -6472,7 +6477,7 @@ perform the request synchronously."
(goto-char (cl-rest (or (assoc identifier lsp--symbols-cache)
(user-error "Unable to find symbol %s" identifier)))))
(lsp--locations-to-xref-items (lsp-request "textDocument/references"
(lsp--make-reference-params nil lsp-references-exclude-definition)))))
(lsp--make-reference-params nil lsp-references-exclude-declaration)))))

(cl-defmethod xref-backend-apropos ((_backend (eql xref-lsp)) pattern)
(seq-map #'lsp--symbol-information-to-xref
Expand Down Expand Up @@ -6653,7 +6658,7 @@ REFERENCES? t when METHOD returns references."
"Find references of the symbol under point."
(interactive "P")
(lsp-find-locations "textDocument/references"
(list :context `(:includeDeclaration ,(lsp-json-bool (not (or exclude-declaration lsp-references-exclude-definition)))))
(list :context `(:includeDeclaration ,(lsp-json-bool (not (or exclude-declaration lsp-references-exclude-declaration)))))
:display-action display-action
:references? t))

Expand Down
Loading