@@ -46,7 +46,6 @@ export class SimpleNotebookEditorModel extends EditorModel implements INotebookE
46
46
private _workingCopy ?: IStoredFileWorkingCopy < NotebookFileWorkingCopyModel > | IUntitledFileWorkingCopy < NotebookFileWorkingCopyModel > ;
47
47
private readonly _workingCopyListeners = this . _register ( new DisposableStore ( ) ) ;
48
48
private readonly scratchPad : boolean ;
49
- private _hasErrorState : boolean = false ;
50
49
51
50
constructor (
52
51
readonly resource : URI ,
@@ -110,7 +109,19 @@ export class SimpleNotebookEditorModel extends EditorModel implements INotebookE
110
109
}
111
110
112
111
get hasErrorState ( ) : boolean {
113
- return this . _hasErrorState ;
112
+ if ( this . _workingCopy && 'hasState' in this . _workingCopy ) {
113
+ return this . _workingCopy . hasState ( StoredFileWorkingCopyState . ERROR ) ;
114
+ }
115
+
116
+ return false ;
117
+ }
118
+
119
+ get hasConflictState ( ) : boolean {
120
+ if ( this . _workingCopy && 'hasState' in this . _workingCopy ) {
121
+ return this . _workingCopy . hasState ( StoredFileWorkingCopyState . CONFLICT ) ;
122
+ }
123
+
124
+ return false ;
114
125
}
115
126
116
127
revert ( options ?: IRevertOptions ) : Promise < void > {
@@ -123,13 +134,6 @@ export class SimpleNotebookEditorModel extends EditorModel implements INotebookE
123
134
return this . _workingCopy ! . save ( options ) ;
124
135
}
125
136
126
- private onDidChangeDirtyHandler ( ) {
127
- if ( ! this . _workingCopy ?. isDirty ( ) ) {
128
- this . _hasErrorState = false ;
129
- }
130
- this . _onDidChangeDirty . fire ( ) ;
131
- }
132
-
133
137
async load ( options ?: INotebookLoadOptions ) : Promise < IResolvedNotebookEditorModel > {
134
138
if ( ! this . _workingCopy || ! this . _workingCopy . model ) {
135
139
if ( this . resource . scheme === Schemas . untitled ) {
@@ -144,9 +148,8 @@ export class SimpleNotebookEditorModel extends EditorModel implements INotebookE
144
148
this . _workingCopyListeners . add ( this . _workingCopy . onDidSave ( e => this . _onDidSave . fire ( e ) ) ) ;
145
149
this . _workingCopyListeners . add ( this . _workingCopy . onDidChangeOrphaned ( ( ) => this . _onDidChangeOrphaned . fire ( ) ) ) ;
146
150
this . _workingCopyListeners . add ( this . _workingCopy . onDidChangeReadonly ( ( ) => this . _onDidChangeReadonly . fire ( ) ) ) ;
147
- this . _workingCopyListeners . add ( this . _workingCopy . onDidSaveError ( ( ) => { this . _hasErrorState = true ; } ) ) ;
148
151
}
149
- this . _workingCopyListeners . add ( this . _workingCopy . onDidChangeDirty ( this . onDidChangeDirtyHandler . bind ( this ) , undefined , this . _workingCopyListeners ) ) ;
152
+ this . _workingCopyListeners . add ( this . _workingCopy . onDidChangeDirty ( ( ) => this . _onDidChangeDirty . fire ( ) , undefined , this . _workingCopyListeners ) ) ;
150
153
151
154
this . _workingCopyListeners . add ( this . _workingCopy . onWillDispose ( ( ) => {
152
155
this . _workingCopyListeners . clear ( ) ;
0 commit comments