未验证 提交 74bc00fd 编写于 作者: A Alex Dima

Fixes #99166: Remove unusual line terminators, do not replace them with the configured EOL

上级 7a1f5d44
......@@ -94,7 +94,7 @@ export interface IEditorOptions {
*/
renderFinalNewline?: boolean;
/**
* Remove unusual line terminators like LINE SEPARATOR (LS), PARAGRAPH SEPARATOR (PS), NEXT LINE (NEL).
* Remove unusual line terminators like LINE SEPARATOR (LS), PARAGRAPH SEPARATOR (PS).
* Defaults to 'prompt'.
*/
unusualLineTerminators?: 'off' | 'prompt' | 'auto';
......
......@@ -552,7 +552,7 @@ export interface ITextModel {
mightContainRTL(): boolean;
/**
* If true, the text model might contain LINE SEPARATOR (LS), PARAGRAPH SEPARATOR (PS), NEXT LINE (NEL).
* If true, the text model might contain LINE SEPARATOR (LS), PARAGRAPH SEPARATOR (PS).
* If false, the text model definitely does not contain these.
* @internal
*/
......
......@@ -706,9 +706,8 @@ export class TextModel extends Disposable implements model.ITextModel {
public removeUnusualLineTerminators(selections: Selection[] | null = null): void {
const matches = this.findMatches(strings.UNUSUAL_LINE_TERMINATORS.source, false, true, false, null, false, Constants.MAX_SAFE_SMALL_INTEGER);
const eol = this.getEOL();
this._buffer.resetMightContainUnusualLineTerminators();
this.pushEditOperations(selections, matches.map(m => ({ range: m.range, text: eol })), () => null);
this.pushEditOperations(selections, matches.map(m => ({ range: m.range, text: null })), () => null);
}
public mightContainNonBasicASCII(): boolean {
......
......@@ -83,7 +83,7 @@ class UnusualLineTerminatorsDetector extends Disposable implements IEditorContri
const result = await this._dialogService.confirm({
title: nls.localize('unusualLineTerminators.title', "Unusual Line Terminators"),
message: nls.localize('unusualLineTerminators.message', "Detected unusual line terminators"),
detail: nls.localize('unusualLineTerminators.detail', "This file contains one or more unusual line terminator characters, like Line Separator (LS), Paragraph Separator (PS) or Next Line (NEL).\n\nIt is recommended to remove them from the file. This can be configured via `editor.unusualLineTerminators`."),
detail: nls.localize('unusualLineTerminators.detail', "This file contains one or more unusual line terminator characters, like Line Separator (LS) or Paragraph Separator (PS).\n\nIt is recommended to remove them from the file. This can be configured via `editor.unusualLineTerminators`."),
primaryButton: nls.localize('unusualLineTerminators.fix', "Fix this file"),
secondaryButton: nls.localize('unusualLineTerminators.ignore', "Ignore problem for this file")
});
......
......@@ -2629,7 +2629,7 @@ declare namespace monaco.editor {
*/
renderFinalNewline?: boolean;
/**
* Remove unusual line terminators like LINE SEPARATOR (LS), PARAGRAPH SEPARATOR (PS), NEXT LINE (NEL).
* Remove unusual line terminators like LINE SEPARATOR (LS), PARAGRAPH SEPARATOR (PS).
* Defaults to 'prompt'.
*/
unusualLineTerminators?: 'off' | 'prompt' | 'auto';
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册