提交 50211674 编写于 作者: A Alex Dima

Toggle Word Wrap can unwrap also minified files (#21552)

上级 342aa319
...@@ -194,6 +194,7 @@ class InternalEditorOptionsHelper { ...@@ -194,6 +194,7 @@ class InternalEditorOptionsHelper {
{ {
let wordWrap = opts.wordWrap; let wordWrap = opts.wordWrap;
let wordWrapColumn = toInteger(opts.wordWrapColumn, 1); let wordWrapColumn = toInteger(opts.wordWrapColumn, 1);
let wordWrapMinified = toBoolean(opts.wordWrapMinified);
// Compatibility with old true or false values // Compatibility with old true or false values
if (<any>wordWrap === true) { if (<any>wordWrap === true) {
...@@ -202,7 +203,7 @@ class InternalEditorOptionsHelper { ...@@ -202,7 +203,7 @@ class InternalEditorOptionsHelper {
wordWrap = 'off'; wordWrap = 'off';
} }
if (isDominatedByLongLines) { if (wordWrapMinified && isDominatedByLongLines) {
// Force viewport width wrapping if model is dominated by long lines // Force viewport width wrapping if model is dominated by long lines
bareWrappingInfo = { bareWrappingInfo = {
isViewportWrapping: true, isViewportWrapping: true,
......
...@@ -74,6 +74,7 @@ class ConfigClass implements IConfiguration { ...@@ -74,6 +74,7 @@ class ConfigClass implements IConfiguration {
automaticLayout: false, automaticLayout: false,
wordWrap: 'off', wordWrap: 'off',
wordWrapColumn: 80, wordWrapColumn: 80,
wordWrapMinified: true,
wrappingIndent: 'same', wrappingIndent: 'same',
wordWrapBreakBeforeCharacters: '([{‘“〈《「『【〔([{「£¥$£¥++', wordWrapBreakBeforeCharacters: '([{‘“〈《「『【〔([{「£¥$£¥++',
wordWrapBreakAfterCharacters: ' \t})]?|&,;¢°′″‰℃、。。、¢,.:;?!%・・ゝゞヽヾーァィゥェォッャュョヮヵヶぁぃぅぇぉっゃゅょゎゕゖㇰㇱㇲㇳㇴㇵㇶㇷㇸㇹㇺㇻㇼㇽㇾㇿ々〻ァィゥェォャュョッー’”〉》」』】〕)]}」', wordWrapBreakAfterCharacters: ' \t})]?|&,;¢°′″‰℃、。。、¢,.:;?!%・・ゝゞヽヾーァィゥェォッャュョヮヵヶぁぃぅぇぉっゃゅょゎゕゖㇰㇱㇲㇳㇴㇵㇶㇷㇸㇹㇺㇻㇼㇽㇾㇿ々〻ァィゥェォャュョッー’”〉》」』】〕)]}」',
......
...@@ -357,6 +357,11 @@ export interface IEditorOptions { ...@@ -357,6 +357,11 @@ export interface IEditorOptions {
* Defaults to 80. * Defaults to 80.
*/ */
wordWrapColumn?: number; wordWrapColumn?: number;
/**
* Force word wrapping when the text appears to be of a minified/generated file.
* Defaults to true.
*/
wordWrapMinified?: boolean;
/** /**
* Control indentation of wrapped lines. Can be: 'none', 'same' or 'indent'. * Control indentation of wrapped lines. Can be: 'none', 'same' or 'indent'.
* Defaults to 'same' in vscode and to 'none' in monaco-editor. * Defaults to 'same' in vscode and to 'none' in monaco-editor.
......
...@@ -1279,6 +1279,11 @@ declare module monaco.editor { ...@@ -1279,6 +1279,11 @@ declare module monaco.editor {
* Defaults to 80. * Defaults to 80.
*/ */
wordWrapColumn?: number; wordWrapColumn?: number;
/**
* Force word wrapping when the text appears to be of a minified/generated file.
* Defaults to true.
*/
wordWrapMinified?: boolean;
/** /**
* Control indentation of wrapped lines. Can be: 'none', 'same' or 'indent'. * Control indentation of wrapped lines. Can be: 'none', 'same' or 'indent'.
* Defaults to 'same' in vscode and to 'none' in monaco-editor. * Defaults to 'same' in vscode and to 'none' in monaco-editor.
......
...@@ -28,14 +28,18 @@ class ToggleWordWrapAction extends EditorAction { ...@@ -28,14 +28,18 @@ class ToggleWordWrapAction extends EditorAction {
public run(accessor: ServicesAccessor, editor: ICommonCodeEditor): void { public run(accessor: ServicesAccessor, editor: ICommonCodeEditor): void {
let wrappingInfo = editor.getConfiguration().wrappingInfo; let wrappingInfo = editor.getConfiguration().wrappingInfo;
let newWordWrap: 'on' | 'off'; let newWordWrap: 'on' | 'off';
let newWordWrapMinified: boolean;
if (!wrappingInfo.isViewportWrapping) { if (!wrappingInfo.isViewportWrapping) {
newWordWrap = 'on'; newWordWrap = 'on';
newWordWrapMinified = true;
} else { } else {
newWordWrap = 'off'; newWordWrap = 'off';
newWordWrapMinified = false;
} }
editor.updateOptions({ editor.updateOptions({
wordWrap: newWordWrap wordWrap: newWordWrap,
wordWrapMinified: newWordWrapMinified
}); });
} }
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册