Skip to content

Commit 7f27a8f

Browse files
authored
Handle javascript rename request (#2653)
1 parent ebb66dd commit 7f27a8f

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

clients/lsp-javascript.el

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,16 @@ directory containing the package. Example:
113113
'(:npm :package "typescript"
114114
:path "tsserver"))
115115

116+
(defun lsp-javascript--rename (_workspace args)
117+
(let ((path (lsp--uri-to-path (lsp-get (lsp-get args :textDocument) :uri))))
118+
(if (f-exists? path)
119+
(with-current-buffer (find-file path)
120+
(goto-char (lsp--position-to-point
121+
(lsp-get args :position))))
122+
(error "There is no file %s" path)))
123+
(call-interactively #'lsp-rename)
124+
nil)
125+
116126
(lsp-register-client
117127
(make-lsp-client :new-connection (lsp-stdio-connection (lambda ()
118128
`(,(lsp-package-path 'typescript-language-server)
@@ -128,6 +138,7 @@ directory containing the package. Example:
128138
:tsServerPath (lsp-package-path 'typescript)))
129139
:ignore-messages '("readFile .*? requested by TypeScript but content not available")
130140
:server-id 'ts-ls
141+
:request-handlers (ht ("_typescript.rename" #'lsp-javascript--rename))
131142
:download-server-fn (lambda (_client callback error-callback _update?)
132143
(lsp-package-ensure
133144
'typescript

0 commit comments

Comments
 (0)