@codingame/monaco-vscode-views-service-override 2.0.3-improve-modularity.1 → 2.0.3
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.
- package/package.json +11 -11
- package/vscode/src/vs/workbench/contrib/files/browser/editors/binaryFileEditor.js +1 -1
- package/vscode/src/vs/workbench/contrib/files/browser/editors/textFileEditor.js +1 -1
- package/vscode/src/vs/workbench/contrib/files/browser/editors/textFileSaveErrorHandler.js +1 -1
- package/vscode/src/vs/workbench/contrib/files/browser/files.contribution.js +2 -10
- package/vscode/src/vs/workbench/contrib/files/browser/editors/fileEditorInput.js +0 -344
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-views-service-override",
|
|
3
|
-
"version": "2.0.3
|
|
3
|
+
"version": "2.0.3",
|
|
4
4
|
"keywords": [],
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "CodinGame",
|
|
@@ -18,16 +18,16 @@
|
|
|
18
18
|
"module": "index.js",
|
|
19
19
|
"types": "index.d.ts",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"vscode": "npm:@codingame/monaco-vscode-api@2.0.3
|
|
21
|
+
"vscode": "npm:@codingame/monaco-vscode-api@2.0.3",
|
|
22
22
|
"vscode-marked": "npm:marked@=3.0.2",
|
|
23
|
-
"@codingame/monaco-vscode-bulk-edit-service-override": "2.0.3
|
|
24
|
-
"@codingame/monaco-vscode-layout-service-override": "2.0.3
|
|
25
|
-
"@codingame/monaco-vscode-quickaccess-service-override": "2.0.3
|
|
26
|
-
"@codingame/monaco-vscode-keybindings-service-override": "2.0.3
|
|
27
|
-
"@codingame/monaco-vscode-files-service-override": "2.0.3
|
|
28
|
-
"@codingame/monaco-vscode-extensions-service-override": "2.0.3
|
|
29
|
-
"@codingame/monaco-vscode-environment-service-override": "2.0.3
|
|
30
|
-
"@codingame/monaco-vscode-host-service-override": "2.0.3
|
|
31
|
-
"@codingame/monaco-vscode-base-service-override": "2.0.3
|
|
23
|
+
"@codingame/monaco-vscode-bulk-edit-service-override": "2.0.3",
|
|
24
|
+
"@codingame/monaco-vscode-layout-service-override": "2.0.3",
|
|
25
|
+
"@codingame/monaco-vscode-quickaccess-service-override": "2.0.3",
|
|
26
|
+
"@codingame/monaco-vscode-keybindings-service-override": "2.0.3",
|
|
27
|
+
"@codingame/monaco-vscode-files-service-override": "2.0.3",
|
|
28
|
+
"@codingame/monaco-vscode-extensions-service-override": "2.0.3",
|
|
29
|
+
"@codingame/monaco-vscode-environment-service-override": "2.0.3",
|
|
30
|
+
"@codingame/monaco-vscode-host-service-override": "2.0.3",
|
|
31
|
+
"@codingame/monaco-vscode-base-service-override": "2.0.3"
|
|
32
32
|
}
|
|
33
33
|
}
|
|
@@ -3,7 +3,7 @@ import { localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
|
3
3
|
import { BaseBinaryResourceEditor } from 'vscode/vscode/vs/workbench/browser/parts/editor/binaryEditor';
|
|
4
4
|
import { ITelemetryService } from 'vscode/vscode/vs/platform/telemetry/common/telemetry';
|
|
5
5
|
import { IThemeService } from 'vscode/vscode/vs/platform/theme/common/themeService';
|
|
6
|
-
import { FileEditorInput } from '
|
|
6
|
+
import { FileEditorInput } from 'vscode/vscode/vs/workbench/contrib/files/browser/editors/fileEditorInput';
|
|
7
7
|
import { BINARY_FILE_EDITOR_ID, BINARY_TEXT_FILE_MODE } from 'vscode/vscode/vs/workbench/contrib/files/common/files';
|
|
8
8
|
import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage';
|
|
9
9
|
import { EditorResolution } from 'vscode/vscode/vs/platform/editor/common/editor';
|
|
@@ -10,7 +10,7 @@ import { AbstractTextCodeEditor } from 'vscode/vscode/vs/workbench/browser/parts
|
|
|
10
10
|
import { isTextEditorViewState, createEditorOpenError, createTooLargeFileError, DEFAULT_EDITOR_ASSOCIATION } from 'vscode/vscode/vs/workbench/common/editor';
|
|
11
11
|
import { applyTextEditorOptions } from 'vscode/vscode/vs/workbench/common/editor/editorOptions';
|
|
12
12
|
import { BinaryEditorModel } from 'vscode/vscode/vs/workbench/common/editor/binaryEditorModel';
|
|
13
|
-
import { FileEditorInput } from '
|
|
13
|
+
import { FileEditorInput } from 'vscode/vscode/vs/workbench/contrib/files/browser/editors/fileEditorInput';
|
|
14
14
|
import { TooLargeFileOperationError, ByteSize, FileOperationError, IFileService } from 'vscode/vscode/vs/platform/files/common/files';
|
|
15
15
|
import { ITelemetryService } from 'vscode/vscode/vs/platform/telemetry/common/telemetry';
|
|
16
16
|
import { IWorkspaceContextService } from 'vscode/vscode/vs/platform/workspace/common/workspace';
|
|
@@ -12,7 +12,7 @@ import { ResourceMap } from 'vscode/vscode/vs/base/common/map';
|
|
|
12
12
|
import { DiffEditorInput } from 'vscode/vscode/vs/workbench/common/editor/diffEditorInput';
|
|
13
13
|
import { RawContextKey, IContextKeyService } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
|
|
14
14
|
import { TextFileContentProvider } from 'vscode/vscode/vs/workbench/contrib/files/common/files';
|
|
15
|
-
import { FileEditorInput } from '
|
|
15
|
+
import { FileEditorInput } from 'vscode/vscode/vs/workbench/contrib/files/browser/editors/fileEditorInput';
|
|
16
16
|
import { SAVE_FILE_AS_LABEL } from 'vscode/vscode/vs/workbench/contrib/files/browser/fileConstants';
|
|
17
17
|
import { Severity, INotificationService } from 'vscode/vscode/vs/platform/notification/common/notification';
|
|
18
18
|
import { IOpenerService } from 'vscode/vscode/vs/platform/opener/common/opener';
|
|
@@ -16,7 +16,7 @@ import { Extensions } from 'vscode/vscode/vs/workbench/common/contributions';
|
|
|
16
16
|
import { EditorExtensions } from 'vscode/vscode/vs/workbench/common/editor';
|
|
17
17
|
import { BinaryFileEditor } from './editors/binaryFileEditor.js';
|
|
18
18
|
import { FileEditorInputSerializer, FileEditorWorkingCopyEditorHandler } from './editors/fileEditorHandler.js';
|
|
19
|
-
import { FileEditorInput } from '
|
|
19
|
+
import { FileEditorInput } from 'vscode/vscode/vs/workbench/contrib/files/browser/editors/fileEditorInput';
|
|
20
20
|
import { TextFileEditor } from './editors/textFileEditor.js';
|
|
21
21
|
import { TextFileEditorTracker } from './editors/textFileEditorTracker.js';
|
|
22
22
|
import { TextFileSaveErrorHandler } from './editors/textFileSaveErrorHandler.js';
|
|
@@ -27,6 +27,7 @@ import { WorkspaceWatcher } from './workspaceWatcher.js';
|
|
|
27
27
|
import { DirtyFilesIndicator } from '../common/dirtyFilesIndicator.js';
|
|
28
28
|
import { FILE_EDITOR_INPUT_ID, BINARY_TEXT_FILE_MODE } from 'vscode/vscode/vs/workbench/contrib/files/common/files';
|
|
29
29
|
import 'vscode/vscode/vs/workbench/contrib/files/browser/files.configuration.contribution';
|
|
30
|
+
import 'vscode/vscode/vs/workbench/contrib/files/browser/files.fileEditorFactory.contribution';
|
|
30
31
|
|
|
31
32
|
let FileUriLabelContribution = class FileUriLabelContribution {
|
|
32
33
|
constructor(labelService) {
|
|
@@ -60,15 +61,6 @@ FileUriLabelContribution = ( __decorate([
|
|
|
60
61
|
))), [
|
|
61
62
|
( new SyncDescriptor(FileEditorInput))
|
|
62
63
|
]);
|
|
63
|
-
( Registry.as(EditorExtensions.EditorFactory)).registerFileEditorFactory({
|
|
64
|
-
typeId: FILE_EDITOR_INPUT_ID,
|
|
65
|
-
createFileEditor: (resource, preferredResource, preferredName, preferredDescription, preferredEncoding, preferredLanguageId, preferredContents, instantiationService) => {
|
|
66
|
-
return instantiationService.createInstance(FileEditorInput, resource, preferredResource, preferredName, preferredDescription, preferredEncoding, preferredLanguageId, preferredContents);
|
|
67
|
-
},
|
|
68
|
-
isFileEditor: (obj) => {
|
|
69
|
-
return obj instanceof FileEditorInput;
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
64
|
( Registry.as(EditorExtensions.EditorFactory)).registerEditorSerializer(FILE_EDITOR_INPUT_ID, FileEditorInputSerializer);
|
|
73
65
|
( Registry.as(Extensions.Workbench)).registerWorkbenchContribution(FileEditorWorkingCopyEditorHandler, 2 );
|
|
74
66
|
( Registry.as(Extensions.Workbench)).registerWorkbenchContribution(ExplorerViewletViewsContribution, 1 );
|
|
@@ -1,344 +0,0 @@
|
|
|
1
|
-
import { __decorate, __param } from '../../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
-
import { DEFAULT_EDITOR_ASSOCIATION, findViewStateForEditor, isResourceEditorInput } from 'vscode/vscode/vs/workbench/common/editor';
|
|
3
|
-
import { AbstractTextResourceEditorInput } from 'vscode/vscode/vs/workbench/common/editor/textResourceEditorInput';
|
|
4
|
-
import { BinaryEditorModel } from 'vscode/vscode/vs/workbench/common/editor/binaryEditorModel';
|
|
5
|
-
import { getLargeFileConfirmationLimit, ByteSize, IFileService } from 'vscode/vscode/vs/platform/files/common/files';
|
|
6
|
-
import { ITextFileService } from 'vscode/vscode/vs/workbench/services/textfile/common/textfiles';
|
|
7
|
-
import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
8
|
-
import { DisposableStore, dispose } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
9
|
-
import { ITextModelService } from 'vscode/vscode/vs/editor/common/services/resolverService';
|
|
10
|
-
import { FILE_EDITOR_INPUT_ID, BINARY_FILE_EDITOR_ID, TEXT_FILE_EDITOR_ID } from 'vscode/vscode/vs/workbench/contrib/files/common/files';
|
|
11
|
-
import { ILabelService } from 'vscode/vscode/vs/platform/label/common/label';
|
|
12
|
-
import { IFilesConfigurationService } from 'vscode/vscode/vs/workbench/services/filesConfiguration/common/filesConfigurationService';
|
|
13
|
-
import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
|
|
14
|
-
import { isEqual } from 'vscode/vscode/vs/base/common/resources';
|
|
15
|
-
import { Event } from 'vscode/vscode/vs/base/common/event';
|
|
16
|
-
import { Schemas } from 'vscode/vscode/vs/base/common/network';
|
|
17
|
-
import { createTextBufferFactory } from 'vscode/vscode/vs/editor/common/model/textModel';
|
|
18
|
-
import { IPathService } from 'vscode/vscode/vs/workbench/services/path/common/pathService';
|
|
19
|
-
import { ITextResourceConfigurationService } from 'vscode/vscode/vs/editor/common/services/textResourceConfiguration';
|
|
20
|
-
import { isConfigured } from 'vscode/vscode/vs/platform/configuration/common/configuration';
|
|
21
|
-
|
|
22
|
-
var FileEditorInput_1;
|
|
23
|
-
let FileEditorInput = FileEditorInput_1 = class FileEditorInput extends AbstractTextResourceEditorInput {
|
|
24
|
-
get typeId() {
|
|
25
|
-
return FILE_EDITOR_INPUT_ID;
|
|
26
|
-
}
|
|
27
|
-
get editorId() {
|
|
28
|
-
return DEFAULT_EDITOR_ASSOCIATION.id;
|
|
29
|
-
}
|
|
30
|
-
get capabilities() {
|
|
31
|
-
let capabilities = 32 ;
|
|
32
|
-
if (this.model) {
|
|
33
|
-
if (this.model.isReadonly()) {
|
|
34
|
-
capabilities |= 2 ;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
else {
|
|
38
|
-
if (this.fileService.hasProvider(this.resource)) {
|
|
39
|
-
if (this.filesConfigurationService.isReadonly(this.resource)) {
|
|
40
|
-
capabilities |= 2 ;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
else {
|
|
44
|
-
capabilities |= 4 ;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
if (!((capabilities & 2) )) {
|
|
48
|
-
capabilities |= 128 ;
|
|
49
|
-
}
|
|
50
|
-
return capabilities;
|
|
51
|
-
}
|
|
52
|
-
constructor(resource, preferredResource, preferredName, preferredDescription, preferredEncoding, preferredLanguageId, preferredContents, instantiationService, textFileService, textModelService, labelService, fileService, filesConfigurationService, editorService, pathService, textResourceConfigurationService) {
|
|
53
|
-
super(resource, preferredResource, editorService, textFileService, labelService, fileService, filesConfigurationService);
|
|
54
|
-
this.instantiationService = instantiationService;
|
|
55
|
-
this.textModelService = textModelService;
|
|
56
|
-
this.pathService = pathService;
|
|
57
|
-
this.textResourceConfigurationService = textResourceConfigurationService;
|
|
58
|
-
this.forceOpenAs = 0 ;
|
|
59
|
-
this.model = undefined;
|
|
60
|
-
this.cachedTextFileModelReference = undefined;
|
|
61
|
-
this.modelListeners = this._register(( new DisposableStore()));
|
|
62
|
-
this.model = this.textFileService.files.get(resource);
|
|
63
|
-
if (preferredName) {
|
|
64
|
-
this.setPreferredName(preferredName);
|
|
65
|
-
}
|
|
66
|
-
if (preferredDescription) {
|
|
67
|
-
this.setPreferredDescription(preferredDescription);
|
|
68
|
-
}
|
|
69
|
-
if (preferredEncoding) {
|
|
70
|
-
this.setPreferredEncoding(preferredEncoding);
|
|
71
|
-
}
|
|
72
|
-
if (preferredLanguageId) {
|
|
73
|
-
this.setPreferredLanguageId(preferredLanguageId);
|
|
74
|
-
}
|
|
75
|
-
if (typeof preferredContents === 'string') {
|
|
76
|
-
this.setPreferredContents(preferredContents);
|
|
77
|
-
}
|
|
78
|
-
this._register(this.textFileService.files.onDidCreate(model => this.onDidCreateTextFileModel(model)));
|
|
79
|
-
if (this.model) {
|
|
80
|
-
this.registerModelListeners(this.model);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
onDidCreateTextFileModel(model) {
|
|
84
|
-
if (isEqual(model.resource, this.resource)) {
|
|
85
|
-
this.model = model;
|
|
86
|
-
this.registerModelListeners(model);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
registerModelListeners(model) {
|
|
90
|
-
this.modelListeners.clear();
|
|
91
|
-
this.modelListeners.add(model.onDidChangeDirty(() => this._onDidChangeDirty.fire()));
|
|
92
|
-
this.modelListeners.add(model.onDidChangeReadonly(() => this._onDidChangeCapabilities.fire()));
|
|
93
|
-
this.modelListeners.add(model.onDidSaveError(() => this._onDidChangeDirty.fire()));
|
|
94
|
-
this.modelListeners.add(Event.once(model.onWillDispose)(() => {
|
|
95
|
-
this.modelListeners.clear();
|
|
96
|
-
this.model = undefined;
|
|
97
|
-
}));
|
|
98
|
-
}
|
|
99
|
-
getName() {
|
|
100
|
-
return this.preferredName || super.getName();
|
|
101
|
-
}
|
|
102
|
-
setPreferredName(name) {
|
|
103
|
-
if (!this.allowLabelOverride()) {
|
|
104
|
-
return;
|
|
105
|
-
}
|
|
106
|
-
if (this.preferredName !== name) {
|
|
107
|
-
this.preferredName = name;
|
|
108
|
-
this._onDidChangeLabel.fire();
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
allowLabelOverride() {
|
|
112
|
-
return this.resource.scheme !== this.pathService.defaultUriScheme &&
|
|
113
|
-
this.resource.scheme !== Schemas.vscodeUserData &&
|
|
114
|
-
this.resource.scheme !== Schemas.file &&
|
|
115
|
-
this.resource.scheme !== Schemas.vscodeRemote;
|
|
116
|
-
}
|
|
117
|
-
getPreferredName() {
|
|
118
|
-
return this.preferredName;
|
|
119
|
-
}
|
|
120
|
-
isReadonly() {
|
|
121
|
-
return this.model ? this.model.isReadonly() : this.filesConfigurationService.isReadonly(this.resource);
|
|
122
|
-
}
|
|
123
|
-
getDescription(verbosity) {
|
|
124
|
-
return this.preferredDescription || super.getDescription(verbosity);
|
|
125
|
-
}
|
|
126
|
-
setPreferredDescription(description) {
|
|
127
|
-
if (!this.allowLabelOverride()) {
|
|
128
|
-
return;
|
|
129
|
-
}
|
|
130
|
-
if (this.preferredDescription !== description) {
|
|
131
|
-
this.preferredDescription = description;
|
|
132
|
-
this._onDidChangeLabel.fire();
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
getPreferredDescription() {
|
|
136
|
-
return this.preferredDescription;
|
|
137
|
-
}
|
|
138
|
-
getTitle(verbosity) {
|
|
139
|
-
let title = super.getTitle(verbosity);
|
|
140
|
-
const preferredTitle = this.getPreferredTitle();
|
|
141
|
-
if (preferredTitle) {
|
|
142
|
-
title = `${preferredTitle} (${title})`;
|
|
143
|
-
}
|
|
144
|
-
return title;
|
|
145
|
-
}
|
|
146
|
-
getPreferredTitle() {
|
|
147
|
-
if (this.preferredName && this.preferredDescription) {
|
|
148
|
-
return `${this.preferredName} ${this.preferredDescription}`;
|
|
149
|
-
}
|
|
150
|
-
if (this.preferredName || this.preferredDescription) {
|
|
151
|
-
return this.preferredName ?? this.preferredDescription;
|
|
152
|
-
}
|
|
153
|
-
return undefined;
|
|
154
|
-
}
|
|
155
|
-
getEncoding() {
|
|
156
|
-
if (this.model) {
|
|
157
|
-
return this.model.getEncoding();
|
|
158
|
-
}
|
|
159
|
-
return this.preferredEncoding;
|
|
160
|
-
}
|
|
161
|
-
getPreferredEncoding() {
|
|
162
|
-
return this.preferredEncoding;
|
|
163
|
-
}
|
|
164
|
-
async setEncoding(encoding, mode) {
|
|
165
|
-
this.setPreferredEncoding(encoding);
|
|
166
|
-
return this.model?.setEncoding(encoding, mode);
|
|
167
|
-
}
|
|
168
|
-
setPreferredEncoding(encoding) {
|
|
169
|
-
this.preferredEncoding = encoding;
|
|
170
|
-
this.setForceOpenAsText();
|
|
171
|
-
}
|
|
172
|
-
getLanguageId() {
|
|
173
|
-
if (this.model) {
|
|
174
|
-
return this.model.getLanguageId();
|
|
175
|
-
}
|
|
176
|
-
return this.preferredLanguageId;
|
|
177
|
-
}
|
|
178
|
-
getPreferredLanguageId() {
|
|
179
|
-
return this.preferredLanguageId;
|
|
180
|
-
}
|
|
181
|
-
setLanguageId(languageId, source) {
|
|
182
|
-
this.setPreferredLanguageId(languageId);
|
|
183
|
-
this.model?.setLanguageId(languageId, source);
|
|
184
|
-
}
|
|
185
|
-
setPreferredLanguageId(languageId) {
|
|
186
|
-
this.preferredLanguageId = languageId;
|
|
187
|
-
this.setForceOpenAsText();
|
|
188
|
-
}
|
|
189
|
-
setPreferredContents(contents) {
|
|
190
|
-
this.preferredContents = contents;
|
|
191
|
-
this.setForceOpenAsText();
|
|
192
|
-
}
|
|
193
|
-
setForceOpenAsText() {
|
|
194
|
-
this.forceOpenAs = 1 ;
|
|
195
|
-
}
|
|
196
|
-
setForceOpenAsBinary() {
|
|
197
|
-
this.forceOpenAs = 2 ;
|
|
198
|
-
}
|
|
199
|
-
isDirty() {
|
|
200
|
-
return !!(this.model?.isDirty());
|
|
201
|
-
}
|
|
202
|
-
isSaving() {
|
|
203
|
-
if (this.model?.hasState(0 ) || this.model?.hasState(3 ) || this.model?.hasState(5 )) {
|
|
204
|
-
return false;
|
|
205
|
-
}
|
|
206
|
-
if (this.filesConfigurationService.getAutoSaveMode() === 1 ) {
|
|
207
|
-
return true;
|
|
208
|
-
}
|
|
209
|
-
return super.isSaving();
|
|
210
|
-
}
|
|
211
|
-
prefersEditorPane(editorPanes) {
|
|
212
|
-
if (this.forceOpenAs === 2 ) {
|
|
213
|
-
return editorPanes.find(editorPane => editorPane.typeId === BINARY_FILE_EDITOR_ID);
|
|
214
|
-
}
|
|
215
|
-
return editorPanes.find(editorPane => editorPane.typeId === TEXT_FILE_EDITOR_ID);
|
|
216
|
-
}
|
|
217
|
-
resolve(options) {
|
|
218
|
-
if (this.forceOpenAs === 2 ) {
|
|
219
|
-
return this.doResolveAsBinary();
|
|
220
|
-
}
|
|
221
|
-
return this.doResolveAsText(options);
|
|
222
|
-
}
|
|
223
|
-
async doResolveAsText(options) {
|
|
224
|
-
try {
|
|
225
|
-
const preferredContents = this.preferredContents;
|
|
226
|
-
this.preferredContents = undefined;
|
|
227
|
-
await this.textFileService.files.resolve(this.resource, {
|
|
228
|
-
languageId: this.preferredLanguageId,
|
|
229
|
-
encoding: this.preferredEncoding,
|
|
230
|
-
contents: typeof preferredContents === 'string' ? createTextBufferFactory(preferredContents) : undefined,
|
|
231
|
-
reload: { async: true },
|
|
232
|
-
allowBinary: this.forceOpenAs === 1 ,
|
|
233
|
-
reason: 1 ,
|
|
234
|
-
limits: this.ensureLimits(options)
|
|
235
|
-
});
|
|
236
|
-
if (!this.cachedTextFileModelReference) {
|
|
237
|
-
this.cachedTextFileModelReference = await this.textModelService.createModelReference(this.resource);
|
|
238
|
-
}
|
|
239
|
-
const model = this.cachedTextFileModelReference.object;
|
|
240
|
-
if (this.isDisposed()) {
|
|
241
|
-
this.disposeModelReference();
|
|
242
|
-
}
|
|
243
|
-
return model;
|
|
244
|
-
}
|
|
245
|
-
catch (error) {
|
|
246
|
-
if (error.textFileOperationResult === 0 ) {
|
|
247
|
-
return this.doResolveAsBinary();
|
|
248
|
-
}
|
|
249
|
-
throw error;
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
ensureLimits(options) {
|
|
253
|
-
if (options?.limits) {
|
|
254
|
-
return options.limits;
|
|
255
|
-
}
|
|
256
|
-
const defaultSizeLimit = getLargeFileConfirmationLimit(this.resource);
|
|
257
|
-
let configuredSizeLimit = undefined;
|
|
258
|
-
const configuredSizeLimitMb = this.textResourceConfigurationService.inspect(this.resource, null, 'workbench.editorLargeFileConfirmation');
|
|
259
|
-
if (isConfigured(configuredSizeLimitMb)) {
|
|
260
|
-
configuredSizeLimit = configuredSizeLimitMb.value * ByteSize.MB;
|
|
261
|
-
}
|
|
262
|
-
return {
|
|
263
|
-
size: configuredSizeLimit ?? defaultSizeLimit
|
|
264
|
-
};
|
|
265
|
-
}
|
|
266
|
-
async doResolveAsBinary() {
|
|
267
|
-
const model = this.instantiationService.createInstance(BinaryEditorModel, this.preferredResource, this.getName());
|
|
268
|
-
await model.resolve();
|
|
269
|
-
return model;
|
|
270
|
-
}
|
|
271
|
-
isResolved() {
|
|
272
|
-
return !!this.model;
|
|
273
|
-
}
|
|
274
|
-
async rename(group, target) {
|
|
275
|
-
return {
|
|
276
|
-
editor: {
|
|
277
|
-
resource: target,
|
|
278
|
-
encoding: this.getEncoding(),
|
|
279
|
-
options: {
|
|
280
|
-
viewState: findViewStateForEditor(this, group, this.editorService)
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
};
|
|
284
|
-
}
|
|
285
|
-
toUntyped(options) {
|
|
286
|
-
const untypedInput = {
|
|
287
|
-
resource: this.preferredResource,
|
|
288
|
-
forceFile: true,
|
|
289
|
-
options: {
|
|
290
|
-
override: this.editorId
|
|
291
|
-
}
|
|
292
|
-
};
|
|
293
|
-
if (typeof options?.preserveViewState === 'number') {
|
|
294
|
-
untypedInput.encoding = this.getEncoding();
|
|
295
|
-
untypedInput.languageId = this.getLanguageId();
|
|
296
|
-
untypedInput.contents = (() => {
|
|
297
|
-
const model = this.textFileService.files.get(this.resource);
|
|
298
|
-
if (model?.isDirty() && !model.textEditorModel.isTooLargeForHeapOperation()) {
|
|
299
|
-
return model.textEditorModel.getValue();
|
|
300
|
-
}
|
|
301
|
-
return undefined;
|
|
302
|
-
})();
|
|
303
|
-
untypedInput.options = {
|
|
304
|
-
...untypedInput.options,
|
|
305
|
-
viewState: findViewStateForEditor(this, options.preserveViewState, this.editorService)
|
|
306
|
-
};
|
|
307
|
-
}
|
|
308
|
-
return untypedInput;
|
|
309
|
-
}
|
|
310
|
-
matches(otherInput) {
|
|
311
|
-
if (this === otherInput) {
|
|
312
|
-
return true;
|
|
313
|
-
}
|
|
314
|
-
if (otherInput instanceof FileEditorInput_1) {
|
|
315
|
-
return isEqual(otherInput.resource, this.resource);
|
|
316
|
-
}
|
|
317
|
-
if (isResourceEditorInput(otherInput)) {
|
|
318
|
-
return super.matches(otherInput);
|
|
319
|
-
}
|
|
320
|
-
return false;
|
|
321
|
-
}
|
|
322
|
-
dispose() {
|
|
323
|
-
this.model = undefined;
|
|
324
|
-
this.disposeModelReference();
|
|
325
|
-
super.dispose();
|
|
326
|
-
}
|
|
327
|
-
disposeModelReference() {
|
|
328
|
-
dispose(this.cachedTextFileModelReference);
|
|
329
|
-
this.cachedTextFileModelReference = undefined;
|
|
330
|
-
}
|
|
331
|
-
};
|
|
332
|
-
FileEditorInput = FileEditorInput_1 = ( __decorate([
|
|
333
|
-
( __param(7, IInstantiationService)),
|
|
334
|
-
( __param(8, ITextFileService)),
|
|
335
|
-
( __param(9, ITextModelService)),
|
|
336
|
-
( __param(10, ILabelService)),
|
|
337
|
-
( __param(11, IFileService)),
|
|
338
|
-
( __param(12, IFilesConfigurationService)),
|
|
339
|
-
( __param(13, IEditorService)),
|
|
340
|
-
( __param(14, IPathService)),
|
|
341
|
-
( __param(15, ITextResourceConfigurationService))
|
|
342
|
-
], FileEditorInput));
|
|
343
|
-
|
|
344
|
-
export { FileEditorInput };
|