Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
5caff84
add support for generate_accessor rpc action
kermorgant Oct 31, 2018
9ca40db
remove cl-lib dependency from company-phpactor
kermorgant Nov 11, 2018
8099cbd
Documentation of phpactor's company backend setup
kermorgant Oct 28, 2018
3a0781f
Add a pair after completing with a function.
kermorgant Nov 11, 2018
b3e98f5
Add customize variable phpactor-package-directory
zonuexe Jan 5, 2019
88c735e
Require php-runtime package for PHP's copy() function
zonuexe Jan 5, 2019
4136409
Add constant phpactor--base-directory and prioritize it to locate-lib…
zonuexe Jan 5, 2019
45bf6cc
Rename and refactor phpactor-install-or-update
zonuexe Jan 5, 2019
72d2584
Modify doc comment to clarify intent
zonuexe Feb 5, 2019
52bff67
Rename phpactor-package-directory to phpactor-install-directory
zonuexe Feb 5, 2019
664815c
Expand phpactor--get-package-directory call to a variable
zonuexe Feb 5, 2019
7694639
Refactory phpactor--base-directory and modify doc comment
zonuexe Feb 5, 2019
7372826
Rename phpactor--lisp-directory and add strict check of file system
zonuexe Feb 5, 2019
d96a722
Add comment about reason not to use f-join
zonuexe Feb 5, 2019
4f84002
removal of redundant or unused code
kermorgant Jan 20, 2019
2c5f79b
Create .gitignore to prevent unnecessary files from being copied
zonuexe Feb 5, 2019
d180594
Merge pull request #86 from emacs-php/refactor/phpactor-update
zonuexe Feb 8, 2019
7e599c2
add support for add_missing_assignments transform
kermorgant Feb 23, 2019
ef1a54e
Merge pull request #90 from emacs-php/feature/add-missing-assignments
kermorgant Feb 23, 2019
4604dea
buttercup first tests with linked changes in phactor.el
kermorgant Feb 22, 2019
bbc845f
Merge pull request #89 from emacs-php/buttercup
kermorgant Mar 3, 2019
307b28e
upgrade to phpactor 0.12.0
kermorgant Mar 3, 2019
83a2a52
Merge pull request #91 from emacs-php/feature/phpactor-0.12.0
zonuexe Mar 4, 2019
ae484ea
Avoid use of context_menu rpc action for generate_accessor action
kermorgant Jan 18, 2019
0cd5619
Merge pull request #87 from emacs-php/generate-accessor-by-own-rpc-ac…
kermorgant Mar 4, 2019
5d7433a
Map replace_file_source to phpactor-action-update-file-source (#92)
kermorgant Mar 4, 2019
c9361bf
add support for class_new, class_inflect and extract_constant (#93)
kermorgant Mar 4, 2019
654f267
add support for generate_method refactoring (#97)
kermorgant Mar 5, 2019
dd73154
make find-references behave better with simpler code (#100)
kermorgant Mar 10, 2019
f193b22
add support for hover rpc action + documentation for it with eldoc (#…
kermorgant Mar 15, 2019
6ef9d33
update notices after rename of phpactor-update (#104)
kermorgant Mar 16, 2019
b11fe4d
bugfix for bug #95, using find-file-noselect (#105)
kermorgant Mar 16, 2019
d90acc7
update composer.lock (#107)
kermorgant Mar 16, 2019
0178df0
add phpactor-update-file-hook (#109)
kermorgant Mar 19, 2019
24a5746
return default-directory when php-project-get-root-dir fails (#110)
kermorgant Mar 20, 2019
199965f
check phpactor-find-executable before completion (#106)
kermorgant Mar 20, 2019
d0111bd
Declare phpactor-executable as defcustom
kermorgant Mar 17, 2019
4ef25b3
avoid compilation warnings for mandatory but unused arguments
kermorgant Mar 25, 2019
8701361
fix condition in company-phpactor
kermorgant Mar 29, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# matrix:
# include:
# - language: emacs-lisp
# sudo: no
# env:
# - EVM_EMACS=emacs-25.1-travis
# before_install:
# - curl -fsSkL https://gist.github.com/rejeep/ebcd57c3af83b049833b/raw > travis.sh && source ./travis.sh
# - evm install "$EVM_EMACS" --use --skip
# install:
# - cask --debug --verbose
# script:
# - cask exec buttercup -L . -p phpactor-install-or-update
# - cd ~/.emacs.d/phpactor && composer install --no-dev
# - cd -

# - language: php
# php:
# - 7.2
# script:
# - cd ~/.emacs.d/phpactor && composer install --no-dev

language: php
php:
- 7.1
sudo: no
env:
- EVM_EMACS=emacs-25.1-travis
before_install:
- curl -fsSkL https://gist.github.com/rejeep/ebcd57c3af83b049833b/raw > travis.sh && source ./travis.sh
- evm install "$EVM_EMACS" --use --skip
install:
- cask --debug --verbose
script:
- cask exec buttercup -L .
# - cask exec buttercup -L . -p phpactor-install-or-update # running only this test prepares ./emacs.d/phpactor folder
# - cd ~/.emacs.d/phpactor && composer install --no-dev
# - cd - && cask exec buttercup -L .
3 changes: 2 additions & 1 deletion Cask
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
(package "phpactor" "0.1.0" "Interface to Phpactor")
(source melpa)
(source gnu)

(package-file "phpactor.el")
(package-file "company-phpactor.el")

(development
(depends-on "php-mode")
(depends-on "auto-complete"))
(depends-on "buttercup"))
36 changes: 33 additions & 3 deletions README.org
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,47 @@ This package is Emacs interface to [[http://phpactor.github.io/phpactor/][Phpact
#+END_HTML
** Instalation

After having installed this package, run `phpactor-update` (this will install a supported version of phpactor inside phpactor.el's installation folder).
*NOTICE*: To ensure the appropriate version of Phpactor is installed, please run this command after every upgrade of phpactor.el
*Requirement*: You need to have composer globally installed.

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.
Installation with use-package :

#+BEGIN_SRC emacs-lisp
(use-package phpactor :ensure t)
(use-package company-phpactor :ensure t)
(use-package php-mode
;;
:hook ((php-mode . (lambda () (set (make-local-variable 'company-backends)
'(;; list of backends
company-phpactor
company-files
))))))
#+END_SRC

After having installed this package, run `phpactor-install-or-update` (this will install a supported version of phpactor inside `.emacs.d/phpactor`).

*NOTICE*: To ensure the supported version of Phpactor is installed, you might need to run this command again after an upgrade of this package.

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


** Configuration
*** eldoc integration

#+BEGIN_SRC elisp
(add-hook 'php-mode-hook
(lambda ()
(make-local-variable 'eldoc-documentation-function)
(setq eldoc-documentation-function
'phpactor-hover)))
#+END_SRC

*** phpactor itself
See https://phpactor.github.io/phpactor/configuration.html

** Troubleshooting

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

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

"*Phpactor Output*" buffer might also contain useful informations.
23 changes: 13 additions & 10 deletions company-phpactor.el
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
;; Created: 18 Apr 2018
;; Version: 0.1.0
;; Keywords: tools, php
;; Package-Requires: ((emacs "24.3") (cl-lib "0.5") (company "0.9.6") (phpactor "0.1.0"))
;; Package-Requires: ((emacs "24.3") (company "0.9.6") (phpactor "0.1.0"))
;; URL: https://github.com/emacs-php/phpactor.el
;; License: GPL-3.0-or-later

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

(defun company-phpactor--annotation (arg)
"Show additional info (ARG) from phpactor as lateral annotation."
Expand All @@ -77,14 +79,15 @@ Here we create a temporary syntax table in order to add $ to symbols."
(defun company-phpactor (command &optional arg &rest ignored)
"`company-mode' completion backend for Phpactor."
(interactive (list 'interactive))
(save-restriction
(widen)
(cl-case command
(post-completion (company-phpactor--post-completion arg))
(annotation (company-phpactor--annotation arg))
(interactive (company-begin-backend 'company-phpactor))
(prefix (company-phpactor--grab-symbol))
(candidates (all-completions arg (company-phpactor--get-candidates))))))
(when phpactor-executable
(save-restriction
(widen)
(pcase command
(`post-completion (company-phpactor--post-completion arg))
(`annotation (company-phpactor--annotation arg))
(`interactive (company-begin-backend 'company-phpactor))
(`prefix (company-phpactor--grab-symbol))
(`candidates (company-phpactor--get-candidates))))))

(provide 'company-phpactor)
;;; company-phpactor.el ends here
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"psr-4": {"EmacsPHP\\Phpactor\\Sample\\": "tests/src/"}
},
"require": {
"phpactor/phpactor": "^0.11.1"
"phpactor/phpactor": "^0.12.0"
},
"config": {
"optimize-autoloader": true,
Expand Down
Loading