Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vscode.workspace.findFiles and WorkspaceFolder.uri inconsistency regarding Windows driver letter #200903

Merged
merged 1 commit into from
Dec 15, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { coalesce } from 'vs/base/common/arrays';
import { CancellationToken } from 'vs/base/common/cancellation';
import { groupBy } from 'vs/base/common/collections';
import { splitGlobAware } from 'vs/base/common/glob';
import * as path from 'vs/base/common/path';
import { createRegExp, escapeRegExpCharacters } from 'vs/base/common/strings';
import { URI } from 'vs/base/common/uri';
import { Progress } from 'vs/platform/progress/common/progress';
Expand Down Expand Up @@ -55,7 +54,7 @@ export class RipgrepTextSearchEngine {
});

let gotResult = false;
const ripgrepParser = new RipgrepParser(options.maxResults, cwd, options.previewOptions);
const ripgrepParser = new RipgrepParser(options.maxResults, options.folder, options.previewOptions);
ripgrepParser.on('result', (match: TextSearchResult) => {
gotResult = true;
dataWithoutResult = '';
Expand Down Expand Up @@ -184,7 +183,7 @@ export class RipgrepParser extends EventEmitter {

private numResults = 0;

constructor(private maxResults: number, private rootFolder: string, private previewOptions?: TextSearchPreviewOptions) {
constructor(private maxResults: number, private root: URI, private previewOptions?: TextSearchPreviewOptions) {
super();
this.stringDecoder = new StringDecoder();
}
Expand Down Expand Up @@ -253,7 +252,7 @@ export class RipgrepParser extends EventEmitter {

if (parsedLine.type === 'match') {
const matchPath = bytesOrTextToString(parsedLine.data.path);
const uri = URI.file(path.join(this.rootFolder, matchPath));
const uri = URI.joinPath(this.root, matchPath);
const result = this.createTextSearchMatch(parsedLine.data, uri);
this.onResult(result);

Expand All @@ -263,7 +262,7 @@ export class RipgrepParser extends EventEmitter {
}
} else if (parsedLine.type === 'context') {
const contextPath = bytesOrTextToString(parsedLine.data.path);
const uri = URI.file(path.join(this.rootFolder, contextPath));
const uri = URI.joinPath(this.root, contextPath);
const result = this.createTextSearchContext(parsedLine.data, uri);
result.forEach(r => this.onResult(r));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ suite('RipgrepTextSearchEngine', () => {
const TEST_FOLDER = URI.file('/foo/bar');

function testParser(inputData: string[], expectedResults: TextSearchResult[]): void {
const testParser = new RipgrepParser(1000, TEST_FOLDER.fsPath);
const testParser = new RipgrepParser(1000, TEST_FOLDER);

const actualResults: TextSearchResult[] = [];
testParser.on('result', r => {
Expand Down