mirror of
https://github.com/microsoft/vscode.git
synced 2026-02-26 12:44:05 +00:00
Rename previewOptions
This commit is contained in:
@@ -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 = {
|
||||
|
||||
@@ -514,8 +514,8 @@ suite('workspace-namespace', () => {
|
||||
const options: vscode.FindTextInFilesOptions = {
|
||||
include: '*.ts',
|
||||
previewOptions: {
|
||||
maxLines: 1,
|
||||
totalChars: 100
|
||||
matchLines: 1,
|
||||
charsPerLine: 100
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -140,8 +140,8 @@ export interface IFileMatch<U extends UriComponents = uri> {
|
||||
export type IRawFileMatch2 = IFileMatch<UriComponents>;
|
||||
|
||||
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 = {
|
||||
|
||||
@@ -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);
|
||||
|
||||
4
src/vs/vscode.proposed.d.ts
vendored
4
src/vs/vscode.proposed.d.ts
vendored
@@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user