Skip to content

Commit

Permalink
Добавлено свойство: VanessaTabs.renderWhitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
lintest committed Mar 9, 2021
1 parent fb50ced commit 07e847c
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/vanessa-tabs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { VanessaDiffEditor } from "./vanessa-diff-editor";
import { IVanessaEditor, createModel, VanessaEditorEvent, EventsManager, disposeModel } from "./common";
import { StaticServices } from 'monaco-editor/esm/vs/editor/standalone/browser/standaloneServices';

type WhitespaceType = 'none' | 'boundary' | 'selection' | 'all';

const $ = dom.$;

class VanessaTabItem {
Expand Down Expand Up @@ -251,6 +253,7 @@ export class VanessaTabs {
public domContainer: HTMLElement;
public domTabPanel: HTMLElement;
public tabStack: Array<VanessaTabItem> = [];
private _renderWhitespace: WhitespaceType = "none";
private hiddenEditors: Array<IVanessaEditor> = [];
private checkSyntax: boolean = true;
public timer: NodeJS.Timeout;
Expand Down Expand Up @@ -357,6 +360,7 @@ export class VanessaTabs {
if (!model) model = createModel(content, filename, uri);
this.disposeHidden();
const editor = new VanessaEditor(model, readOnly, this.checkSyntax);
editor.editor.updateOptions({ renderWhitespace: this.renderWhitespace });
return this.open(editor, title, filepath, encoding, newTab);
}

Expand Down Expand Up @@ -390,6 +394,7 @@ export class VanessaTabs {
if (!diff.modified) diff.modified = createModel(newContent, newFileName, uriModified);
this.disposeHidden();
const editor = new VanessaDiffEditor(diff, readOnly);
editor.editor.updateOptions({renderWhitespace: this.renderWhitespace});
return this.open(editor, title, newFilePath, encoding, newTab);
}

Expand Down Expand Up @@ -429,11 +434,17 @@ export class VanessaTabs {
}

public get enableSyntaxCheck(): boolean { return this.checkSyntax; }
public set enableSyntaxCheck(value: boolean ) {
VanessaEditor.editors.forEach(e => { e.enableSyntaxCheck = value});
public set enableSyntaxCheck(value: boolean) {
VanessaEditor.editors.forEach(e => { e.enableSyntaxCheck = value });
this.checkSyntax = value;
}

public get renderWhitespace(): WhitespaceType { return this._renderWhitespace; }
public set renderWhitespace(value: WhitespaceType) {
this.tabStack.forEach(tab => tab.editor.editor.updateOptions({ renderWhitespace: value }));
this._renderWhitespace = value;
}

public get isDiffEditor(): boolean { return this.current && this.current.type === "vs.editor.IDiffEditor"; }
public get diffEditor(): VanessaDiffEditor { return this.current.editor as VanessaDiffEditor; }
public canNavigateDiff = () => this.isDiffEditor && this.diffEditor.canNavigate();
Expand Down

0 comments on commit 07e847c

Please sign in to comment.