Skip to content

Commit

Permalink
Definition is not declaration (#3655)
Browse files Browse the repository at this point in the history
  • Loading branch information
wyuenho committed Nov 14, 2024
1 parent c41769e commit 8f64ff5
Showing 1 changed file with 8 additions and 3 deletions.
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

0 comments on commit 8f64ff5

Please sign in to comment.