lang/php: prioritize phpctags in PATH
And fail more gracefully if phpctags isn't installed
This commit is contained in:
parent
5aef36951d
commit
f0f2c92b8d
2 changed files with 18 additions and 2 deletions
|
@ -13,3 +13,12 @@ ignore the cache."
|
||||||
(require 'json)
|
(require 'json)
|
||||||
(json-read-file package-file))))
|
(json-read-file package-file))))
|
||||||
(puthash project-root data +php-composer-conf))))))
|
(puthash project-root data +php-composer-conf))))))
|
||||||
|
|
||||||
|
;;;###autoload
|
||||||
|
(defun +php|init-ac-php-core-eldoc ()
|
||||||
|
"Initialize eldoc support for `php-mode' with `ac-php-core'. Fails gracefully
|
||||||
|
if phpctags isn't installed."
|
||||||
|
(require 'company-php)
|
||||||
|
(if (file-exists-p ac-php-ctags-executable)
|
||||||
|
(ac-php-core-eldoc-setup)
|
||||||
|
(message "phpctags is missing; eldoc support is disabled")))
|
||||||
|
|
|
@ -74,10 +74,17 @@
|
||||||
(def-package! company-php
|
(def-package! company-php
|
||||||
:when (featurep! :completion company)
|
:when (featurep! :completion company)
|
||||||
:commands (ac-php-remake-tags ac-php-remake-tags-all)
|
:commands (ac-php-remake-tags ac-php-remake-tags-all)
|
||||||
:hook (php-mode . ac-php-core-eldoc-setup)
|
|
||||||
:init
|
:init
|
||||||
(add-to-list '+php--company-backends 'company-ac-php-backend nil #'eq)
|
(add-to-list '+php--company-backends 'company-ac-php-backend nil #'eq)
|
||||||
:config (setq ac-php-tags-path (concat doom-cache-dir "ac-php/")))
|
(add-hook 'php-mode-hook #'+php|init-ac-php-core-eldoc)
|
||||||
|
:config
|
||||||
|
(setq ac-php-tags-path (concat doom-cache-dir "ac-php/"))
|
||||||
|
;; prioritize phpctags in PATH
|
||||||
|
(when (file-in-directory-p ac-php-ctags-executable ac-php-root-directory)
|
||||||
|
(setq ac-php-ctags-executable
|
||||||
|
(or (executable-find "phpctags")
|
||||||
|
(if (file-exists-p ac-php-ctags-executable)
|
||||||
|
ac-php-ctags-executable)))))
|
||||||
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue