提交 fd76ad9f 编写于 作者: R Rob Lourens

#57186 - fix findTextInFiles

上级 02420dbe
...@@ -510,7 +510,7 @@ suite('workspace-namespace', () => { ...@@ -510,7 +510,7 @@ suite('workspace-namespace', () => {
}); });
}); });
test.skip('findTextInFiles', async () => { test('findTextInFiles', async () => {
const results: vscode.TextSearchResult[] = []; const results: vscode.TextSearchResult[] = [];
await vscode.workspace.findTextInFiles({ pattern: 'foo' }, { include: '*.ts' }, result => { await vscode.workspace.findTextInFiles({ pattern: 'foo' }, { include: '*.ts' }, result => {
results.push(result); results.push(result);
......
...@@ -151,7 +151,7 @@ export class ExtHostWorkspace implements ExtHostWorkspaceShape { ...@@ -151,7 +151,7 @@ export class ExtHostWorkspace implements ExtHostWorkspaceShape {
readonly onDidChangeWorkspace: Event<vscode.WorkspaceFoldersChangeEvent> = this._onDidChangeWorkspace.event; readonly onDidChangeWorkspace: Event<vscode.WorkspaceFoldersChangeEvent> = this._onDidChangeWorkspace.event;
private readonly _activeSearchCallbacks = []; private readonly _activeSearchCallbacks: ((match: IRawFileMatch2) => any)[] = [];
constructor( constructor(
mainContext: IMainContext, mainContext: IMainContext,
...@@ -410,14 +410,14 @@ export class ExtHostWorkspace implements ExtHostWorkspaceShape { ...@@ -410,14 +410,14 @@ export class ExtHostWorkspace implements ExtHostWorkspaceShape {
return; return;
} }
p.lineMatches.forEach(lineMatch => { p.matches.forEach(match => {
lineMatch.offsetAndLengths.forEach(offsetAndLength => { callback({
const range = new Range(lineMatch.lineNumber, offsetAndLength[0], lineMatch.lineNumber, offsetAndLength[0] + offsetAndLength[1]); uri: URI.revive(p.resource),
callback({ preview: {
uri: URI.revive(p.resource), text: match.preview.text,
preview: { text: lineMatch.preview, match: range }, match: new Range(match.preview.match.startLineNumber, match.preview.match.startColumn, match.preview.match.endLineNumber, match.preview.match.endColumn)
range },
}); range: new Range(match.range.startLineNumber, match.range.startColumn, match.range.endLineNumber, match.range.endColumn)
}); });
}); });
}; };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册