File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change 77; ; Created: 8 Apr 2018
88; ; Version: 0.1.0
99; ; Keywords: tools, php
10- ; ; Package-Requires: ((emacs "24.4") (cl-lib "0.5") (f "0.17") (php-runtime "0.2") (composer "0.1"))
10+ ; ; Package-Requires: ((emacs "24.4") (cl-lib "0.5") (f "0.17") (php-runtime "0.2") (composer "0.1") (async "1.9.3") )
1111; ; URL: https://github.com/emacs-php/phpactor.el
1212; ; License: GPL-3.0-or-later
1313
5252(require 'ring )
5353(require 'subr-x )
5454(require 'composer )
55+ (require 'async )
5556
5657; ; Custom variables
5758;;;### autoload
@@ -223,6 +224,20 @@ have to ensure a compatible version of phpactor is used."
223224 (call-process-region (point-min ) (point-max ) phpactor-executable nil output nil " rpc" (format " --working-dir=%s " default-directory))
224225 (phpactor--parse-json output))))
225226
227+ (defun phpactor--rpc-async (action arguments callback )
228+ " Async execute Phpactor `ACTION' subcommand with `ARGUMENTS' and calling `CALLBACK' after process."
229+ (declare (indent 2 ))
230+ (phpactor--add-history 'phpactor--rpc-async (list action arguments))
231+ (let* ((json (phpactor--serialize-json (list :action action
232+ :parameters arguments)))
233+ (coding-system-for-write 'utf-8 )
234+ (executable phpactor-executable)
235+ (proc (async-start-process
236+ " phpactor-async" executable callback
237+ " rpc" (format " --working-dir=%s " (phpactor-get-working-dir)))))
238+ (process-send-string proc json)
239+ (process-send-eof proc)))
240+
226241(defun phpactor--parse-json (buffer )
227242 " Read JSON string from BUFFER."
228243 (with-current-buffer buffer
You can’t perform that action at this time.
0 commit comments