lang/php: refactor + add company-php
This commit is contained in:
parent
ee44a1c572
commit
d949935628
2 changed files with 23 additions and 8 deletions
|
@ -9,13 +9,18 @@
|
||||||
(def-package! php-mode
|
(def-package! php-mode
|
||||||
:mode ("\\.php[s345]?$" "\\.inc$")
|
:mode ("\\.php[s345]?$" "\\.inc$")
|
||||||
:interpreter "php"
|
:interpreter "php"
|
||||||
:init
|
|
||||||
(add-hook 'php-mode-hook #'flycheck-mode)
|
|
||||||
:config
|
:config
|
||||||
|
(add-hook! 'php-mode-hook
|
||||||
|
#'(ac-php-core-eldoc-setup flycheck-mode))
|
||||||
|
|
||||||
(setq php-template-compatibility nil)
|
(setq php-template-compatibility nil)
|
||||||
|
|
||||||
(set! :repl 'php-mode #'php-boris)
|
(set! :repl 'php-mode #'php-boris)
|
||||||
|
|
||||||
|
;; ac-php provides custom autocompletion, php-extras provides autocompletion
|
||||||
|
;; for built-in libraries
|
||||||
|
(set! :company-backend 'php-mode '(company-ac-php-backend php-extras-company))
|
||||||
|
|
||||||
;; default is 10; this optimizes `smartparens' performance, but limits sp
|
;; default is 10; this optimizes `smartparens' performance, but limits sp
|
||||||
;; pairs to 6 characters.
|
;; pairs to 6 characters.
|
||||||
(add-hook! php-mode (setq-local sp-max-pair-length 6))
|
(add-hook! php-mode (setq-local sp-max-pair-length 6))
|
||||||
|
@ -44,17 +49,14 @@
|
||||||
(def-package! php-extras
|
(def-package! php-extras
|
||||||
:after php-mode
|
:after php-mode
|
||||||
:init
|
:init
|
||||||
(add-hook 'php-mode-hook #'eldoc-mode)
|
;; company will set up itself
|
||||||
|
(advice-add #'php-extras-company-setup :override #'ignore)
|
||||||
:config
|
:config
|
||||||
(setq php-extras-eldoc-functions-file (concat doom-etc-dir "php-extras-eldoc-functions"))
|
(setq php-extras-eldoc-functions-file (concat doom-etc-dir "php-extras-eldoc-functions"))
|
||||||
|
|
||||||
(set! :company-bakend 'php-mode '(php-extras-company company-yasnippet))
|
|
||||||
|
|
||||||
;; company will set up itself
|
|
||||||
(advice-add #'php-extras-company-setup :override #'ignore)
|
|
||||||
|
|
||||||
;; Make expensive php-extras generation async
|
;; Make expensive php-extras generation async
|
||||||
(unless (file-exists-p (concat php-extras-eldoc-functions-file ".el"))
|
(unless (file-exists-p (concat php-extras-eldoc-functions-file ".el"))
|
||||||
|
(message "Generating PHP eldoc files...")
|
||||||
(async-start `(lambda ()
|
(async-start `(lambda ()
|
||||||
,(async-inject-variables "\\`\\(load-path\\|php-extras-eldoc-functions-file\\)$")
|
,(async-inject-variables "\\`\\(load-path\\|php-extras-eldoc-functions-file\\)$")
|
||||||
(require 'php-extras-gen-eldoc)
|
(require 'php-extras-gen-eldoc)
|
||||||
|
@ -76,6 +78,16 @@
|
||||||
(def-package! php-boris :commands php-boris)
|
(def-package! php-boris :commands php-boris)
|
||||||
|
|
||||||
|
|
||||||
|
(def-package! company-php
|
||||||
|
:when (featurep! :completion company)
|
||||||
|
:commands (company-ac-php-backend ac-php-remake-tags ac-php-remake-tags-all ac-php-core-eldoc-setup)
|
||||||
|
:config
|
||||||
|
(unless (executable-find "phpctags")
|
||||||
|
(warn "php-mode: phpctags isn't installed, auto-completion will be gimped"))
|
||||||
|
|
||||||
|
(setq ac-php-tags-path (concat doom-cache-dir "ac-php/")))
|
||||||
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
;; Projects
|
;; Projects
|
||||||
;;
|
;;
|
||||||
|
|
|
@ -7,6 +7,9 @@
|
||||||
(package! php-refactor-mode)
|
(package! php-refactor-mode)
|
||||||
(package! phpunit)
|
(package! phpunit)
|
||||||
|
|
||||||
|
(when (featurep! :completion company)
|
||||||
|
(package! company-php))
|
||||||
|
|
||||||
;; (package! hack-mode
|
;; (package! hack-mode
|
||||||
;; :recipe
|
;; :recipe
|
||||||
;; (:fetcher url :url "https://raw.githubusercontent.com/facebook/hhvm/master/hphp/hack/editor-plugins/emacs/hack-mode.el"))
|
;; (:fetcher url :url "https://raw.githubusercontent.com/facebook/hhvm/master/hphp/hack/editor-plugins/emacs/hack-mode.el"))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue