editor - conditionally show editor open errors in a modal dialog

This commit is contained in:
Benjamin Pasero
2019-10-18 10:27:04 +02:00
parent 1cd6bd6096
commit 671fc8f654
6 changed files with 123 additions and 19 deletions

View File

@@ -9,7 +9,7 @@ import { isUndefinedOrNull, withNullAsUndefined, assertIsDefined } from 'vs/base
import { URI } from 'vs/base/common/uri';
import { IDisposable, Disposable } from 'vs/base/common/lifecycle';
import { IEditor as ICodeEditor, IEditorViewState, ScrollType, IDiffEditor } from 'vs/editor/common/editorCommon';
import { IEditorModel, IEditorOptions, ITextEditorOptions, IBaseResourceInput, IResourceInput, EditorActivation } from 'vs/platform/editor/common/editor';
import { IEditorModel, IEditorOptions, ITextEditorOptions, IBaseResourceInput, IResourceInput, EditorActivation, EditorOpenContext } from 'vs/platform/editor/common/editor';
import { IInstantiationService, IConstructorSignature0, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
import { RawContextKey, ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
import { Registry } from 'vs/platform/registry/common/platform';
@@ -775,6 +775,18 @@ export class EditorOptions implements IEditorOptions {
*/
ignoreOverrides: boolean | undefined;
/**
* A optional hint to signal in which context the editor opens.
*
* If configured to be `EditorOpenContext.USER`, this hint can be
* used in various places to control the experience. For example,
* if the editor to open fails with an error, a notification could
* inform about this in a modal dialog. If the editor opened through
* some background task, the notification would show in the background,
* not as a modal dialog.
*/
context: EditorOpenContext | undefined;
/**
* Overwrites option values from the provided bag.
*/
@@ -819,6 +831,10 @@ export class EditorOptions implements IEditorOptions {
this.ignoreOverrides = options.ignoreOverrides;
}
if (typeof options.context === 'number') {
this.context = options.context;
}
return this;
}
}