Refactor lang/php
This commit is contained in:
parent
a4c14108c7
commit
f6f74efdee
1 changed files with 19 additions and 23 deletions
|
@ -1,5 +1,7 @@
|
||||||
;;; lang/php/config.el -*- lexical-binding: t; -*-
|
;;; lang/php/config.el -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
|
(defvar +php--company-backends nil)
|
||||||
|
|
||||||
;; (def-package! hack-mode
|
;; (def-package! hack-mode
|
||||||
;; :mode "\\.hh$"
|
;; :mode "\\.hh$"
|
||||||
;; :config
|
;; :config
|
||||||
|
@ -7,12 +9,9 @@
|
||||||
|
|
||||||
|
|
||||||
(def-package! php-mode
|
(def-package! php-mode
|
||||||
:mode "\\.php[s345]?$"
|
:mode "\\.inc\\'"
|
||||||
:mode "\\.inc$"
|
|
||||||
:interpreter "php"
|
:interpreter "php"
|
||||||
:config
|
:config
|
||||||
(add-hook 'php-mode-hook #'ac-php-core-eldoc-setup)
|
|
||||||
|
|
||||||
;; Disable HTML compatibility in php-mode. `web-mode' has superior support for
|
;; Disable HTML compatibility in php-mode. `web-mode' has superior support for
|
||||||
;; php+html. Use the .phtml
|
;; php+html. Use the .phtml
|
||||||
(setq php-template-compatibility nil)
|
(setq php-template-compatibility nil)
|
||||||
|
@ -22,10 +21,10 @@
|
||||||
|
|
||||||
;; ac-php provides custom autocompletion, php-extras provides autocompletion
|
;; ac-php provides custom autocompletion, php-extras provides autocompletion
|
||||||
;; for built-in libraries
|
;; for built-in libraries
|
||||||
(set-company-backend! 'php-mode '(company-ac-php-backend php-extras-company))
|
(when +php--company-backends
|
||||||
|
(set-company-backend! 'php-mode +php--company-backends))
|
||||||
|
|
||||||
;; default is 10; this optimizes `smartparens' performance, but limits sp
|
;; Use the smallest `sp-max-pair-length' for optimum `smartparens' performance
|
||||||
;; pairs to 6 characters.
|
|
||||||
(setq-hook! 'php-mode-hook sp-max-pair-length 6)
|
(setq-hook! 'php-mode-hook sp-max-pair-length 6)
|
||||||
|
|
||||||
(sp-with-modes '(php-mode)
|
(sp-with-modes '(php-mode)
|
||||||
|
@ -49,11 +48,16 @@
|
||||||
:n "s" #'phpunit-current-test)))
|
:n "s" #'phpunit-current-test)))
|
||||||
|
|
||||||
|
|
||||||
|
(def-package! php-refactor-mode
|
||||||
|
:hook php-mode)
|
||||||
|
|
||||||
|
|
||||||
(def-package! php-extras
|
(def-package! php-extras
|
||||||
:after php-mode
|
:after php-mode
|
||||||
:init
|
:init
|
||||||
;; company will set up itself
|
;; company will set up itself
|
||||||
(advice-add #'php-extras-company-setup :override #'ignore)
|
(advice-add #'php-extras-company-setup :override #'ignore)
|
||||||
|
(add-to-list '+php--company-backends 'php-extras-company nil #'eq)
|
||||||
:config
|
:config
|
||||||
(setq php-extras-eldoc-functions-file
|
(setq php-extras-eldoc-functions-file
|
||||||
(concat doom-etc-dir "php-extras-eldoc-functions"))
|
(concat doom-etc-dir "php-extras-eldoc-functions"))
|
||||||
|
@ -62,7 +66,7 @@
|
||||||
(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...")
|
(message "Generating PHP eldoc files...")
|
||||||
(require 'async)
|
(require 'async)
|
||||||
(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)
|
||||||
(php-extras-generate-eldoc-1 t))
|
(php-extras-generate-eldoc-1 t))
|
||||||
|
@ -71,20 +75,12 @@
|
||||||
(message "PHP eldoc updated!")))))
|
(message "PHP eldoc updated!")))))
|
||||||
|
|
||||||
|
|
||||||
(def-package! php-refactor-mode
|
|
||||||
:hook php-mode)
|
|
||||||
|
|
||||||
|
|
||||||
(def-package! phpunit
|
|
||||||
:commands (phpunit-current-test phpunit-current-class phpunit-current-project))
|
|
||||||
|
|
||||||
|
|
||||||
(def-package! php-boris :commands php-boris)
|
|
||||||
|
|
||||||
|
|
||||||
(def-package! company-php
|
(def-package! company-php
|
||||||
:when (featurep! :completion company)
|
:when (featurep! :completion company)
|
||||||
:commands (company-ac-php-backend ac-php-remake-tags ac-php-remake-tags-all ac-php-core-eldoc-setup)
|
:commands (ac-php-remake-tags ac-php-remake-tags-all)
|
||||||
|
:hook (php-mode . ac-php-core-eldoc-setup)
|
||||||
|
:init
|
||||||
|
(add-to-list '+php--company-backends 'company-ac-php-backend nil #'eq)
|
||||||
:config (setq ac-php-tags-path (concat doom-cache-dir "ac-php/")))
|
:config (setq ac-php-tags-path (concat doom-cache-dir "ac-php/")))
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue