|
90 | 90 | (expand-file-name |
91 | 91 | (or phpactor-working-dir (php-project-get-root-dir))))) |
92 | 92 |
|
| 93 | +(defun phpactor--expand-local-file-name (name) |
| 94 | + "Expand file name by `NAME'." |
| 95 | + ;; TODO: Support TRAMP |
| 96 | + (expand-file-name name)) |
| 97 | + |
93 | 98 | (defun phpactor--make-command-string (sub-command &rest args) |
94 | 99 | "Return command string by `SUB-COMMAND' and `ARGS'." |
95 | 100 | (declare (indent 1)) |
|
203 | 208 | (cl-case key |
204 | 209 | (:source (buffer-substring-no-properties |
205 | 210 | (point-min) (point-max))) |
206 | | - (:path buffer-file-name) |
| 211 | + (:path (phpactor--expand-local-file-name buffer-file-name)) |
| 212 | + (:source_path (phpactor--expand-local-file-name buffer-file-name)) |
207 | 213 | (:offset (1- (point))) |
208 | | - (:current_path buffer-file-name) |
| 214 | + (:current_path (phpactor--expand-local-file-name buffer-file-name)) |
209 | 215 | (t (error "`%s' is unknown argument" key)))) |
210 | 216 |
|
211 | 217 | (defun phpactor--command-argments (&rest arg-keys) |
|
304 | 310 | (defun phpactor-copy-class () |
305 | 311 | "Execute Phpactor RPC copy_class command." |
306 | 312 | (interactive) |
307 | | - (let ((arguments (list :source_path (expand-file-name buffer-file-name)))) |
| 313 | + (let ((arguments (phpactor--command-argments :source_path))) |
308 | 314 | (apply #'phpactor-action-dispatch (phpactor--rpc "copy_class" arguments)))) |
309 | 315 |
|
310 | 316 | ;;;###autoload |
311 | 317 | (defun phpactor-move-class () |
312 | 318 | "Execute Phpactor RPC move_class command." |
313 | 319 | (interactive) |
314 | | - (let ((arguments (list :source_path (expand-file-name buffer-file-name)))) |
| 320 | + (let ((arguments (phpactor--command-argments :source_path))) |
315 | 321 | (apply #'phpactor-action-dispatch (phpactor--rpc "move_class" arguments)))) |
316 | 322 |
|
317 | 323 | ;;;###autoload |
|
339 | 345 | (defun phpactor-navigate () |
340 | 346 | "Execute Phpactor RPC navigate command." |
341 | 347 | (interactive) |
342 | | - (let ((arguments (list :source_path (file-relative-name buffer-file-name |
343 | | - (phpactor-get-working-dir))))) |
| 348 | + (let ((arguments (phpactor--command-argments :source_path))) |
344 | 349 | (apply #'phpactor-action-dispatch (phpactor--rpc "navigate" arguments)))) |
345 | 350 |
|
346 | 351 | ;;;###autoload |
|
0 commit comments