@codingame/monaco-vscode-ac93482b-2178-52df-a200-ba0d1a4963fb-common 20.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (22) hide show
  1. package/empty.js +1 -0
  2. package/package.json +50 -0
  3. package/vscode/src/vs/workbench/browser/parts/editor/binaryEditor.d.ts +23 -0
  4. package/vscode/src/vs/workbench/browser/parts/editor/binaryEditor.js +58 -0
  5. package/vscode/src/vs/workbench/browser/parts/editor/editor.contribution._autosave.d.ts +1 -0
  6. package/vscode/src/vs/workbench/browser/parts/editor/editor.contribution._autosave.js +5 -0
  7. package/vscode/src/vs/workbench/browser/parts/editor/editorAutoSave.d.ts +42 -0
  8. package/vscode/src/vs/workbench/browser/parts/editor/editorAutoSave.js +222 -0
  9. package/vscode/src/vs/workbench/contrib/files/browser/editors/textFileSaveErrorHandler.d.ts +32 -0
  10. package/vscode/src/vs/workbench/contrib/files/browser/editors/textFileSaveErrorHandler.js +398 -0
  11. package/vscode/src/vs/workbench/contrib/files/browser/fileActions.contribution.d.ts +8 -0
  12. package/vscode/src/vs/workbench/contrib/files/browser/fileActions.contribution.js +700 -0
  13. package/vscode/src/vs/workbench/contrib/files/browser/fileCommands.d.ts +4 -0
  14. package/vscode/src/vs/workbench/contrib/files/browser/fileCommands.js +474 -0
  15. package/vscode/src/vs/workbench/contrib/files/browser/files.contribution._fileEditorFactory.d.ts +1 -0
  16. package/vscode/src/vs/workbench/contrib/files/browser/files.contribution._fileEditorFactory.js +15 -0
  17. package/vscode/src/vs/workbench/contrib/webview/browser/webview.contribution.d.ts +1 -0
  18. package/vscode/src/vs/workbench/contrib/webview/browser/webview.contribution.js +72 -0
  19. package/vscode/src/vs/workbench/services/textfile/common/textEditorService.d.ts +32 -0
  20. package/vscode/src/vs/workbench/services/textfile/common/textEditorService.js +194 -0
  21. package/vscode/src/vs/workbench/services/untitled/common/untitledTextEditorInput.d.ts +45 -0
  22. package/vscode/src/vs/workbench/services/untitled/common/untitledTextEditorInput.js +159 -0
