Skip to content

Commit 2e26a4f

Browse files
author
Benjamin Pasero
committed
options - better overwrite()
1 parent f4ff74a commit 2e26a4f

1 file changed

Lines changed: 18 additions & 18 deletions

File tree

src/vs/workbench/common/editor.ts

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -772,36 +772,36 @@ export class EditorOptions implements IEditorOptions {
772772
* Overwrites option values from the provided bag.
773773
*/
774774
overwrite(options: IEditorOptions): EditorOptions {
775-
if (options.forceReload) {
776-
this.forceReload = true;
775+
if (typeof options.forceReload === 'boolean') {
776+
this.forceReload = options.forceReload;
777777
}
778778

779-
if (options.revealIfVisible) {
780-
this.revealIfVisible = true;
779+
if (typeof options.revealIfVisible === 'boolean') {
780+
this.revealIfVisible = options.revealIfVisible;
781781
}
782782

783-
if (options.revealIfOpened) {
784-
this.revealIfOpened = true;
783+
if (typeof options.revealIfOpened === 'boolean') {
784+
this.revealIfOpened = options.revealIfOpened;
785785
}
786786

787-
if (options.preserveFocus) {
788-
this.preserveFocus = true;
787+
if (typeof options.preserveFocus === 'boolean') {
788+
this.preserveFocus = options.preserveFocus;
789789
}
790790

791-
if (options.forceActive) {
792-
this.forceActive = true;
791+
if (typeof options.forceActive === 'boolean') {
792+
this.forceActive = options.forceActive;
793793
}
794794

795-
if (options.pinned) {
796-
this.pinned = true;
795+
if (typeof options.pinned === 'boolean') {
796+
this.pinned = options.pinned;
797797
}
798798

799-
if (options.inactive) {
800-
this.inactive = true;
799+
if (typeof options.inactive === 'boolean') {
800+
this.inactive = options.inactive;
801801
}
802802

803-
if (options.ignoreError) {
804-
this.ignoreError = true;
803+
if (typeof options.ignoreError === 'boolean') {
804+
this.ignoreError = options.ignoreError;
805805
}
806806

807807
if (typeof options.index === 'number') {
@@ -857,8 +857,8 @@ export class TextEditorOptions extends EditorOptions {
857857
this.editorViewState = options.viewState as IEditorViewState;
858858
}
859859

860-
if (options.revealInCenterIfOutsideViewport) {
861-
this.revealInCenterIfOutsideViewport = true;
860+
if (typeof options.revealInCenterIfOutsideViewport === 'boolean') {
861+
this.revealInCenterIfOutsideViewport = options.revealInCenterIfOutsideViewport;
862862
}
863863

864864
return this;

0 commit comments

Comments
 (0)