Skip to content

Commit

Permalink
fix: adjust copen height when enable useQuickfixForLocations (#2414)
Browse files Browse the repository at this point in the history
default height of `copen` is 10, if the items are less than 10,
we should set height manually to make the behavior like default coclist's.
  • Loading branch information
kevinhwang91 authored Oct 9, 2020
1 parent f176d09 commit fe735f3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,9 @@ export class Workspace implements IWorkspace {
const preferences = this.getConfiguration('coc.preferences')
if (preferences.get<boolean>('useQuickfixForLocations', false)) {
let openCommand = await nvim.getVar('coc_quickfix_open_command') as string
nvim.command(typeof openCommand === 'string' ? openCommand : 'copen', true)
if (typeof openCommand != 'string') {
openCommand = items.length < 10 ? `copen ${items.length}` : 'copen'
}
nvim.pauseNotification()
nvim.call('setqflist', [items], true)
nvim.command(openCommand, true)
Expand Down

0 comments on commit fe735f3

Please sign in to comment.