@@ -0,0 +1,194 @@
1
+
2
+ import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
3
+ import { Event } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
4
+ import { Registry } from '@codingame/monaco-vscode-api/vscode/vs/platform/registry/common/platform';
5
+ import { ResourceMap } from '@codingame/monaco-vscode-api/vscode/vs/base/common/map';
6
+ import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
7
+ import { EditorExtensions, DEFAULT_EDITOR_ASSOCIATION, isResourceMergeEditorInput, isResourceDiffEditorInput, isResourceSideBySideEditorInput } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/editor';
8
+ import { IUntitledTextEditorService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/untitled/common/untitledTextEditorService.service';
9
+ import { Schemas } from '@codingame/monaco-vscode-api/vscode/vs/base/common/network';
10
+ import { DiffEditorInput } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/editor/diffEditorInput';
11
+ import { SideBySideEditorInput } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/editor/sideBySideEditorInput';
12
+ import { TextResourceEditorInput } from '@codingame/monaco-vscode-caeb744c-8e3f-5c11-80fb-0f057d24d544-common/vscode/vs/workbench/common/editor/textResourceEditorInput';
13
+ import { UntitledTextEditorInput } from '../../untitled/common/untitledTextEditorInput.js';
14
+ import { basename } from '@codingame/monaco-vscode-api/vscode/vs/base/common/resources';
15
+ import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
16
+ import { IUriIdentityService } from '@codingame/monaco-vscode-api/vscode/vs/platform/uriIdentity/common/uriIdentity.service';
17
+ import { IFileService } from '@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files.service';
18
+ import { RegisteredEditorPriority } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorResolverService';
19
+ import { IEditorResolverService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorResolverService.service';
20
+ import { Disposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
21
+ import '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/extensions';
22
+ import { onUnexpectedError } from '@codingame/monaco-vscode-api/vscode/vs/base/common/errors';
23
+
24
+ var TextEditorService_1;
25
+ class FileEditorInputLeakError extends Error {
26
+ constructor(message, stack) {
27
+ super(message);
28
+ this.name = 'FileEditorInputLeakError';
29
+ this.stack = stack;
30
+ }
31
+ }
32
+ let TextEditorService = class TextEditorService extends Disposable {
33
+ static { TextEditorService_1 = this; }
34
+ constructor(untitledTextEditorService, instantiationService, uriIdentityService, fileService, editorResolverService) {
35
+ super();
36
+ this.untitledTextEditorService = untitledTextEditorService;
37
+ this.instantiationService = instantiationService;
38
+ this.uriIdentityService = uriIdentityService;
39
+ this.fileService = fileService;
40
+ this.editorResolverService = editorResolverService;
41
+ this.editorInputCache = ( new ResourceMap());
42
+ this.fileEditorFactory = ( Registry.as(EditorExtensions.EditorFactory)).getFileEditorFactory();
43
+ this.mapLeakToCounter = ( new Map());
44
+ this.registerDefaultEditor();
45
+ }
46
+ registerDefaultEditor() {
47
+ this._register(this.editorResolverService.registerEditor('*', {
48
+ id: DEFAULT_EDITOR_ASSOCIATION.id,
49
+ label: DEFAULT_EDITOR_ASSOCIATION.displayName,
50
+ detail: DEFAULT_EDITOR_ASSOCIATION.providerDisplayName,
51
+ priority: RegisteredEditorPriority.builtin
52
+ }, {}, {
53
+ createEditorInput: editor => ({ editor: this.createTextEditor(editor) }),
54
+ createUntitledEditorInput: untitledEditor => ({ editor: this.createTextEditor(untitledEditor) }),
55
+ createDiffEditorInput: diffEditor => ({ editor: this.createTextEditor(diffEditor) })
56
+ }));
57
+ }
58
+ async resolveTextEditor(input) {
59
+ return this.createTextEditor(input);
60
+ }
61
+ createTextEditor(input) {
62
+ if (isResourceMergeEditorInput(input)) {
63
+ return this.createTextEditor(input.result);
64
+ }
65
+ if (isResourceDiffEditorInput(input)) {
66
+ const original = this.createTextEditor(input.original);
67
+ const modified = this.createTextEditor(input.modified);
68
+ return this.instantiationService.createInstance(DiffEditorInput, input.label, input.description, original, modified, undefined);
69
+ }
70
+ if (isResourceSideBySideEditorInput(input)) {
71
+ const primary = this.createTextEditor(input.primary);
72
+ const secondary = this.createTextEditor(input.secondary);
73
+ return this.instantiationService.createInstance(SideBySideEditorInput, input.label, input.description, secondary, primary);
74
+ }
75
+ const untitledInput = input;
76
+ if (untitledInput.forceUntitled || !untitledInput.resource || (untitledInput.resource.scheme === Schemas.untitled)) {
77
+ const untitledOptions = {
78
+ languageId: untitledInput.languageId,
79
+ initialValue: untitledInput.contents,
80
+ encoding: untitledInput.encoding
81
+ };
82
+ let untitledModel;
83
+ if (untitledInput.resource?.scheme === Schemas.untitled) {
84
+ untitledModel = this.untitledTextEditorService.create({ untitledResource: untitledInput.resource, ...untitledOptions });
85
+ }
86
+ else {
87
+ untitledModel = this.untitledTextEditorService.create({ associatedResource: untitledInput.resource, ...untitledOptions });
88
+ }
89
+ return this.createOrGetCached(untitledModel.resource, () => this.instantiationService.createInstance(UntitledTextEditorInput, untitledModel));
90
+ }
91
+ const textResourceEditorInput = input;
92
+ if (textResourceEditorInput.resource instanceof URI) {
93
+ const label = textResourceEditorInput.label || basename(textResourceEditorInput.resource);
94
+ const preferredResource = textResourceEditorInput.resource;
95
+ const canonicalResource = this.uriIdentityService.asCanonicalUri(preferredResource);
96
+ return this.createOrGetCached(canonicalResource, () => {
97
+ if (textResourceEditorInput.forceFile || this.fileService.hasProvider(canonicalResource)) {
98
+ return this.fileEditorFactory.createFileEditor(canonicalResource, preferredResource, textResourceEditorInput.label, textResourceEditorInput.description, textResourceEditorInput.encoding, textResourceEditorInput.languageId, textResourceEditorInput.contents, this.instantiationService);
99
+ }
100
+ return this.instantiationService.createInstance(TextResourceEditorInput, canonicalResource, textResourceEditorInput.label, textResourceEditorInput.description, textResourceEditorInput.languageId, textResourceEditorInput.contents);
101
+ }, cachedInput => {
102
+ if (cachedInput instanceof UntitledTextEditorInput) {
103
+ return;
104
+ }
105
+ else if (!(cachedInput instanceof TextResourceEditorInput)) {
106
+ cachedInput.setPreferredResource(preferredResource);
107
+ if (textResourceEditorInput.label) {
108
+ cachedInput.setPreferredName(textResourceEditorInput.label);
109
+ }
110
+ if (textResourceEditorInput.description) {
111
+ cachedInput.setPreferredDescription(textResourceEditorInput.description);
112
+ }
113
+ if (textResourceEditorInput.encoding) {
114
+ cachedInput.setPreferredEncoding(textResourceEditorInput.encoding);
115
+ }
116
+ if (textResourceEditorInput.languageId) {
117
+ cachedInput.setPreferredLanguageId(textResourceEditorInput.languageId);
118
+ }
119
+ if (typeof textResourceEditorInput.contents === 'string') {
120
+ cachedInput.setPreferredContents(textResourceEditorInput.contents);
121
+ }
122
+ }
123
+ else {
124
+ if (label) {
125
+ cachedInput.setName(label);
126
+ }
127
+ if (textResourceEditorInput.description) {
128
+ cachedInput.setDescription(textResourceEditorInput.description);
129
+ }
130
+ if (textResourceEditorInput.languageId) {
131
+ cachedInput.setPreferredLanguageId(textResourceEditorInput.languageId);
132
+ }
133
+ if (typeof textResourceEditorInput.contents === 'string') {
134
+ cachedInput.setPreferredContents(textResourceEditorInput.contents);
135
+ }
136
+ }
137
+ });
138
+ }
139
+ throw ( new Error(
140
+ `ITextEditorService: Unable to create texteditor from ${JSON.stringify(input)}`
141
+ ));
142
+ }
143
+ createOrGetCached(resource, factoryFn, cachedFn) {
144
+ let input = this.editorInputCache.get(resource);
145
+ if (input) {
146
+ cachedFn?.(input);
147
+ return input;
148
+ }
149
+ input = factoryFn();
150
+ this.editorInputCache.set(resource, input);
151
+ const leakId = this.trackLeaks(input);
152
+ Event.once(input.onWillDispose)(() => {
153
+ this.editorInputCache.delete(resource);
154
+ if (leakId) {
155
+ this.untrackLeaks(leakId);
156
+ }
157
+ });
158
+ return input;
159
+ }
160
+ static { this.LEAK_TRACKING_THRESHOLD = 256; }
161
+ static { this.LEAK_REPORTING_THRESHOLD = 2 * this.LEAK_TRACKING_THRESHOLD; }
162
+ static { this.LEAK_REPORTED = false; }
163
+ trackLeaks(input) {
164
+ if (TextEditorService_1.LEAK_REPORTED || this.editorInputCache.size < TextEditorService_1.LEAK_TRACKING_THRESHOLD) {
165
+ return undefined;
166
+ }
167
+ const leakId = `${input.resource.scheme}#${input.typeId || '<no typeId>'}#${input.editorId || '<no editorId>'}\n${( new Error()).stack?.split('\n').slice(2).join('\n') ?? ''}`;
168
+ const leakCounter = (this.mapLeakToCounter.get(leakId) ?? 0) + 1;
169
+ this.mapLeakToCounter.set(leakId, leakCounter);
170
+ if (this.editorInputCache.size > TextEditorService_1.LEAK_REPORTING_THRESHOLD) {
171
+ TextEditorService_1.LEAK_REPORTED = true;
172
+ const [topLeak, topCount] = Array.from(this.mapLeakToCounter.entries()).reduce(([topLeak, topCount], [key, val]) => val > topCount ? [key, val] : [topLeak, topCount]);
173
+ const message = `Potential text editor input LEAK detected, having ${this.editorInputCache.size} text editor inputs already. Most frequent owner (${topCount})`;
174
+ onUnexpectedError(( new FileEditorInputLeakError(message, topLeak)));
175
+ }
176
+ return leakId;
177
+ }
178
+ untrackLeaks(leakId) {
179
+ const stackCounter = (this.mapLeakToCounter.get(leakId) ?? 1) - 1;
180
+ this.mapLeakToCounter.set(leakId, stackCounter);
181
+ if (stackCounter === 0) {
182
+ this.mapLeakToCounter.delete(leakId);
183
+ }
184
+ }
185
+ };
186
+ TextEditorService = TextEditorService_1 = ( __decorate([
187
+ ( __param(0, IUntitledTextEditorService)),
188
+ ( __param(1, IInstantiationService)),
189
+ ( __param(2, IUriIdentityService)),
190
+ ( __param(3, IFileService)),
191
+ ( __param(4, IEditorResolverService))
192
+ ], TextEditorService));
193
+
194
+ export { TextEditorService };
@@ -0,0 +1,45 @@
1
+ import { IUntitledTextResourceEditorInput, IUntypedEditorInput, Verbosity } from "@codingame/monaco-vscode-api/vscode/vs/workbench/common/editor";
2
+ import { EditorInput, IUntypedEditorOptions } from "@codingame/monaco-vscode-api/vscode/vs/workbench/common/editor/editorInput";
3
+ import { AbstractTextResourceEditorInput } from "@codingame/monaco-vscode-caeb744c-8e3f-5c11-80fb-0f057d24d544-common/vscode/vs/workbench/common/editor/textResourceEditorInput";
4
+ import { IUntitledTextEditorModel } from "@codingame/monaco-vscode-0c06bfba-d24d-5c4d-90cd-b40cefb7f811-common/vscode/vs/workbench/services/untitled/common/untitledTextEditorModel";
5
+ import { EncodingMode, IEncodingSupport, ILanguageSupport } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/textfile/common/textfiles";
6
+ import { ITextFileService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/textfile/common/textfiles.service";
7
+ import { ILabelService } from "@codingame/monaco-vscode-api/vscode/vs/platform/label/common/label.service";
8
+ import { IEditorService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorService.service";
9
+ import { IFileService } from "@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files.service";
10
+ import { IWorkbenchEnvironmentService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/environment/common/environmentService.service";
11
+ import { IPathService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/path/common/pathService.service";
12
+ import { IFilesConfigurationService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/filesConfiguration/common/filesConfigurationService.service";
13
+ import { ITextModelService } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/services/resolverService.service";
14
+ import { ITextResourceConfigurationService } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/services/textResourceConfiguration.service";
15
+ import { ICustomEditorLabelService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/customEditorLabelService.service";
16
+ export declare class UntitledTextEditorInput extends AbstractTextResourceEditorInput implements IEncodingSupport, ILanguageSupport {
17
+ protected model: IUntitledTextEditorModel;
18
+ private readonly environmentService;
19
+ private readonly pathService;
20
+ private readonly textModelService;
21
+ static readonly ID: string;
22
+ get typeId(): string;
23
+ get editorId(): string | undefined;
24
+ private modelResolve;
25
+ private readonly modelDisposables;
26
+ private cachedUntitledTextEditorModelReference;
27
+ constructor(model: IUntitledTextEditorModel, textFileService: ITextFileService, labelService: ILabelService, editorService: IEditorService, fileService: IFileService, environmentService: IWorkbenchEnvironmentService, pathService: IPathService, filesConfigurationService: IFilesConfigurationService, textModelService: ITextModelService, textResourceConfigurationService: ITextResourceConfigurationService, customEditorLabelService: ICustomEditorLabelService);
28
+ private registerModelListeners;
29
+ private onDidCreateUntitledModel;
30
+ getName(): string;
31
+ getDescription(verbosity?: Verbosity): string | undefined;
32
+ getTitle(verbosity: Verbosity): string;
33
+ isDirty(): boolean;
34
+ getEncoding(): string | undefined;
35
+ setEncoding(encoding: string, mode: EncodingMode): Promise<void>;
36
+ get hasLanguageSetExplicitly(): boolean;
37
+ get hasAssociatedFilePath(): boolean;
38
+ setLanguageId(languageId: string, source?: string): void;
39
+ getLanguageId(): string | undefined;
40
+ resolve(): Promise<IUntitledTextEditorModel>;
41
+ toUntyped(options?: IUntypedEditorOptions): IUntitledTextResourceEditorInput;
42
+ matches(otherInput: EditorInput | IUntypedEditorInput): boolean;
43
+ dispose(): void;
44
+ private disposeModelReference;
45
+ }
@@ -0,0 +1,159 @@
1
+
2
+ import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
3
+ import { DEFAULT_EDITOR_ASSOCIATION, Verbosity, findViewStateForEditor, isUntitledResourceEditorInput } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/editor';
4
+ import { AbstractTextResourceEditorInput } from '@codingame/monaco-vscode-caeb744c-8e3f-5c11-80fb-0f057d24d544-common/vscode/vs/workbench/common/editor/textResourceEditorInput';
5
+ import { ITextFileService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/textfile/common/textfiles.service';
6
+ import { ILabelService } from '@codingame/monaco-vscode-api/vscode/vs/platform/label/common/label.service';
7
+ import { IEditorService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorService.service';
8
+ import { IFileService } from '@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files.service';
9
+ import { isEqual, toLocalResource } from '@codingame/monaco-vscode-api/vscode/vs/base/common/resources';
10
+ import { IWorkbenchEnvironmentService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/environment/common/environmentService.service';
11
+ import { IPathService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/path/common/pathService.service';
12
+ import { IFilesConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/filesConfiguration/common/filesConfigurationService.service';
13
+ import { ITextModelService } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/services/resolverService.service';
14
+ import { DisposableStore, dispose } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
15
+ import { ITextResourceConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/services/textResourceConfiguration.service';
16
+ import { ICustomEditorLabelService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/customEditorLabelService.service';
17
+
18
+ var UntitledTextEditorInput_1;
19
+ let UntitledTextEditorInput = class UntitledTextEditorInput extends AbstractTextResourceEditorInput {
20
+ static { UntitledTextEditorInput_1 = this; }
21
+ static { this.ID = 'workbench.editors.untitledEditorInput'; }
22
+ get typeId() {
23
+ return UntitledTextEditorInput_1.ID;
24
+ }
25
+ get editorId() {
26
+ return DEFAULT_EDITOR_ASSOCIATION.id;
27
+ }
28
+ constructor(model, textFileService, labelService, editorService, fileService, environmentService, pathService, filesConfigurationService, textModelService, textResourceConfigurationService, customEditorLabelService) {
29
+ super(model.resource, undefined, editorService, textFileService, labelService, fileService, filesConfigurationService, textResourceConfigurationService, customEditorLabelService);
30
+ this.model = model;
31
+ this.environmentService = environmentService;
32
+ this.pathService = pathService;
33
+ this.textModelService = textModelService;
34
+ this.modelResolve = undefined;
35
+ this.modelDisposables = this._register(( new DisposableStore()));
36
+ this.cachedUntitledTextEditorModelReference = undefined;
37
+ this.registerModelListeners(model);
38
+ this._register(this.textFileService.untitled.onDidCreate(model => this.onDidCreateUntitledModel(model)));
39
+ }
40
+ registerModelListeners(model) {
41
+ this.modelDisposables.clear();
42
+ this.modelDisposables.add(model.onDidChangeDirty(() => this._onDidChangeDirty.fire()));
43
+ this.modelDisposables.add(model.onDidChangeName(() => this._onDidChangeLabel.fire()));
44
+ this.modelDisposables.add(model.onDidRevert(() => this.dispose()));
45
+ }
46
+ onDidCreateUntitledModel(model) {
47
+ if (isEqual(model.resource, this.model.resource) && model !== this.model) {
48
+ this.model = model;
49
+ this.registerModelListeners(model);
50
+ }
51
+ }
52
+ getName() {
53
+ return this.model.name;
54
+ }
55
+ getDescription(verbosity = Verbosity.MEDIUM) {
56
+ if (!this.model.hasAssociatedFilePath) {
57
+ const descriptionCandidate = this.resource.path;
58
+ if (descriptionCandidate !== this.getName()) {
59
+ return descriptionCandidate;
60
+ }
61
+ return undefined;
62
+ }
63
+ return super.getDescription(verbosity);
64
+ }
65
+ getTitle(verbosity) {
66
+ if (!this.model.hasAssociatedFilePath) {
67
+ const name = this.getName();
68
+ const description = this.getDescription();
69
+ if (description && description !== name) {
70
+ return `${name} • ${description}`;
71
+ }
72
+ return name;
73
+ }
74
+ return super.getTitle(verbosity);
75
+ }
76
+ isDirty() {
77
+ return this.model.isDirty();
78
+ }
79
+ getEncoding() {
80
+ return this.model.getEncoding();
81
+ }
82
+ setEncoding(encoding, mode ) {
83
+ return this.model.setEncoding(encoding);
84
+ }
85
+ get hasLanguageSetExplicitly() { return this.model.hasLanguageSetExplicitly; }
86
+ get hasAssociatedFilePath() { return this.model.hasAssociatedFilePath; }
87
+ setLanguageId(languageId, source) {
88
+ this.model.setLanguageId(languageId, source);
89
+ }
90
+ getLanguageId() {
91
+ return this.model.getLanguageId();
92
+ }
93
+ async resolve() {
94
+ if (!this.modelResolve) {
95
+ this.modelResolve = (async () => {
96
+ this.cachedUntitledTextEditorModelReference = await this.textModelService.createModelReference(this.resource);
97
+ })();
98
+ }
99
+ await this.modelResolve;
100
+ if (this.isDisposed()) {
101
+ this.disposeModelReference();
102
+ }
103
+ return this.model;
104
+ }
105
+ toUntyped(options) {
106
+ const untypedInput = {
107
+ resource: this.model.hasAssociatedFilePath ? toLocalResource(this.model.resource, this.environmentService.remoteAuthority, this.pathService.defaultUriScheme) : this.resource,
108
+ forceUntitled: true,
109
+ options: {
110
+ override: this.editorId
111
+ }
112
+ };
113
+ if (typeof options?.preserveViewState === 'number') {
114
+ untypedInput.encoding = this.getEncoding();
115
+ untypedInput.languageId = this.getLanguageId();
116
+ untypedInput.contents = this.model.isModified() ? this.model.textEditorModel?.getValue() : undefined;
117
+ untypedInput.options.viewState = findViewStateForEditor(this, options.preserveViewState, this.editorService);
118
+ if (typeof untypedInput.contents === 'string' && !this.model.hasAssociatedFilePath && !options.preserveResource) {
119
+ untypedInput.resource = undefined;
120
+ }
121
+ }
122
+ return untypedInput;
123
+ }
124
+ matches(otherInput) {
125
+ if (this === otherInput) {
126
+ return true;
127
+ }
128
+ if (otherInput instanceof UntitledTextEditorInput_1) {
129
+ return isEqual(otherInput.resource, this.resource);
130
+ }
131
+ if (isUntitledResourceEditorInput(otherInput)) {
132
+ return super.matches(otherInput);
133
+ }
134
+ return false;
135
+ }
136
+ dispose() {
137
+ this.modelResolve = undefined;
138
+ this.disposeModelReference();
139
+ super.dispose();
140
+ }
141
+ disposeModelReference() {
142
+ dispose(this.cachedUntitledTextEditorModelReference);
143
+ this.cachedUntitledTextEditorModelReference = undefined;
144
+ }
145
+ };
146
+ UntitledTextEditorInput = UntitledTextEditorInput_1 = ( __decorate([
147
+ ( __param(1, ITextFileService)),
148
+ ( __param(2, ILabelService)),
149
+ ( __param(3, IEditorService)),
150
+ ( __param(4, IFileService)),
151
+ ( __param(5, IWorkbenchEnvironmentService)),
152
+ ( __param(6, IPathService)),
153
+ ( __param(7, IFilesConfigurationService)),
154
+ ( __param(8, ITextModelService)),
155
+ ( __param(9, ITextResourceConfigurationService)),
156
+ ( __param(10, ICustomEditorLabelService))
157
+ ], UntitledTextEditorInput));
158
+
159
+ export { UntitledTextEditorInput };