Skip to content

Commit

Permalink
Remove the FZF / BAT quickfix list
Browse files Browse the repository at this point in the history
While this is a very nice and offers a nice experience its not without
it's drawbacks:

- FZF is asynchronous by design - we need a synchronous result #845
- It adds complication and branches behavior based on FZF (more
maintainence)
- It adds an additional step when wanting to _navigate through_ file
references.
- We cannot depend on the behavior of FZF, or know which version of FZF
the user has on their system.
- We need to maintain each strategy (and we have no tests for these)

The existing VIM quickfix list:

- Is simple
- Allows you to search and jump to a specific item
- Does not have preview or fuzzy search sadly
  • Loading branch information
dantleech committed Feb 9, 2020
1 parent 5a29716 commit 2f5b1a9
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 195 deletions.
166 changes: 0 additions & 166 deletions autoload/phpactor/quickfix.vim

This file was deleted.

24 changes: 0 additions & 24 deletions doc/vim-plugin.md
Expand Up @@ -331,30 +331,6 @@ Use `<tab>` to toggle selection and CTRL-A/CTRL-D to select all/select none.
See the
[Fzf](https://github.com/junegunn/fzf) documentation for more details.

Quickfix List
-------------

The quickfix list is used to show a list of positions in files and access them
quickly. Phpactor use it for example to show the result of `find references`.

### Strategies

This plugin provides two strategy to handle input lists:

- `vim`: Vim's basic quickfix.
- `fzf`: Use [fzf](#fzf) to show allow you to filter the results.

With the [fzf](#fzf) strategy you will still be able to get the result inside
the quickfix by selecting the elements you are interested in and pressing
`ctrl-q` to populate the quickfix with your selection and open it.

You can use your own strategy by providing a `Funcref` to the
`g:phpactorQuickfixStrategy` variable. When calling a strategy the list of
positions is given as a list that is directly usable by the function
`setqflist()`. Not all the keys are provided, depending on the context, so
you should always check if the information you want is really defined before
using it.

Extras
------

Expand Down
19 changes: 14 additions & 5 deletions plugin/phpactor.vim
Expand Up @@ -37,10 +37,6 @@ if !exists('g:phpactorCompletionIgnoreCase')
let g:phpactorCompletionIgnoreCase = 1
endif

if !exists('g:PhpactorQuickfixStrategy')
let g:PhpactorQuickfixStrategy = v:null
endif

if g:phpactorOmniAutoClassImport == v:true
autocmd CompleteDone *.php call phpactor#_completeImportClass(v:completed_item)
endif
Expand Down Expand Up @@ -627,7 +623,20 @@ function! phpactor#_rpc_dispatch(actionName, parameters)
endfor
endfor

call phpactor#quickfix#build(results)
" add results to the quick fix list
call setqflist(results)

" if there is only one file, and it is the open file, don't
" bother opening the quick fix window
if len(a:parameters['file_references']) == 1
let fileRefs = a:parameters['file_references'][0]
if -1 != match(fileRefs['file'], bufname('%') . '$')
return
endif
endif

" show the quick fix window
execute ':cwindow'

return
endif
Expand Down

0 comments on commit 2f5b1a9

Please sign in to comment.