Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Phpactor and VIM

568 views

Published on

Phpactor is a PHP intellisense and refactoring tool which can integrate with VIM

Published in: Engineering
  • Be the first to comment

  • Be the first to like this

Phpactor and VIM

  1. 1. PHP Intellisense and Refactoring Tool Phpactor Works with
  2. 2. About Me ● @dantleech ● github.com/dantleech ● PHP Developer ● Phpbench ● Symfony CMF / PHPCR
  3. 3. Why Phpactor?
  4. 4. Things I wanted ● Cotext-aware auto-complete ● Moving classes and updating references ● Finding references ● Renaming ● Class generation ● Class inflection
  5. 5. Things I had ● “already seen” / ctag / php function completion ● Class import via. Ctags (vim-php-namespace) ● Git grep (fugitive) ● for file in `git ls-files`; do perl -pie ‘s/foo/bar` $file; done … ● Nerdtree ● Syntastic ● Argument wrapping (vim-argwrap)
  6. 6. Phpactor ● Always waiting for somebody else to write one. ● First attempt Sep 24th 2015 ● +5 Second attempt Feb 14th 2016 ● +10 Third attempt Novemeber 24th 2016 ● +8 Forth and final attempt June 19th 2016
  7. 7. Phpactor ● Standalone CLI application. ● Backend for text editors.
  8. 8. Architecture
  9. 9. Worse Reflection ● Based on BetterReflection* … ● Provides class reflection from an AST. ● AST provided by Tolerant PHP Parser. ● Locates source code with autoloader. ● Can build frames.
  10. 10. Standalone Tool ● Class move ● Class copy ● Class transform (implement interfaces, complete constructor etc) ● New class ● Class inflect (new class based on an existing) ● Debug frames ● References / renaming / etc
  11. 11. And Globs!
  12. 12. Standalone demo
  13. 13. For Editors: RPC
  14. 14. RPC Demo from CLI https://github.com/phpactor/phpactor/blob/master/doc/rpc.md
  15. 15. VIM Plugin ● 100% Vimscript! ● Bundled with Phpactor (currently). ● Most logic handled in Phpactor. ● My first VIM plugin (basically).
  16. 16. Commands
  17. 17. Demo!
  18. 18. Next Steps ● Contextual actions (improve UX). ● Option to enable indexing / caching ● Language Server Implementation ● Improved reflection
  19. 19. Links @dantleech / @phpactor github.com/phpactor

×