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

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

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