Skip to content

Commit ca7aba2

Browse files
committed
Add phpactor-index:build and phpactor-file:info command
1 parent 2ce9d1b commit ca7aba2

1 file changed

Lines changed: 18 additions & 1 deletion

File tree

phpactor.el

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,13 +283,30 @@ Otherwise, use cached results if the buffer already exists and is populated."
283283
(alist-get input alist nil nil #'equal))))
284284
(let ((default-directory (phpactor-get-working-dir)))
285285
(compile (phpactor--make-command-string "index:query" identifier))))
286+
287+
(defun phpactor-index:build (force-update)
288+
"Execute Phpactor `index:build' sub command.
289+
If FORCE-UPDATE is non-NIL, purge index before building."
290+
(interactive (list (> (prefix-numeric-value current-prefix-arg) 1)))
291+
(let ((default-directory (phpactor-get-working-dir)))
292+
(compile (if force-update
293+
(phpactor--make-command-string "index:build" "--reset")
294+
(phpactor--make-command-string "index:build")))))
295+
296+
(defun phpactor-file:info ()
297+
"Execute Phpactor `index:build' sub command.
298+
If FORCE-UPDATE is non-NIL, purge index before building."
299+
(interactive)
300+
(let ((default-directory (phpactor-get-working-dir)))
301+
(compile (phpactor--make-command-string "file:info" buffer-file-name))))
302+
286303

287304
;; Phpactor RPC
288305
(defun phpactor--rpc (action arguments)
289306
"Execute Phpactor ACTION subcommand with ARGUMENTS."
290307
(phpactor--add-history 'phpactor--rpc (list action arguments))
291308
(let ((json (phpactor--serialize-json (list :action action
292-
:parameters arguments)))
309+
:parameters arguments)))
293310
(output (get-buffer-create "*Phpactor Output*"))
294311
(coding-system-for-write 'utf-8)
295312
(cwd (phpactor-get-working-dir)))

0 commit comments

Comments
 (0)