|
157 | 157 | (replace_file_source . phpactor-action-replace-file-source))) |
158 | 158 |
|
159 | 159 | ;; Helper functions: |
160 | | -(cl-defun phpactor--action-input-parameters (type &key default label choices) |
| 160 | +(cl-defun phpactor--action-input-parameters (value-type &key default label choices type) |
161 | 161 | "Request user input by parameters." |
162 | | - (let ((use-dialog-box nil)) |
| 162 | + (let ((use-dialog-box nil) |
| 163 | + (type (if type (intern type) value-type))) |
163 | 164 | (cl-case type |
164 | 165 | (file (read-file-name label nil default)) |
165 | 166 | (text (read-string label default)) |
|
185 | 186 | unless value |
186 | 187 | do (setq parameters (plist-put parameters key |
187 | 188 | (plist-get input-vars key)))) |
| 189 | + (cl-loop for (key value) on input-vars by #'cddr |
| 190 | + do (message "key:%s value:%s input:%s" |
| 191 | + key value (plist-get input-vars key)) |
| 192 | + unless (plist-member parameters key) |
| 193 | + do (setq parameters (plist-put parameters key |
| 194 | + (plist-get input-vars key)))) |
188 | 195 | parameters) |
189 | 196 |
|
190 | 197 | (defun phpactor--command-argments-1 (key) |
|
194 | 201 | (point-min) (point-max))) |
195 | 202 | (:path buffer-file-name) |
196 | 203 | (:offset (1- (point))) |
| 204 | + (:current_path buffer-file-name) |
197 | 205 | (t (error "`%s' is unknown argument" key)))) |
198 | 206 |
|
199 | 207 | (defun phpactor--command-argments (&rest arg-keys) |
|
316 | 324 | (let ((arguments (phpactor--command-argments :source :path))) |
317 | 325 | (apply #'phpactor-action-dispatch (phpactor--rpc "transform" arguments)))) |
318 | 326 |
|
| 327 | +;;;###autoload |
| 328 | +(defun phpactor-context-menu () |
| 329 | + "Execute Phpactor PRC context_menu command." |
| 330 | + (interactive) |
| 331 | + (let ((arguments (phpactor--command-argments :source :offset :current_path))) |
| 332 | + (apply #'phpactor-action-dispatch (phpactor--rpc "context_menu" arguments)))) |
| 333 | + |
319 | 334 | ;;;###autoload |
320 | 335 | (defun phpactor-navigate () |
321 | 336 | "Execute Phpactor RPC navigate command." |
|
0 commit comments