Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ Changelog

Features:

- [vim-plugin] Introduces Commands for user actions (instead of having to
call the functions)
- [vim-plugin] Generate the VIM help from the plugin's code documentation
- [code-builder] Support for nullable types - @elythyr / @dantleech
- [code-builder] Generates typed property for PHP 7.4 - @elythyr
- [worse-reflection] Support for PHP 7.4 property types - @dantleech / @elythyr
Expand Down
72 changes: 8 additions & 64 deletions plugin/phpactor.vim → autoload/phpactor.vim
Original file line number Diff line number Diff line change
@@ -1,53 +1,12 @@
" ______ __ __ .______ ___ ______ .___________. ______ .______
" | _ \ | | | | | _ \ / \ / || | / __ \ | _ \
" | |_) | | |__| | | |_) | / ^ \ | ,----'`---| |----`| | | | | |_) |
" | ___/ | __ | | ___/ / /_\ \ | | | | | | | | | /
" | | | | | | | | / _____ \ | `----. | | | `--' | | |\ \----.
" | _| |__| |__| | _| /__/ \__\ \______| |__| \______/ | _| `._____|
""
" @section Introduction, intro
" @library
" @order intro config completion commands mappings
"
" Phpactor is a auto-completion, refactoring and code-navigation tool for PHP.
" This is the help file for the VIM client. For more information see the
" official website: https://phpactor.github.io/phpactor/

if exists('g:phpactorLoaded')
finish
endif

let g:phpactorLoaded = 1
let g:phpactorpath = expand('<sfile>:p:h') . '/..'
let g:phpactorbinpath = g:phpactorpath. '/bin/phpactor'
let g:phpactorInitialCwd = getcwd()
let g:phpactorCompleteLabelTruncateLength=50
let g:_phpactorCompletionMeta = {}

if !exists('g:phpactorPhpBin')
let g:phpactorPhpBin = 'php'
endif

if !exists('g:phpactorBranch')
let g:phpactorBranch = 'master'
endif

if !exists('g:phpactorOmniAutoClassImport')
let g:phpactorOmniAutoClassImport = v:true
endif

if !exists('g:phpactorCompletionIgnoreCase')
let g:phpactorCompletionIgnoreCase = 1
endif

if !exists('g:phpactorQuickfixStrategy')
let g:phpactorQuickfixStrategy = 'phpactor#quickfix#vim'
endif

if !exists('g:phpactorInputListStrategy')
let g:phpactorInputListStrategy = 'phpactor#input#list#inputlist'
endif

if g:phpactorOmniAutoClassImport == v:true
autocmd CompleteDone *.php call phpactor#_completeImportClass(v:completed_item)
endif

"""""""""""""""""
" Update Phpactor
"""""""""""""""""
function! phpactor#Update()
let current = getcwd()
execute 'cd ' . g:phpactorpath
Expand All @@ -57,9 +16,6 @@ function! phpactor#Update()
execute 'cd ' . current
endfunction

""""""""""""""""""""""""
" Autocomplete
""""""""""""""""""""""""
function! phpactor#Complete(findstart, base)

let lineOffset = line2byte(line("."))
Expand Down Expand Up @@ -150,10 +106,6 @@ function! phpactor#_completeImportClass(completedItem)

endfunction

""""""""""""""""""""""""
" Extract method
""""""""""""""""""""""""

function! phpactor#ExtractMethod(...)
let positions = {}

Expand Down Expand Up @@ -215,9 +167,6 @@ function! phpactor#ClassExpand()
execute "normal! ciw" . namespace_prefix.word
endfunction

""""""""""""""""""""""""
" Insert a use statement
""""""""""""""""""""""""
function! phpactor#UseAdd()
call phpactor#ImportClass()
endfunction
Expand All @@ -228,9 +177,6 @@ function! phpactor#ImportMissingClasses()
call phpactor#rpc("import_missing_classes", {"source": phpactor#_source(), "path": expand('%:p')})
endfunction

"""""""""""""""""""""""""""
" RPC Proxy methods
"""""""""""""""""""""""""""
function! phpactor#_GotoDefinitionTarget(target)
call phpactor#rpc("goto_definition", {
\"offset": phpactor#_offset(),
Expand Down Expand Up @@ -368,7 +314,7 @@ endfunction
"""""""""""""""""""""""
" Utility functions
"""""""""""""""""""""""
" Return v:true if we changed file, v:false otherwise

function! phpactor#_switchToBufferOrEdit(filePath)
if expand('%:p') == a:filePath
" filePath is currently open
Expand Down Expand Up @@ -757,5 +703,3 @@ function! phpactor#_rpc_dispatch_input(inputs, action, parameters)

call TypeHandler(ResultHandler)
endfunction

" vim: et ts=4 sw=4 fdm=marker
28 changes: 28 additions & 0 deletions autoload/phpactor/completion.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
""
" @section Completion
"
" You will need to explcitly configure Phpactor to provide completion
" capabilities.
"
" @subsection Omni-Completion
"
" Use VIMs native omni-completion (|compl-omni|)
"
" Enbale omni-completion for PHP files: >
"
" autocmd FileType php setlocal omnifunc=phpactor#Complete
"
" For case sensitive searching see @setting(g:phpactorCompletionIgnoreCase)
"
" @subsection NCM2
"
" Nvim Completion Manager is a completion manager for Neovim.
"
" Install the integration plugin to get started: https://github.com/phpactor/ncm2-phpactor
"
" @subsection Deoplete
"
" Deoplete is another completion plugin.
"
" Install the Deoplete Phpactor
" integration to get started: https://github.com/kristijanhusak/deoplete-phpactor
2 changes: 1 addition & 1 deletion config/travis/vim-plugin-test.sh
Original file line number Diff line number Diff line change
@@ -1 +1 @@
vim -Nu config/travis/.vimrc -c 'Vader! plugin/tests/*'
vim -Nu config/travis/.vimrc -c 'Vader! tests/VimPlugin/*'
2 changes: 1 addition & 1 deletion couscous.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ menu:
text: Integrations
relativeUrl: integrations.html
development:
text: Debugging Phpactor
text: Developing
relativeUrl: developing.html
rpc:
text: RPC Protocol
Expand Down
35 changes: 33 additions & 2 deletions doc/developing.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
---
currentMenu: developing
---
Debugging RPC and Phpactor
==========================

Debugging RPC
-------------
Expand Down Expand Up @@ -63,3 +61,36 @@ logging.enabled: true
logging.level: DEBUG
logging.path: phpactor.log
```

Documentation
-------------

Phpactor Documentation
----------------------

Phpactor uses [couscous](https://github.com/CouscousPHP/Couscous). In order to
develop the documentation (located in `doc/`) download the PHAR:

```bash
$ curl -OS http://couscous.io/couscous.phar
```

and run:

```
$ php couscous.phar preview
```

To run serve the documentation locally.

VIM Help
--------

The VIM plugin is documented in the _generated_ `doc/phpactor.txt` file.

Install the [vimdoc](https://github.com/google/vimdoc) tool, followw the
installation instructions and then run:

```bash
$ vimdoc .
```
Loading