-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement phpactor-action-collection #39
Implement phpactor-action-collection #39
Conversation
phpactor.el
Outdated
"WIP: Executes a collection of actions." | ||
(mapc | ||
(lambda (action) | ||
(apply #'phpactor-action-dispatch (phpactor--rpc (plist-get action :name) (plist-get action :parameters))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm, this does not work for the close_file
action. close_file
should not trigger a rpc call, but should only be handled within emacs
phpactor.el
Outdated
@@ -281,7 +281,7 @@ | |||
|
|||
(cl-defun phpactor-action-close-file (&key path) | |||
"Close file from Phpactor." | |||
(message "close-file action")) | |||
(kill-buffer (find-file-noselect path))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does the job but as path
is the path before renaming, it sends a warning
"File
path
no longer exists!"
aeea96d
to
aca70a1
Compare
154f635
to
bfbae17
Compare
I don't see what to change/add for now, but this needs to be tested a bit. My plan is to use that for some days and see how it behaves. Any input welcome :-) |
bfbae17
to
c102f64
Compare
2 small issues to fix
|
phpactor.el
Outdated
@@ -177,6 +177,7 @@ | |||
(let ((use-dialog-box nil) | |||
(type (if type (intern type) value-type))) | |||
(cl-case type | |||
(confirm (yes-or-no-p label)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: You can use y-or-n-p
instead of yes-or-no-p
. There is no clear standard between these, but in general it is preferable to use yes-or-no-p
for "serious" choices.
The issue with answering no is that the action is just looping on itself from here (cl-defun phpactor-action-input-callback (&key callback inputs)
"Require `INPUTS' and dispatch `CALLBACK'."
(let* ((input-vars (phpactor-action--collect-inputs inputs))
(parameters (phpactor-action--fill-vars (plist-get callback :parameters) input-vars)))
(message "%s" callback)
(apply #'phpactor-action-dispatch (phpactor--rpc (plist-get callback :action) parameters))))
(:dest_path /path/newfile.php" :confirmed nil :source_path "/path/origfile.php") |
phpactor.el
Outdated
@@ -177,7 +177,8 @@ | |||
(let ((use-dialog-box nil) | |||
(type (if type (intern type) value-type))) | |||
(cl-case type | |||
(confirm (y-or-n-p label)) | |||
(confirm (if (y-or-n-p label) t | |||
(error "Action cancelled"))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure using error
is the most appropriate thing to do, but at least, it stops the endless confirmation loop
LGTM |
thanks @zonuexe |
phpactor sometimes need to run a sequence of actions, which this commit adds support for. In order to support class renaming, phpactor-action-close-file is also added. resolves emacs-php#36 (class renaming)
3660fc7
to
c2f4c3d
Compare
👍 |
resolves #36