Skip to content

Commit

Permalink
fix: quickfix exist files, using bufnr instead of the filename
Browse files Browse the repository at this point in the history
  • Loading branch information
weirongxu committed Jun 12, 2024
1 parent ff06ff9 commit 95f06b9
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/actions/globalActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,13 @@ import {
type TextobjTarget,
} from '../types';
import type { PreviewActionStrategy } from '../types/pkg-config';
import { enableWrapscan, input, scanIndexNext, scanIndexPrev } from '../util';
import {
enableWrapscan,
input,
logger,
scanIndexNext,
scanIndexPrev,
} from '../util';
import type { ActionExplorer } from './actionExplorer';
import { openAction } from './openAction';

Expand Down Expand Up @@ -784,10 +790,11 @@ export function loadGlobalActions(action: ActionExplorer) {
async ({ args, nodes, source }) => {
const argAction = (args[0] ?? 'replace') as QuickfixAction;
const action = { add: 'a', replace: 'r' }[argAction];
const list: { filename?: string }[] = await nvim.call('getqflist');
const list: { bufnr: number }[] = await nvim.call('getqflist');
const existFullpathes = list
.map((it) => it.filename)
.map((it) => source.bufManager.getBufferNode(it.bufnr)?.fullpath)
.filter(Boolean) as string[];
logger.debug(`existFullpathes ${existFullpathes.join(' | ')}`);
await nvim.call('setqflist', [
nodes
.filter((it) => it.fullpath && !it.expandable)
Expand Down

0 comments on commit 95f06b9

Please sign in to comment.