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

Fix #58374

上级 ca3f8806
......@@ -1078,6 +1078,13 @@ export class SearchView extends Viewlet implements IViewlet, IPanel {
const excludePattern = this.inputPatternExcludes.getValue();
const includePattern = this.inputPatternIncludes.getValue();
// 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 :
this.isWide ? 250 :
75;
const options: IQueryOptions = {
extraFileResources: getOutOfWorkspaceEditorResources(this.editorService, this.contextService),
maxResults: SearchView.MAX_TEXT_RESULTS,
......@@ -1088,7 +1095,7 @@ export class SearchView extends Viewlet implements IViewlet, IPanel {
previewOptions: {
leadingChars: 20,
maxLines: 1,
totalChars: this.isWide ? 250 : 75
totalChars
}
};
const folderResources = this.contextService.getWorkspace().folders;
......
......@@ -27,6 +27,8 @@ import { IReplaceService } from 'vs/workbench/parts/search/common/replace';
export class Match {
private static readonly MAX_PREVIEW_CHARS = 250;
private _id: string;
private _range: Range;
private _previewText: string;
......@@ -66,10 +68,15 @@ export class Match {
}
public preview(): { before: string; inside: string; after: string; } {
const before = this._previewText.substring(0, this._rangeInPreviewText.startColumn - 1),
let before = this._previewText.substring(0, this._rangeInPreviewText.startColumn - 1),
inside = this.getMatchString(),
after = this._previewText.substring(this._rangeInPreviewText.endColumn - 1);
let charsRemaining = Match.MAX_PREVIEW_CHARS - before.length;
inside = inside.substr(0, charsRemaining);
charsRemaining -= inside.length;
after = after.substr(0, charsRemaining);
return {
before,
inside,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册