Skip to content

Commit 5dc3316

Browse files
authored
Merge pull request #112 from emacs-php/merge/develop
Merge develop branch
2 parents bc7c75e + da9fd01 commit 5dc3316

File tree

8 files changed

+945
-1053
lines changed

8 files changed

+945
-1053
lines changed

.travis.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# matrix:
2+
# include:
3+
# - language: emacs-lisp
4+
# sudo: no
5+
# env:
6+
# - EVM_EMACS=emacs-25.1-travis
7+
# before_install:
8+
# - curl -fsSkL https://gist.github.com/rejeep/ebcd57c3af83b049833b/raw > travis.sh && source ./travis.sh
9+
# - evm install "$EVM_EMACS" --use --skip
10+
# install:
11+
# - cask --debug --verbose
12+
# script:
13+
# - cask exec buttercup -L . -p phpactor-install-or-update
14+
# - cd ~/.emacs.d/phpactor && composer install --no-dev
15+
# - cd -
16+
17+
# - language: php
18+
# php:
19+
# - 7.2
20+
# script:
21+
# - cd ~/.emacs.d/phpactor && composer install --no-dev
22+
23+
language: php
24+
php:
25+
- 7.1
26+
sudo: no
27+
env:
28+
- EVM_EMACS=emacs-25.1-travis
29+
before_install:
30+
- curl -fsSkL https://gist.github.com/rejeep/ebcd57c3af83b049833b/raw > travis.sh && source ./travis.sh
31+
- evm install "$EVM_EMACS" --use --skip
32+
install:
33+
- cask --debug --verbose
34+
script:
35+
- cask exec buttercup -L .
36+
# - cask exec buttercup -L . -p phpactor-install-or-update # running only this test prepares ./emacs.d/phpactor folder
37+
# - cd ~/.emacs.d/phpactor && composer install --no-dev
38+
# - cd - && cask exec buttercup -L .

Cask

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
(package "phpactor" "0.1.0" "Interface to Phpactor")
22
(source melpa)
3+
(source gnu)
34

45
(package-file "phpactor.el")
56
(package-file "company-phpactor.el")
67

78
(development
89
(depends-on "php-mode")
9-
(depends-on "auto-complete"))
10+
(depends-on "buttercup"))

README.org

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,47 @@ This package is Emacs interface to [[http://phpactor.github.io/phpactor/][Phpact
1111
#+END_HTML
1212
** Instalation
1313

14-
After having installed this package, run `phpactor-update` (this will install a supported version of phpactor inside phpactor.el's installation folder).
15-
*NOTICE*: To ensure the appropriate version of Phpactor is installed, please run this command after every upgrade of phpactor.el
14+
*Requirement*: You need to have composer globally installed.
15+
16+
Installation with use-package :
17+
18+
#+BEGIN_SRC emacs-lisp
19+
(use-package phpactor :ensure t)
20+
(use-package company-phpactor :ensure t)
21+
(use-package php-mode
22+
;;
23+
:hook ((php-mode . (lambda () (set (make-local-variable 'company-backends)
24+
'(;; list of backends
25+
company-phpactor
26+
company-files
27+
))))))
28+
#+END_SRC
29+
30+
After having installed this package, run `phpactor-install-or-update` (this will install a supported version of phpactor inside `.emacs.d/phpactor`).
31+
32+
*NOTICE*: To ensure the supported version of Phpactor is installed, you might need to run this command again after an upgrade of this package.
1633

1734
Alternatively, you can install Phpactor on your own and configure `phpactor-executable` but please be aware that any change in Phpactor's rpc protocol can introduce breakages.
1835

1936

2037
** Configuration
38+
*** eldoc integration
39+
40+
#+BEGIN_SRC elisp
41+
(add-hook 'php-mode-hook
42+
(lambda ()
43+
(make-local-variable 'eldoc-documentation-function)
44+
(setq eldoc-documentation-function
45+
'phpactor-hover)))
46+
#+END_SRC
47+
48+
*** phpactor itself
2149
See https://phpactor.github.io/phpactor/configuration.html
2250

2351
** Troubleshooting
2452

2553
You can run ``phpactor-status`` while visiting a project file.
2654

2755
If needed, configure [[https://github.com/emacs-php/php-mode/blob/1f04813f46219e626b385d0d96abefad914bfae0/php-project.el#L54][the way the project root is detected]] via .dir-locals.el
56+
57+
"*Phpactor Output*" buffer might also contain useful informations.

company-phpactor.el

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
;; Created: 18 Apr 2018
88
;; Version: 0.1.0
99
;; Keywords: tools, php
10-
;; Package-Requires: ((emacs "24.3") (cl-lib "0.5") (company "0.9.6") (phpactor "0.1.0"))
10+
;; Package-Requires: ((emacs "24.3") (company "0.9.6") (phpactor "0.1.0"))
1111
;; URL: https://github.com/emacs-php/phpactor.el
1212
;; License: GPL-3.0-or-later
1313

@@ -67,7 +67,9 @@ Here we create a temporary syntax table in order to add $ to symbols."
6767
(defun company-phpactor--post-completion (arg)
6868
"Trigger auto-import of completed item ARG when relevant."
6969
(if (get-text-property 0 'class_import arg)
70-
(phpactor-import-class (get-text-property 0 'class_import arg))))
70+
(phpactor-import-class (get-text-property 0 'class_import arg)))
71+
(if (member (get-text-property 0 'type arg) '(list "method" "function"))
72+
(let ((parens-require-spaces nil)) (insert-parentheses))))
7173

7274
(defun company-phpactor--annotation (arg)
7375
"Show additional info (ARG) from phpactor as lateral annotation."
@@ -77,14 +79,15 @@ Here we create a temporary syntax table in order to add $ to symbols."
7779
(defun company-phpactor (command &optional arg &rest ignored)
7880
"`company-mode' completion backend for Phpactor."
7981
(interactive (list 'interactive))
80-
(save-restriction
81-
(widen)
82-
(cl-case command
83-
(post-completion (company-phpactor--post-completion arg))
84-
(annotation (company-phpactor--annotation arg))
85-
(interactive (company-begin-backend 'company-phpactor))
86-
(prefix (company-phpactor--grab-symbol))
87-
(candidates (all-completions arg (company-phpactor--get-candidates))))))
82+
(when (phpactor-find-executable)
83+
(save-restriction
84+
(widen)
85+
(pcase command
86+
(`post-completion (company-phpactor--post-completion arg))
87+
(`annotation (company-phpactor--annotation arg))
88+
(`interactive (company-begin-backend 'company-phpactor))
89+
(`prefix (company-phpactor--grab-symbol))
90+
(`candidates (company-phpactor--get-candidates))))))
8891

8992
(provide 'company-phpactor)
9093
;;; company-phpactor.el ends here

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"psr-4": {"EmacsPHP\\Phpactor\\Sample\\": "tests/src/"}
1919
},
2020
"require": {
21-
"phpactor/phpactor": "^0.11.1"
21+
"phpactor/phpactor": "^0.12.0"
2222
},
2323
"config": {
2424
"classmap-authoritative": true,

0 commit comments

Comments
 (0)