Skip to content

Commit 08f5c0c

Browse files
authored
Merge pull request #460 from MaskRay/rename
lsp-rename: change prompt
2 parents e2edc74 + 1924261 commit 08f5c0c

File tree

1 file changed

+4
-13
lines changed

1 file changed

+4
-13
lines changed

lsp-methods.el

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2306,26 +2306,17 @@ A reference is highlighted only if it is visible in a window."
23062306
`(:query ,pattern)))))
23072307
(seq-map #'lsp--symbol-information-to-xref symbols)))
23082308

2309-
(defun lsp--make-document-rename-params (newname)
2310-
"Make DocumentRangeFormattingParams for selected region.
2311-
interface RenameParams {
2312-
textDocument: TextDocumentIdentifier;
2313-
position: Position;
2314-
newName: string;
2315-
}"
2316-
`(:position ,(lsp--cur-position)
2317-
:textDocument ,(lsp--text-document-identifier)
2318-
:newName ,newname))
2319-
23202309
(defun lsp-rename (newname)
23212310
"Rename the symbol (and all references to it) under point to NEWNAME."
2322-
(interactive (list (read-string "Rename to: " (thing-at-point 'symbol))))
2311+
(interactive (list (read-string (format "Rename %s to: " (thing-at-point 'symbol t)))))
23232312
(lsp--cur-workspace-check)
23242313
(unless (lsp--capability "renameProvider")
23252314
(signal 'lsp-capability-not-supported (list "renameProvider")))
23262315
(let ((edits (lsp--send-request (lsp--make-request
23272316
"textDocument/rename"
2328-
(lsp--make-document-rename-params newname)))))
2317+
`(:textDocument ,(lsp--text-document-identifier)
2318+
:position ,(lsp--cur-position)
2319+
:newName ,newname)))))
23292320
(when edits
23302321
(lsp--apply-workspace-edit edits))))
23312322

0 commit comments

Comments
 (0)