diff --git a/extensions/search-rg/src/utils.ts b/extensions/search-rg/src/utils.ts index 3ca8a39102e..f29a1fc0c55 100644 --- a/extensions/search-rg/src/utils.ts +++ b/extensions/search-rg/src/utils.ts @@ -22,9 +22,9 @@ export function anchorGlob(glob: string): string { export function createTextSearchResult(uri: vscode.Uri, fullText: string, range: vscode.Range, previewOptions?: vscode.TextSearchPreviewOptions): vscode.TextSearchResult { let preview: vscode.TextSearchResultPreview; if (previewOptions) { - const leadingChars = Math.floor(previewOptions.totalChars / 5); + const leadingChars = Math.floor(previewOptions.charsPerLine / 5); const previewStart = Math.max(range.start.character - leadingChars, 0); - const previewEnd = previewOptions.totalChars + previewStart; + const previewEnd = previewOptions.charsPerLine + previewStart; const endOfMatchRangeInPreview = Math.min(previewEnd, range.end.character - previewStart); preview = { diff --git a/extensions/vscode-api-tests/src/singlefolder-tests/workspace.test.ts b/extensions/vscode-api-tests/src/singlefolder-tests/workspace.test.ts index cfa5c3356c5..a78d1f72e87 100644 --- a/extensions/vscode-api-tests/src/singlefolder-tests/workspace.test.ts +++ b/extensions/vscode-api-tests/src/singlefolder-tests/workspace.test.ts @@ -514,8 +514,8 @@ suite('workspace-namespace', () => { const options: vscode.FindTextInFilesOptions = { include: '*.ts', previewOptions: { - maxLines: 1, - totalChars: 100 + matchLines: 1, + charsPerLine: 100 } }; diff --git a/src/vs/platform/search/common/search.ts b/src/vs/platform/search/common/search.ts index a4fcd0a44b0..b8391c3bd8d 100644 --- a/src/vs/platform/search/common/search.ts +++ b/src/vs/platform/search/common/search.ts @@ -140,8 +140,8 @@ export interface IFileMatch { export type IRawFileMatch2 = IFileMatch; export interface ITextSearchPreviewOptions { - maxLines: number; - totalChars: number; + matchLines: number; + charsPerLine: number; } export interface ISearchRange { @@ -237,9 +237,9 @@ export class TextSearchResult implements ITextSearchResult { constructor(fullLine: string, range: ISearchRange, previewOptions?: ITextSearchPreviewOptions) { this.range = range; if (previewOptions) { - const leadingChars = Math.floor(previewOptions.totalChars / 5); + const leadingChars = Math.floor(previewOptions.charsPerLine / 5); const previewStart = Math.max(range.startColumn - leadingChars, 0); - const previewEnd = previewOptions.totalChars + previewStart; + const previewEnd = previewOptions.charsPerLine + previewStart; const endOfMatchRangeInPreview = Math.min(previewEnd, range.endColumn - previewStart); this.preview = { diff --git a/src/vs/platform/search/test/common/search.test.ts b/src/vs/platform/search/test/common/search.test.ts index f1a4b9b9cce..1067f21ce3a 100644 --- a/src/vs/platform/search/test/common/search.test.ts +++ b/src/vs/platform/search/test/common/search.test.ts @@ -10,8 +10,8 @@ import { ITextSearchPreviewOptions, OneLineRange, TextSearchResult } from 'vs/pl suite('TextSearchResult', () => { const previewOptions1: ITextSearchPreviewOptions = { - maxLines: 1, - totalChars: 100 + matchLines: 1, + charsPerLine: 100 }; function assertPreviewRangeText(text: string, result: TextSearchResult): void { @@ -71,8 +71,8 @@ suite('TextSearchResult', () => { test('truncating match', () => { const previewOptions: ITextSearchPreviewOptions = { - maxLines: 1, - totalChars: 1 + matchLines: 1, + charsPerLine: 1 }; const range = new OneLineRange(0, 4, 7); diff --git a/src/vs/vscode.proposed.d.ts b/src/vs/vscode.proposed.d.ts index 3807fe1a9b6..ac12bb7dafc 100644 --- a/src/vs/vscode.proposed.d.ts +++ b/src/vs/vscode.proposed.d.ts @@ -97,12 +97,12 @@ declare module 'vscode' { * The maximum number of lines in the preview. * Only search providers that support multiline search will ever return more than one line in the match. */ - maxLines: number; + matchLines: number; /** * The maximum number of characters included per line. */ - totalChars: number; + charsPerLine: number; } /** diff --git a/src/vs/workbench/api/node/extHostWorkspace.ts b/src/vs/workbench/api/node/extHostWorkspace.ts index 48939542573..18c17e2a4f9 100644 --- a/src/vs/workbench/api/node/extHostWorkspace.ts +++ b/src/vs/workbench/api/node/extHostWorkspace.ts @@ -396,8 +396,8 @@ export class ExtHostWorkspace implements ExtHostWorkspaceShape { const previewOptions: vscode.TextSearchPreviewOptions = typeof options.previewOptions === 'undefined' ? { - maxLines: 100, - totalChars: 10000 + matchLines: 100, + charsPerLine: 10000 } : options.previewOptions; diff --git a/src/vs/workbench/parts/search/browser/searchView.ts b/src/vs/workbench/parts/search/browser/searchView.ts index ce2cf62872f..e3a25baf4cb 100644 --- a/src/vs/workbench/parts/search/browser/searchView.ts +++ b/src/vs/workbench/parts/search/browser/searchView.ts @@ -1061,7 +1061,7 @@ export class SearchView extends Viewlet implements IViewlet, IPanel { // Need the full match line to correctly calculate replace text, if this is a search/replace with regex group references ($1, $2, ...). // 10000 chars is enough to avoid sending huge amounts of text around, if you do a replace with a longer match, it may or may not resolve the group refs correctly. // https://github.com/Microsoft/vscode/issues/58374 - const totalChars = content.isRegExp ? 10000 : + const charsPerLine = content.isRegExp ? 10000 : 250; const options: IQueryOptions = { @@ -1072,8 +1072,8 @@ export class SearchView extends Viewlet implements IViewlet, IPanel { excludePattern, includePattern, previewOptions: { - maxLines: 1, - totalChars + matchLines: 1, + charsPerLine } }; const folderResources = this.contextService.getWorkspace().folders;