@codingame/monaco-vscode-files-service-override 13.1.7 → 14.0.1
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/index.js +1 -14
- package/package.json +10 -9
- package/vscode/src/vs/platform/files/browser/indexedDBFileSystemProvider.d.ts +0 -27
- package/vscode/src/vs/platform/files/browser/indexedDBFileSystemProvider.js +8 -17
- package/vscode/src/vs/platform/files/common/fileService.js +27 -27
- package/vscode/src/vs/platform/files/common/io.js +1 -1
- package/vscode/src/vs/workbench/services/textfile/browser/browserTextFileService.d.ts +2 -2
- package/vscode/src/vs/workbench/services/textfile/browser/browserTextFileService.js +1 -1
- package/vscode/src/vs/workbench/services/textfile/browser/textFileService.d.ts +2 -3
- package/vscode/src/vs/workbench/services/textfile/browser/textFileService.js +18 -15
- package/vscode/src/vs/workbench/services/textfile/common/textFileEditorModelManager.d.ts +1 -1
- package/vscode/src/vs/workbench/services/textfile/common/textFileEditorModelManager.js +16 -8
- package/vscode/src/vs/workbench/services/textfile/common/textFileSaveParticipant.d.ts +1 -1
- package/vscode/src/vs/workbench/services/textfile/common/textFileSaveParticipant.js +2 -2
package/index.js
CHANGED
|
@@ -19,11 +19,10 @@ import { Schemas } from '@codingame/monaco-vscode-api/vscode/vs/base/common/netw
|
|
|
19
19
|
import { IndexedDBFileSystemProvider } from './vscode/src/vs/platform/files/browser/indexedDBFileSystemProvider.js';
|
|
20
20
|
import { IndexedDB } from '@codingame/monaco-vscode-2f06fe84-148e-5e6b-a7ca-c7989c5f128a-common/vscode/vs/base/browser/indexedDB';
|
|
21
21
|
export { IndexedDB } from '@codingame/monaco-vscode-2f06fe84-148e-5e6b-a7ca-c7989c5f128a-common/vscode/vs/base/browser/indexedDB';
|
|
22
|
-
import { ITelemetryService } from '@codingame/monaco-vscode-api/vscode/vs/platform/telemetry/common/telemetry.service';
|
|
23
22
|
import { BufferLogger } from '@codingame/monaco-vscode-cea4d01f-6526-5c2f-8b09-b168fead499f-common/vscode/vs/platform/log/common/bufferLog';
|
|
24
23
|
import { ITextFileService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/textfile/common/textfiles.service';
|
|
25
24
|
import { BrowserTextFileService } from './vscode/src/vs/workbench/services/textfile/browser/browserTextFileService.js';
|
|
26
|
-
import { FilesConfigurationService } from '@codingame/monaco-vscode-
|
|
25
|
+
import { FilesConfigurationService } from '@codingame/monaco-vscode-ce8c4b18-4e75-55dd-9656-517347af9de7-common/vscode/vs/workbench/services/filesConfiguration/common/filesConfigurationService';
|
|
27
26
|
import { IFilesConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/filesConfiguration/common/filesConfigurationService.service';
|
|
28
27
|
import { BrowserElevatedFileService } from './vscode/src/vs/workbench/services/files/browser/elevatedFileService.js';
|
|
29
28
|
import { IElevatedFileService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/files/common/elevatedFileService.service';
|
|
@@ -752,23 +751,11 @@ class FileServiceOverride extends FileService {
|
|
|
752
751
|
}
|
|
753
752
|
}
|
|
754
753
|
}
|
|
755
|
-
async initialize(telemetryService) {
|
|
756
|
-
for (const { scheme } of this.listCapabilities()) {
|
|
757
|
-
const provider = this.getProvider(scheme);
|
|
758
|
-
if (provider instanceof IndexedDBFileSystemProvider) {
|
|
759
|
-
this._register(provider.onReportError((e) => telemetryService.publicLog2('indexedDBFileSystemProviderError', e)));
|
|
760
|
-
}
|
|
761
|
-
}
|
|
762
|
-
}
|
|
763
754
|
}
|
|
764
755
|
FileServiceOverride.$di$dependencies = [];
|
|
765
756
|
const fileLogger = new BufferLogger();
|
|
766
757
|
registerServiceInitializePreParticipant(async (accessor) => {
|
|
767
758
|
fileLogger.logger = accessor.get(ILogService);
|
|
768
|
-
const fileService = accessor.get(IFileService);
|
|
769
|
-
if (fileService instanceof FileServiceOverride) {
|
|
770
|
-
fileService.initialize(accessor.get(ITelemetryService));
|
|
771
|
-
}
|
|
772
759
|
});
|
|
773
760
|
function getServiceOverride() {
|
|
774
761
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-files-service-override",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "14.0.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "VSCode public API plugged on the monaco editor - files service-override",
|
|
6
6
|
"keywords": [],
|
|
@@ -15,14 +15,15 @@
|
|
|
15
15
|
},
|
|
16
16
|
"type": "module",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@codingame/monaco-vscode-0c06bfba-d24d-5c4d-90cd-b40cefb7f811-common": "
|
|
19
|
-
"@codingame/monaco-vscode-15626ec7-b165-51e1-8caf-7bcc2ae9b95a-common": "
|
|
20
|
-
"@codingame/monaco-vscode-2e67e044-0db9-5fa6-8bd1-3737a7d586d4-common": "
|
|
21
|
-
"@codingame/monaco-vscode-2f06fe84-148e-5e6b-a7ca-c7989c5f128a-common": "
|
|
22
|
-
"@codingame/monaco-vscode-
|
|
23
|
-
"@codingame/monaco-vscode-
|
|
24
|
-
"@codingame/monaco-vscode-
|
|
25
|
-
"@codingame/monaco-vscode-
|
|
18
|
+
"@codingame/monaco-vscode-0c06bfba-d24d-5c4d-90cd-b40cefb7f811-common": "14.0.1",
|
|
19
|
+
"@codingame/monaco-vscode-15626ec7-b165-51e1-8caf-7bcc2ae9b95a-common": "14.0.1",
|
|
20
|
+
"@codingame/monaco-vscode-2e67e044-0db9-5fa6-8bd1-3737a7d586d4-common": "14.0.1",
|
|
21
|
+
"@codingame/monaco-vscode-2f06fe84-148e-5e6b-a7ca-c7989c5f128a-common": "14.0.1",
|
|
22
|
+
"@codingame/monaco-vscode-91789cdf-e3cb-5a04-aaeb-6f7df7d3d231-common": "14.0.1",
|
|
23
|
+
"@codingame/monaco-vscode-a17f5129-e16c-5dac-857e-dcd91bfeffa2-common": "14.0.1",
|
|
24
|
+
"@codingame/monaco-vscode-api": "14.0.1",
|
|
25
|
+
"@codingame/monaco-vscode-ce8c4b18-4e75-55dd-9656-517347af9de7-common": "14.0.1",
|
|
26
|
+
"@codingame/monaco-vscode-cea4d01f-6526-5c2f-8b09-b168fead499f-common": "14.0.1"
|
|
26
27
|
},
|
|
27
28
|
"main": "index.js",
|
|
28
29
|
"module": "index.js",
|
|
@@ -3,30 +3,6 @@ import { Disposable, IDisposable } from "@codingame/monaco-vscode-api/vscode/vs/
|
|
|
3
3
|
import { URI } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uri";
|
|
4
4
|
import { IFileDeleteOptions, IFileOverwriteOptions, FileSystemProviderCapabilities, FileType, IFileWriteOptions, IFileChange, IFileSystemProviderWithFileReadWriteCapability, IStat, IWatchOptions } from "@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files";
|
|
5
5
|
import { IndexedDB } from "@codingame/monaco-vscode-2f06fe84-148e-5e6b-a7ca-c7989c5f128a-common/vscode/vs/base/browser/indexedDB";
|
|
6
|
-
export type IndexedDBFileSystemProviderErrorDataClassification = {
|
|
7
|
-
owner: "sandy081";
|
|
8
|
-
comment: "Information about errors that occur in the IndexedDB file system provider";
|
|
9
|
-
readonly scheme: {
|
|
10
|
-
classification: "SystemMetaData";
|
|
11
|
-
purpose: "FeatureInsight";
|
|
12
|
-
comment: "IndexedDB file system provider scheme for which this error occurred";
|
|
13
|
-
};
|
|
14
|
-
readonly operation: {
|
|
15
|
-
classification: "SystemMetaData";
|
|
16
|
-
purpose: "FeatureInsight";
|
|
17
|
-
comment: "operation during which this error occurred";
|
|
18
|
-
};
|
|
19
|
-
readonly code: {
|
|
20
|
-
classification: "SystemMetaData";
|
|
21
|
-
purpose: "PerformanceAndHealth";
|
|
22
|
-
comment: "error code";
|
|
23
|
-
};
|
|
24
|
-
};
|
|
25
|
-
export type IndexedDBFileSystemProviderErrorData = {
|
|
26
|
-
readonly scheme: string;
|
|
27
|
-
readonly operation: string;
|
|
28
|
-
readonly code: string;
|
|
29
|
-
};
|
|
30
6
|
type DirEntry = [
|
|
31
7
|
string,
|
|
32
8
|
FileType
|
|
@@ -41,8 +17,6 @@ export declare class IndexedDBFileSystemProvider extends Disposable implements I
|
|
|
41
17
|
private readonly changesBroadcastChannel;
|
|
42
18
|
private readonly _onDidChangeFile;
|
|
43
19
|
readonly onDidChangeFile: Event<readonly IFileChange[]>;
|
|
44
|
-
private readonly _onReportError;
|
|
45
|
-
readonly onReportError: Event<IndexedDBFileSystemProviderErrorData>;
|
|
46
20
|
private readonly mtimes;
|
|
47
21
|
private cachedFiletree;
|
|
48
22
|
private writeManyThrottler;
|
|
@@ -63,6 +37,5 @@ export declare class IndexedDBFileSystemProvider extends Disposable implements I
|
|
|
63
37
|
private writeMany;
|
|
64
38
|
private deleteKeys;
|
|
65
39
|
reset(): Promise<void>;
|
|
66
|
-
private reportError;
|
|
67
40
|
}
|
|
68
41
|
export {};
|
|
@@ -7,17 +7,16 @@ import { ExtUri } from '@codingame/monaco-vscode-api/vscode/vs/base/common/resou
|
|
|
7
7
|
import { isString } from '@codingame/monaco-vscode-api/vscode/vs/base/common/types';
|
|
8
8
|
import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
|
|
9
9
|
import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
10
|
-
import { createFileSystemProviderError, FileSystemProviderErrorCode, FileType, FileSystemProviderCapabilities, FileChangeType
|
|
11
|
-
import {
|
|
12
|
-
import { BroadcastDataChannel } from '@codingame/monaco-vscode-e7080bda-ce3e-5243-9a35-98cd9634dbda-common/vscode/vs/base/browser/broadcast';
|
|
10
|
+
import { createFileSystemProviderError, FileSystemProviderErrorCode, FileType, FileSystemProviderCapabilities, FileChangeType } from '@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files';
|
|
11
|
+
import { BroadcastDataChannel } from '@codingame/monaco-vscode-91789cdf-e3cb-5a04-aaeb-6f7df7d3d231-common/vscode/vs/base/browser/broadcast';
|
|
13
12
|
|
|
14
|
-
const ERR_FILE_NOT_FOUND = createFileSystemProviderError(( localize(
|
|
15
|
-
const ERR_FILE_IS_DIR = createFileSystemProviderError(( localize(
|
|
16
|
-
const ERR_FILE_NOT_DIR = createFileSystemProviderError(( localize(
|
|
17
|
-
const ERR_DIR_NOT_EMPTY = createFileSystemProviderError(( localize(
|
|
18
|
-
const ERR_FILE_EXCEEDS_STORAGE_QUOTA = createFileSystemProviderError(( localize(
|
|
13
|
+
const ERR_FILE_NOT_FOUND = createFileSystemProviderError(( localize(1776, "File does not exist")), FileSystemProviderErrorCode.FileNotFound);
|
|
14
|
+
const ERR_FILE_IS_DIR = createFileSystemProviderError(( localize(1777, "File is Directory")), FileSystemProviderErrorCode.FileIsADirectory);
|
|
15
|
+
const ERR_FILE_NOT_DIR = createFileSystemProviderError(( localize(1778, "File is not a directory")), FileSystemProviderErrorCode.FileNotADirectory);
|
|
16
|
+
const ERR_DIR_NOT_EMPTY = createFileSystemProviderError(( localize(1779, "Directory is not empty")), FileSystemProviderErrorCode.Unknown);
|
|
17
|
+
const ERR_FILE_EXCEEDS_STORAGE_QUOTA = createFileSystemProviderError(( localize(1780, "File exceeds available storage quota")), FileSystemProviderErrorCode.FileExceedsStorageQuota);
|
|
19
18
|
const ERR_UNKNOWN_INTERNAL = (message) => createFileSystemProviderError(( localize(
|
|
20
|
-
|
|
19
|
+
1781,
|
|
21
20
|
"Internal error occurred in IndexedDB File System Provider. ({0})",
|
|
22
21
|
message
|
|
23
22
|
)), FileSystemProviderErrorCode.Unknown);
|
|
@@ -142,8 +141,6 @@ class IndexedDBFileSystemProvider extends Disposable {
|
|
|
142
141
|
this.extUri = ( new ExtUri(() => false)) ;
|
|
143
142
|
this._onDidChangeFile = this._register(( new Emitter()));
|
|
144
143
|
this.onDidChangeFile = this._onDidChangeFile.event;
|
|
145
|
-
this._onReportError = this._register(( new Emitter()));
|
|
146
|
-
this.onReportError = this._onReportError.event;
|
|
147
144
|
this.mtimes = ( new Map());
|
|
148
145
|
this.fileWriteBatch = [];
|
|
149
146
|
this.writeManyThrottler = ( new Throttler());
|
|
@@ -201,7 +198,6 @@ class IndexedDBFileSystemProvider extends Disposable {
|
|
|
201
198
|
}
|
|
202
199
|
}
|
|
203
200
|
catch (error) {
|
|
204
|
-
this.reportError('readDir', error);
|
|
205
201
|
throw error;
|
|
206
202
|
}
|
|
207
203
|
}
|
|
@@ -220,7 +216,6 @@ class IndexedDBFileSystemProvider extends Disposable {
|
|
|
220
216
|
return buffer;
|
|
221
217
|
}
|
|
222
218
|
catch (error) {
|
|
223
|
-
this.reportError('readFile', error);
|
|
224
219
|
throw error;
|
|
225
220
|
}
|
|
226
221
|
}
|
|
@@ -233,7 +228,6 @@ class IndexedDBFileSystemProvider extends Disposable {
|
|
|
233
228
|
await this.bulkWrite([[resource, content]]);
|
|
234
229
|
}
|
|
235
230
|
catch (error) {
|
|
236
|
-
this.reportError('writeFile', error);
|
|
237
231
|
throw error;
|
|
238
232
|
}
|
|
239
233
|
}
|
|
@@ -378,9 +372,6 @@ class IndexedDBFileSystemProvider extends Disposable {
|
|
|
378
372
|
async reset() {
|
|
379
373
|
await this.indexedDB.runInTransaction(this.store, 'readwrite', objectStore => objectStore.clear());
|
|
380
374
|
}
|
|
381
|
-
reportError(operation, error) {
|
|
382
|
-
this._onReportError.fire({ scheme: this.scheme, operation, code: error instanceof FileSystemProviderError || error instanceof DBClosedError ? error.code : 'unknown' });
|
|
383
|
-
}
|
|
384
375
|
}
|
|
385
376
|
|
|
386
377
|
export { IndexedDBFileSystemProvider };
|
|
@@ -33,7 +33,7 @@ async function mkdirp(providerExtUri, provider, directory) {
|
|
|
33
33
|
const stat = await provider.stat(directory);
|
|
34
34
|
if ((stat.type & FileType.Directory) === 0) {
|
|
35
35
|
throw ( new Error(( localize(
|
|
36
|
-
|
|
36
|
+
1782,
|
|
37
37
|
"Unable to create folder '{0}' that already exists but is not a directory",
|
|
38
38
|
resourceForError(directory)
|
|
39
39
|
))));
|
|
@@ -144,7 +144,7 @@ let FileService = class FileService extends Disposable {
|
|
|
144
144
|
async withProvider(resource) {
|
|
145
145
|
if (!isAbsolutePath(resource)) {
|
|
146
146
|
throw ( new FileOperationError(( localize(
|
|
147
|
-
|
|
147
|
+
1783,
|
|
148
148
|
"Unable to resolve filesystem provider with relative file path '{0}'",
|
|
149
149
|
this.resourceForError(resource)
|
|
150
150
|
)), FileOperationResult.FILE_INVALID_PATH));
|
|
@@ -154,7 +154,7 @@ let FileService = class FileService extends Disposable {
|
|
|
154
154
|
if (!provider) {
|
|
155
155
|
const error = ( new ErrorNoTelemetry());
|
|
156
156
|
error.message = ( localize(
|
|
157
|
-
|
|
157
|
+
1784,
|
|
158
158
|
"ENOPRO: No file system provider found for resource '{0}'",
|
|
159
159
|
(resource.toString())
|
|
160
160
|
));
|
|
@@ -187,7 +187,7 @@ let FileService = class FileService extends Disposable {
|
|
|
187
187
|
catch (error) {
|
|
188
188
|
if (toFileSystemProviderErrorCode(error) === FileSystemProviderErrorCode.FileNotFound) {
|
|
189
189
|
throw ( new FileOperationError(( localize(
|
|
190
|
-
|
|
190
|
+
1785,
|
|
191
191
|
"Unable to resolve nonexistent file '{0}'",
|
|
192
192
|
this.resourceForError(resource)
|
|
193
193
|
)), FileOperationResult.FILE_NOT_FOUND));
|
|
@@ -298,7 +298,7 @@ let FileService = class FileService extends Disposable {
|
|
|
298
298
|
async doValidateCreateFile(resource, options) {
|
|
299
299
|
if (!options?.overwrite && (await this.exists(resource))) {
|
|
300
300
|
throw ( new FileOperationError(( localize(
|
|
301
|
-
|
|
301
|
+
1786,
|
|
302
302
|
"Unable to create file '{0}' that already exists when overwrite flag is not set",
|
|
303
303
|
this.resourceForError(resource)
|
|
304
304
|
)), FileOperationResult.FILE_MODIFIED_SINCE, options));
|
|
@@ -356,7 +356,7 @@ let FileService = class FileService extends Disposable {
|
|
|
356
356
|
}
|
|
357
357
|
catch (error) {
|
|
358
358
|
throw ( new FileOperationError(( localize(
|
|
359
|
-
|
|
359
|
+
1787,
|
|
360
360
|
"Unable to write file '{0}' ({1})",
|
|
361
361
|
this.resourceForError(resource),
|
|
362
362
|
(ensureFileSystemProviderError(error).toString())
|
|
@@ -368,7 +368,7 @@ let FileService = class FileService extends Disposable {
|
|
|
368
368
|
const unlock = !!options?.unlock;
|
|
369
369
|
if (unlock && !(provider.capabilities & FileSystemProviderCapabilities.FileWriteUnlock)) {
|
|
370
370
|
throw ( new Error(( localize(
|
|
371
|
-
|
|
371
|
+
1788,
|
|
372
372
|
"Unable to unlock file '{0}' because provider does not support it.",
|
|
373
373
|
this.resourceForError(resource)
|
|
374
374
|
))));
|
|
@@ -377,21 +377,21 @@ let FileService = class FileService extends Disposable {
|
|
|
377
377
|
if (atomic) {
|
|
378
378
|
if (!(provider.capabilities & FileSystemProviderCapabilities.FileAtomicWrite)) {
|
|
379
379
|
throw ( new Error(( localize(
|
|
380
|
-
|
|
380
|
+
1789,
|
|
381
381
|
"Unable to atomically write file '{0}' because provider does not support it.",
|
|
382
382
|
this.resourceForError(resource)
|
|
383
383
|
))));
|
|
384
384
|
}
|
|
385
385
|
if (!(provider.capabilities & FileSystemProviderCapabilities.FileReadWrite)) {
|
|
386
386
|
throw ( new Error(( localize(
|
|
387
|
-
|
|
387
|
+
1790,
|
|
388
388
|
"Unable to atomically write file '{0}' because provider does not support unbuffered writes.",
|
|
389
389
|
this.resourceForError(resource)
|
|
390
390
|
))));
|
|
391
391
|
}
|
|
392
392
|
if (unlock) {
|
|
393
393
|
throw ( new Error(( localize(
|
|
394
|
-
|
|
394
|
+
1791,
|
|
395
395
|
"Unable to unlock file '{0}' because atomic write is enabled.",
|
|
396
396
|
this.resourceForError(resource)
|
|
397
397
|
))));
|
|
@@ -406,7 +406,7 @@ let FileService = class FileService extends Disposable {
|
|
|
406
406
|
}
|
|
407
407
|
if ((stat.type & FileType.Directory) !== 0) {
|
|
408
408
|
throw ( new FileOperationError(( localize(
|
|
409
|
-
|
|
409
|
+
1792,
|
|
410
410
|
"Unable to write file '{0}' that is actually a directory",
|
|
411
411
|
this.resourceForError(resource)
|
|
412
412
|
)), FileOperationResult.FILE_IS_DIRECTORY, options));
|
|
@@ -415,7 +415,7 @@ let FileService = class FileService extends Disposable {
|
|
|
415
415
|
if (typeof options?.mtime === 'number' && typeof options.etag === 'string' && options.etag !== ETAG_DISABLED &&
|
|
416
416
|
typeof stat.mtime === 'number' && typeof stat.size === 'number' &&
|
|
417
417
|
options.mtime < stat.mtime && options.etag !== etag({ mtime: options.mtime , size: stat.size })) {
|
|
418
|
-
throw ( new FileOperationError(( localize(
|
|
418
|
+
throw ( new FileOperationError(( localize(1793, "File Modified Since")), FileOperationResult.FILE_MODIFIED_SINCE, options));
|
|
419
419
|
}
|
|
420
420
|
return stat;
|
|
421
421
|
}
|
|
@@ -497,7 +497,7 @@ let FileService = class FileService extends Disposable {
|
|
|
497
497
|
}
|
|
498
498
|
restoreReadError(error, resource, options) {
|
|
499
499
|
const message = ( localize(
|
|
500
|
-
|
|
500
|
+
1794,
|
|
501
501
|
"Unable to read file '{0}' ({1})",
|
|
502
502
|
this.resourceForError(resource),
|
|
503
503
|
(ensureFileSystemProviderError(error).toString())
|
|
@@ -557,13 +557,13 @@ let FileService = class FileService extends Disposable {
|
|
|
557
557
|
const stat = await this.resolve(resource, { resolveMetadata: true });
|
|
558
558
|
if (stat.isDirectory) {
|
|
559
559
|
throw ( new FileOperationError(( localize(
|
|
560
|
-
|
|
560
|
+
1795,
|
|
561
561
|
"Unable to read file '{0}' that is actually a directory",
|
|
562
562
|
this.resourceForError(resource)
|
|
563
563
|
)), FileOperationResult.FILE_IS_DIRECTORY, options));
|
|
564
564
|
}
|
|
565
565
|
if (typeof options?.etag === 'string' && options.etag !== ETAG_DISABLED && options.etag === stat.etag) {
|
|
566
|
-
throw ( new NotModifiedSinceFileOperationError(( localize(
|
|
566
|
+
throw ( new NotModifiedSinceFileOperationError(( localize(1796, "File not modified since")), stat, options));
|
|
567
567
|
}
|
|
568
568
|
this.validateReadFileLimits(resource, stat.size, options);
|
|
569
569
|
return stat;
|
|
@@ -571,7 +571,7 @@ let FileService = class FileService extends Disposable {
|
|
|
571
571
|
validateReadFileLimits(resource, size, options) {
|
|
572
572
|
if (typeof options?.limits?.size === 'number' && size > options.limits.size) {
|
|
573
573
|
throw ( new TooLargeFileOperationError(( localize(
|
|
574
|
-
|
|
574
|
+
1797,
|
|
575
575
|
"Unable to read file '{0}' that is too large to open",
|
|
576
576
|
this.resourceForError(resource)
|
|
577
577
|
)), FileOperationResult.FILE_TOO_LARGE, size, options));
|
|
@@ -693,7 +693,7 @@ let FileService = class FileService extends Disposable {
|
|
|
693
693
|
}
|
|
694
694
|
if (isSameResourceWithDifferentPathCase && mode === 'copy') {
|
|
695
695
|
throw ( new Error(( localize(
|
|
696
|
-
|
|
696
|
+
1798,
|
|
697
697
|
"Unable to copy when source '{0}' is same as target '{1}' with different path case on a case insensitive file system",
|
|
698
698
|
this.resourceForError(source),
|
|
699
699
|
this.resourceForError(target)
|
|
@@ -701,7 +701,7 @@ let FileService = class FileService extends Disposable {
|
|
|
701
701
|
}
|
|
702
702
|
if (!isSameResourceWithDifferentPathCase && providerExtUri.isEqualOrParent(target, source)) {
|
|
703
703
|
throw ( new Error(( localize(
|
|
704
|
-
|
|
704
|
+
1799,
|
|
705
705
|
"Unable to move/copy when source '{0}' is parent of target '{1}'.",
|
|
706
706
|
this.resourceForError(source),
|
|
707
707
|
this.resourceForError(target)
|
|
@@ -712,7 +712,7 @@ let FileService = class FileService extends Disposable {
|
|
|
712
712
|
if (exists && !isSameResourceWithDifferentPathCase) {
|
|
713
713
|
if (!overwrite) {
|
|
714
714
|
throw ( new FileOperationError(( localize(
|
|
715
|
-
|
|
715
|
+
1800,
|
|
716
716
|
"Unable to move/copy '{0}' because target '{1}' already exists at destination.",
|
|
717
717
|
this.resourceForError(source),
|
|
718
718
|
this.resourceForError(target)
|
|
@@ -722,7 +722,7 @@ let FileService = class FileService extends Disposable {
|
|
|
722
722
|
const { providerExtUri } = this.getExtUri(sourceProvider);
|
|
723
723
|
if (providerExtUri.isEqualOrParent(source, target)) {
|
|
724
724
|
throw ( new Error(( localize(
|
|
725
|
-
|
|
725
|
+
1801,
|
|
726
726
|
"Unable to move/copy '{0}' into '{1}' since a file would replace the folder it is contained in.",
|
|
727
727
|
this.resourceForError(source),
|
|
728
728
|
this.resourceForError(target)
|
|
@@ -767,7 +767,7 @@ let FileService = class FileService extends Disposable {
|
|
|
767
767
|
const useTrash = !!options?.useTrash;
|
|
768
768
|
if (useTrash && !(provider.capabilities & FileSystemProviderCapabilities.Trash)) {
|
|
769
769
|
throw ( new Error(( localize(
|
|
770
|
-
|
|
770
|
+
1802,
|
|
771
771
|
"Unable to delete file '{0}' via trash because provider does not support it.",
|
|
772
772
|
this.resourceForError(resource)
|
|
773
773
|
))));
|
|
@@ -775,14 +775,14 @@ let FileService = class FileService extends Disposable {
|
|
|
775
775
|
const atomic = options?.atomic;
|
|
776
776
|
if (atomic && !(provider.capabilities & FileSystemProviderCapabilities.FileAtomicDelete)) {
|
|
777
777
|
throw ( new Error(( localize(
|
|
778
|
-
|
|
778
|
+
1803,
|
|
779
779
|
"Unable to delete file '{0}' atomically because provider does not support it.",
|
|
780
780
|
this.resourceForError(resource)
|
|
781
781
|
))));
|
|
782
782
|
}
|
|
783
783
|
if (useTrash && atomic) {
|
|
784
784
|
throw ( new Error(( localize(
|
|
785
|
-
|
|
785
|
+
1804,
|
|
786
786
|
"Unable to atomically delete file '{0}' because using trash is enabled.",
|
|
787
787
|
this.resourceForError(resource)
|
|
788
788
|
))));
|
|
@@ -798,7 +798,7 @@ let FileService = class FileService extends Disposable {
|
|
|
798
798
|
}
|
|
799
799
|
else {
|
|
800
800
|
throw ( new FileOperationError(( localize(
|
|
801
|
-
|
|
801
|
+
1805,
|
|
802
802
|
"Unable to delete nonexistent file '{0}'",
|
|
803
803
|
this.resourceForError(resource)
|
|
804
804
|
)), FileOperationResult.FILE_NOT_FOUND));
|
|
@@ -808,7 +808,7 @@ let FileService = class FileService extends Disposable {
|
|
|
808
808
|
const stat = await this.resolve(resource);
|
|
809
809
|
if (stat.isDirectory && Array.isArray(stat.children) && stat.children.length > 0) {
|
|
810
810
|
throw ( new Error(( localize(
|
|
811
|
-
|
|
811
|
+
1806,
|
|
812
812
|
"Unable to delete non-empty folder '{0}'.",
|
|
813
813
|
this.resourceForError(resource)
|
|
814
814
|
))));
|
|
@@ -1067,7 +1067,7 @@ let FileService = class FileService extends Disposable {
|
|
|
1067
1067
|
throwIfFileSystemIsReadonly(provider, resource) {
|
|
1068
1068
|
if (provider.capabilities & FileSystemProviderCapabilities.Readonly) {
|
|
1069
1069
|
throw ( new FileOperationError(( localize(
|
|
1070
|
-
|
|
1070
|
+
1807,
|
|
1071
1071
|
"Unable to modify read-only file '{0}'",
|
|
1072
1072
|
this.resourceForError(resource)
|
|
1073
1073
|
)), FileOperationResult.FILE_PERMISSION_DENIED));
|
|
@@ -1077,7 +1077,7 @@ let FileService = class FileService extends Disposable {
|
|
|
1077
1077
|
throwIfFileIsReadonly(resource, stat) {
|
|
1078
1078
|
if ((stat.permissions ?? 0) & FilePermission.Readonly) {
|
|
1079
1079
|
throw ( new FileOperationError(( localize(
|
|
1080
|
-
|
|
1080
|
+
1807,
|
|
1081
1081
|
"Unable to modify read-only file '{0}'",
|
|
1082
1082
|
this.resourceForError(resource)
|
|
1083
1083
|
)), FileOperationResult.FILE_PERMISSION_DENIED));
|
|
@@ -70,7 +70,7 @@ function throwIfCancelled(token) {
|
|
|
70
70
|
}
|
|
71
71
|
function throwIfTooLarge(totalBytesRead, options) {
|
|
72
72
|
if (typeof options?.limits?.size === 'number' && totalBytesRead > options.limits.size) {
|
|
73
|
-
throw createFileSystemProviderError(( localize(
|
|
73
|
+
throw createFileSystemProviderError(( localize(1814, "File is too large to open")), FileSystemProviderErrorCode.FileTooLarge);
|
|
74
74
|
}
|
|
75
75
|
return true;
|
|
76
76
|
}
|
|
@@ -13,12 +13,12 @@ import { IElevatedFileService } from "@codingame/monaco-vscode-api/vscode/vs/wor
|
|
|
13
13
|
import { IFilesConfigurationService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/filesConfiguration/common/filesConfigurationService.service";
|
|
14
14
|
import { ILifecycleService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/lifecycle/common/lifecycle.service";
|
|
15
15
|
import { IPathService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/path/common/pathService.service";
|
|
16
|
-
import {
|
|
16
|
+
import { IUntitledTextEditorModelManager } from "@codingame/monaco-vscode-view-common-service-override/vscode/vs/workbench/services/untitled/common/untitledTextEditorService";
|
|
17
17
|
import { IUriIdentityService } from "@codingame/monaco-vscode-api/vscode/vs/platform/uriIdentity/common/uriIdentity.service";
|
|
18
18
|
import { IWorkingCopyFileService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/workingCopy/common/workingCopyFileService.service";
|
|
19
19
|
import { IDecorationsService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/decorations/common/decorations.service";
|
|
20
20
|
export declare class BrowserTextFileService extends AbstractTextFileService {
|
|
21
|
-
constructor(fileService: IFileService, untitledTextEditorService:
|
|
21
|
+
constructor(fileService: IFileService, untitledTextEditorService: IUntitledTextEditorModelManager, lifecycleService: ILifecycleService, instantiationService: IInstantiationService, modelService: IModelService, environmentService: IWorkbenchEnvironmentService, dialogService: IDialogService, fileDialogService: IFileDialogService, textResourceConfigurationService: ITextResourceConfigurationService, filesConfigurationService: IFilesConfigurationService, codeEditorService: ICodeEditorService, pathService: IPathService, workingCopyFileService: IWorkingCopyFileService, uriIdentityService: IUriIdentityService, languageService: ILanguageService, elevatedFileService: IElevatedFileService, logService: ILogService, decorationsService: IDecorationsService);
|
|
22
22
|
private registerListeners;
|
|
23
23
|
private onBeforeShutdown;
|
|
24
24
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
3
|
import { AbstractTextFileService } from './textFileService.js';
|
|
4
|
-
import { TextFileEditorModelState } from '@codingame/monaco-vscode-
|
|
4
|
+
import { TextFileEditorModelState } from '@codingame/monaco-vscode-a17f5129-e16c-5dac-857e-dcd91bfeffa2-common/vscode/vs/workbench/services/textfile/common/textfiles';
|
|
5
5
|
import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
|
|
6
6
|
import '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/extensions';
|
|
7
7
|
import { IWorkbenchEnvironmentService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/environment/common/environmentService.service';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { URI } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uri";
|
|
2
|
-
import { ITextFileStreamContent, ITextFileContent, IResourceEncodings, IReadTextFileOptions, IWriteTextFileOptions, ITextFileSaveOptions, ITextFileEditorModelManager, IResourceEncoding, ITextFileSaveAsOptions, IReadTextFileEncodingOptions } from "@codingame/monaco-vscode-
|
|
2
|
+
import { ITextFileStreamContent, ITextFileContent, IResourceEncodings, IReadTextFileOptions, IWriteTextFileOptions, ITextFileSaveOptions, ITextFileEditorModelManager, IResourceEncoding, ITextFileSaveAsOptions, IReadTextFileEncodingOptions } from "@codingame/monaco-vscode-a17f5129-e16c-5dac-857e-dcd91bfeffa2-common/vscode/vs/workbench/services/textfile/common/textfiles";
|
|
3
3
|
import { ITextFileService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/textfile/common/textfiles.service";
|
|
4
4
|
import { IRevertOptions } from "@codingame/monaco-vscode-api/vscode/vs/workbench/common/editor";
|
|
5
5
|
import { ILifecycleService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/lifecycle/common/lifecycle.service";
|
|
@@ -8,7 +8,6 @@ import { IFileService } from "@codingame/monaco-vscode-api/vscode/vs/platform/fi
|
|
|
8
8
|
import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
|
|
9
9
|
import { IWorkbenchEnvironmentService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/environment/common/environmentService.service";
|
|
10
10
|
import { IUntitledTextEditorModelManager } from "@codingame/monaco-vscode-view-common-service-override/vscode/vs/workbench/services/untitled/common/untitledTextEditorService";
|
|
11
|
-
import { IUntitledTextEditorService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/untitled/common/untitledTextEditorService.service";
|
|
12
11
|
import { IInstantiationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation";
|
|
13
12
|
import { IModelService } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/services/model";
|
|
14
13
|
import { IFileDialogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/dialogs/common/dialogs.service";
|
|
@@ -52,7 +51,7 @@ export declare abstract class AbstractTextFileService extends Disposable impleme
|
|
|
52
51
|
private static readonly TEXTFILE_SAVE_REPLACE_SOURCE;
|
|
53
52
|
readonly files: ITextFileEditorModelManager;
|
|
54
53
|
readonly untitled: IUntitledTextEditorModelManager;
|
|
55
|
-
constructor(fileService: IFileService, untitledTextEditorService:
|
|
54
|
+
constructor(fileService: IFileService, untitledTextEditorService: IUntitledTextEditorModelManager, lifecycleService: ILifecycleService, instantiationService: IInstantiationService, modelService: IModelService, environmentService: IWorkbenchEnvironmentService, dialogService: IDialogService, fileDialogService: IFileDialogService, textResourceConfigurationService: ITextResourceConfigurationService, filesConfigurationService: IFilesConfigurationService, codeEditorService: ICodeEditorService, pathService: IPathService, workingCopyFileService: IWorkingCopyFileService, uriIdentityService: IUriIdentityService, languageService: ILanguageService, logService: ILogService, elevatedFileService: IElevatedFileService, decorationsService: IDecorationsService);
|
|
56
55
|
private provideDecorations;
|
|
57
56
|
private _encoding;
|
|
58
57
|
get encoding(): EncodingOracle;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
3
|
import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
4
|
-
import { TextFileEditorModelState, TextFileOperationError, TextFileOperationResult, toBufferOrReadable, stringToSnapshot } from '@codingame/monaco-vscode-
|
|
4
|
+
import { TextFileEditorModelState, TextFileOperationError, TextFileOperationResult, toBufferOrReadable, stringToSnapshot } from '@codingame/monaco-vscode-a17f5129-e16c-5dac-857e-dcd91bfeffa2-common/vscode/vs/workbench/services/textfile/common/textfiles';
|
|
5
5
|
import { SaveSourceRegistry } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/editor';
|
|
6
6
|
import { ILifecycleService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/lifecycle/common/lifecycle.service';
|
|
7
7
|
import { FileOperationResult } from '@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files';
|
|
@@ -22,7 +22,7 @@ import { bufferToStream } from '@codingame/monaco-vscode-api/vscode/vs/base/comm
|
|
|
22
22
|
import { ITextResourceConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/services/textResourceConfiguration';
|
|
23
23
|
import { PLAINTEXT_LANGUAGE_ID } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/languages/modesRegistry';
|
|
24
24
|
import { IFilesConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/filesConfiguration/common/filesConfigurationService.service';
|
|
25
|
-
import { BaseTextEditorModel } from '@codingame/monaco-vscode-
|
|
25
|
+
import { BaseTextEditorModel } from '@codingame/monaco-vscode-a17f5129-e16c-5dac-857e-dcd91bfeffa2-common/vscode/vs/workbench/common/editor/textEditorModel';
|
|
26
26
|
import { ICodeEditorService } from '@codingame/monaco-vscode-api/vscode/vs/editor/browser/services/codeEditorService';
|
|
27
27
|
import { IPathService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/path/common/pathService.service';
|
|
28
28
|
import { IWorkingCopyFileService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/workingCopy/common/workingCopyFileService.service';
|
|
@@ -53,8 +53,8 @@ import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/sear
|
|
|
53
53
|
var AbstractTextFileService_1;
|
|
54
54
|
let AbstractTextFileService = class AbstractTextFileService extends Disposable {
|
|
55
55
|
static { AbstractTextFileService_1 = this; }
|
|
56
|
-
static { this.TEXTFILE_SAVE_CREATE_SOURCE = SaveSourceRegistry.registerSource('textFileCreate.source', ( localize(
|
|
57
|
-
static { this.TEXTFILE_SAVE_REPLACE_SOURCE = SaveSourceRegistry.registerSource('textFileOverwrite.source', ( localize(
|
|
56
|
+
static { this.TEXTFILE_SAVE_CREATE_SOURCE = SaveSourceRegistry.registerSource('textFileCreate.source', ( localize(11998, "File Created"))); }
|
|
57
|
+
static { this.TEXTFILE_SAVE_REPLACE_SOURCE = SaveSourceRegistry.registerSource('textFileOverwrite.source', ( localize(11999, "File Replaced"))); }
|
|
58
58
|
constructor(fileService, untitledTextEditorService, lifecycleService, instantiationService, modelService, environmentService, dialogService, fileDialogService, textResourceConfigurationService, filesConfigurationService, codeEditorService, pathService, workingCopyFileService, uriIdentityService, languageService, logService, elevatedFileService, decorationsService) {
|
|
59
59
|
super();
|
|
60
60
|
this.fileService = fileService;
|
|
@@ -84,7 +84,7 @@ let AbstractTextFileService = class AbstractTextFileService extends Disposable {
|
|
|
84
84
|
constructor(files) {
|
|
85
85
|
super();
|
|
86
86
|
this.files = files;
|
|
87
|
-
this.label = ( localize(
|
|
87
|
+
this.label = ( localize(12000, "Text File Model Decorations"));
|
|
88
88
|
this._onDidChange = this._register(( new Emitter()));
|
|
89
89
|
this.onDidChange = this._onDidChange.event;
|
|
90
90
|
this.registerListeners();
|
|
@@ -111,20 +111,20 @@ let AbstractTextFileService = class AbstractTextFileService extends Disposable {
|
|
|
111
111
|
color: listErrorForeground,
|
|
112
112
|
letter: Codicon.lockSmall,
|
|
113
113
|
strikethrough: true,
|
|
114
|
-
tooltip: ( localize(
|
|
114
|
+
tooltip: ( localize(12001, "Deleted, Read-only")),
|
|
115
115
|
};
|
|
116
116
|
}
|
|
117
117
|
else if (isReadonly) {
|
|
118
118
|
return {
|
|
119
119
|
letter: Codicon.lockSmall,
|
|
120
|
-
tooltip: ( localize(
|
|
120
|
+
tooltip: ( localize(12002, "Read-only")),
|
|
121
121
|
};
|
|
122
122
|
}
|
|
123
123
|
else if (isOrphaned) {
|
|
124
124
|
return {
|
|
125
125
|
color: listErrorForeground,
|
|
126
126
|
strikethrough: true,
|
|
127
|
-
tooltip: ( localize(
|
|
127
|
+
tooltip: ( localize(12003, "Deleted")),
|
|
128
128
|
};
|
|
129
129
|
}
|
|
130
130
|
return undefined;
|
|
@@ -177,7 +177,7 @@ let AbstractTextFileService = class AbstractTextFileService extends Disposable {
|
|
|
177
177
|
catch (error) {
|
|
178
178
|
cts.dispose(true);
|
|
179
179
|
if (error.decodeStreamErrorKind === DecodeStreamErrorKind.STREAM_IS_BINARY) {
|
|
180
|
-
throw ( new TextFileOperationError(( localize(
|
|
180
|
+
throw ( new TextFileOperationError(( localize(12004, "File seems to be binary and cannot be opened as text")), TextFileOperationResult.FILE_IS_BINARY, options));
|
|
181
181
|
}
|
|
182
182
|
else {
|
|
183
183
|
throw error;
|
|
@@ -307,6 +307,9 @@ let AbstractTextFileService = class AbstractTextFileService extends Disposable {
|
|
|
307
307
|
catch (error) {
|
|
308
308
|
this.logService.error(error);
|
|
309
309
|
}
|
|
310
|
+
if (source.scheme === Schemas.untitled) {
|
|
311
|
+
this.untitled.notifyDidSave(source, target);
|
|
312
|
+
}
|
|
310
313
|
return target;
|
|
311
314
|
}
|
|
312
315
|
async doSaveAsTextFile(sourceModel, source, target, options) {
|
|
@@ -392,17 +395,17 @@ let AbstractTextFileService = class AbstractTextFileService extends Disposable {
|
|
|
392
395
|
const { confirmed } = await this.dialogService.confirm({
|
|
393
396
|
type: 'warning',
|
|
394
397
|
message: ( localize(
|
|
395
|
-
|
|
398
|
+
12005,
|
|
396
399
|
"'{0}' already exists. Do you want to replace it?",
|
|
397
400
|
basename(resource)
|
|
398
401
|
)),
|
|
399
402
|
detail: ( localize(
|
|
400
|
-
|
|
403
|
+
12006,
|
|
401
404
|
"A file or folder with the name '{0}' already exists in the folder '{1}'. Replacing it will overwrite its current contents.",
|
|
402
405
|
basename(resource),
|
|
403
406
|
basename(dirname(resource))
|
|
404
407
|
)),
|
|
405
|
-
primaryButton: ( localize(
|
|
408
|
+
primaryButton: ( localize(12007, "&&Replace")),
|
|
406
409
|
});
|
|
407
410
|
return confirmed;
|
|
408
411
|
}
|
|
@@ -410,12 +413,12 @@ let AbstractTextFileService = class AbstractTextFileService extends Disposable {
|
|
|
410
413
|
const { confirmed } = await this.dialogService.confirm({
|
|
411
414
|
type: 'warning',
|
|
412
415
|
message: ( localize(
|
|
413
|
-
|
|
416
|
+
12008,
|
|
414
417
|
"'{0}' is marked as read-only. Do you want to save anyway?",
|
|
415
418
|
basename(resource)
|
|
416
419
|
)),
|
|
417
|
-
detail: ( localize(
|
|
418
|
-
primaryButton: ( localize(
|
|
420
|
+
detail: ( localize(12009, "Paths can be configured as read-only via settings.")),
|
|
421
|
+
primaryButton: ( localize(12010, "&&Save Anyway"))
|
|
419
422
|
});
|
|
420
423
|
return confirmed;
|
|
421
424
|
}
|
|
@@ -2,7 +2,7 @@ import { Event } from "@codingame/monaco-vscode-api/vscode/vs/base/common/event"
|
|
|
2
2
|
import { URI } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uri";
|
|
3
3
|
import { TextFileEditorModel } from "@codingame/monaco-vscode-0c06bfba-d24d-5c4d-90cd-b40cefb7f811-common/vscode/vs/workbench/services/textfile/common/textFileEditorModel";
|
|
4
4
|
import { IDisposable, Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
|
|
5
|
-
import { ITextFileEditorModel, ITextFileEditorModelManager, ITextFileEditorModelResolveOrCreateOptions, ITextFileResolveEvent, ITextFileSaveEvent, ITextFileSaveParticipant } from "@codingame/monaco-vscode-
|
|
5
|
+
import { ITextFileEditorModel, ITextFileEditorModelManager, ITextFileEditorModelResolveOrCreateOptions, ITextFileResolveEvent, ITextFileSaveEvent, ITextFileSaveParticipant } from "@codingame/monaco-vscode-a17f5129-e16c-5dac-857e-dcd91bfeffa2-common/vscode/vs/workbench/services/textfile/common/textfiles";
|
|
6
6
|
import { IInstantiationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation";
|
|
7
7
|
import { IFileService } from "@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files.service";
|
|
8
8
|
import { CancellationToken } from "@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation";
|
|
@@ -63,7 +63,7 @@ let TextFileEditorModelManager = class TextFileEditorModelManager extends Dispos
|
|
|
63
63
|
return {
|
|
64
64
|
onSaveError(error, model) {
|
|
65
65
|
notificationService.error(( localize(
|
|
66
|
-
|
|
66
|
+
12014,
|
|
67
67
|
"Failed to save '{0}': {1}",
|
|
68
68
|
model.name,
|
|
69
69
|
toErrorMessage(error, false)
|
|
@@ -148,10 +148,14 @@ let TextFileEditorModelManager = class TextFileEditorModelManager extends Dispos
|
|
|
148
148
|
else {
|
|
149
149
|
targetModelResource = joinPath(target, sourceModelResource.path.substr(source.path.length + 1));
|
|
150
150
|
}
|
|
151
|
+
const languageId = sourceModel.getLanguageId();
|
|
151
152
|
modelsToRestore.push({
|
|
152
153
|
source: sourceModelResource,
|
|
153
154
|
target: targetModelResource,
|
|
154
|
-
|
|
155
|
+
language: languageId ? {
|
|
156
|
+
id: languageId,
|
|
157
|
+
explicit: sourceModel.languageChangeSource === 'user'
|
|
158
|
+
} : undefined,
|
|
155
159
|
encoding: sourceModel.getEncoding(),
|
|
156
160
|
snapshot: sourceModel.isDirty() ? sourceModel.createSnapshot() : undefined
|
|
157
161
|
});
|
|
@@ -199,11 +203,13 @@ let TextFileEditorModelManager = class TextFileEditorModelManager extends Dispos
|
|
|
199
203
|
contents: modelToRestore.snapshot ? createTextBufferFactoryFromSnapshot(modelToRestore.snapshot) : undefined,
|
|
200
204
|
encoding: modelToRestore.encoding
|
|
201
205
|
});
|
|
202
|
-
if (modelToRestore.
|
|
203
|
-
modelToRestore.
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
restoredModel.
|
|
206
|
+
if (modelToRestore.language?.id && modelToRestore.language.id !== PLAINTEXT_LANGUAGE_ID) {
|
|
207
|
+
if (modelToRestore.language.explicit) {
|
|
208
|
+
restoredModel.setLanguageId(modelToRestore.language.id);
|
|
209
|
+
}
|
|
210
|
+
else if (restoredModel.getLanguageId() === PLAINTEXT_LANGUAGE_ID && extname(target) !== PLAINTEXT_EXTENSION) {
|
|
211
|
+
restoredModel.updateTextEditorModel(undefined, modelToRestore.language.id);
|
|
212
|
+
}
|
|
207
213
|
}
|
|
208
214
|
})));
|
|
209
215
|
}
|
|
@@ -256,7 +262,9 @@ let TextFileEditorModelManager = class TextFileEditorModelManager extends Dispos
|
|
|
256
262
|
await model.resolve(options);
|
|
257
263
|
}
|
|
258
264
|
catch (error) {
|
|
259
|
-
|
|
265
|
+
if (!model.isDisposed()) {
|
|
266
|
+
onUnexpectedError(error);
|
|
267
|
+
}
|
|
260
268
|
}
|
|
261
269
|
})();
|
|
262
270
|
}
|
|
@@ -2,7 +2,7 @@ import { CancellationToken } from "@codingame/monaco-vscode-api/vscode/vs/base/c
|
|
|
2
2
|
import { ILogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service";
|
|
3
3
|
import { IProgress, IProgressStep } from "@codingame/monaco-vscode-api/vscode/vs/platform/progress/common/progress";
|
|
4
4
|
import { IProgressService } from "@codingame/monaco-vscode-api/vscode/vs/platform/progress/common/progress.service";
|
|
5
|
-
import { ITextFileSaveParticipant, ITextFileEditorModel, ITextFileSaveParticipantContext } from "@codingame/monaco-vscode-
|
|
5
|
+
import { ITextFileSaveParticipant, ITextFileEditorModel, ITextFileSaveParticipantContext } from "@codingame/monaco-vscode-a17f5129-e16c-5dac-857e-dcd91bfeffa2-common/vscode/vs/workbench/services/textfile/common/textfiles";
|
|
6
6
|
import { IDisposable, Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
|
|
7
7
|
export declare class TextFileSaveParticipant extends Disposable {
|
|
8
8
|
private readonly logService;
|
|
@@ -26,13 +26,13 @@ let TextFileSaveParticipant = class TextFileSaveParticipant extends Disposable {
|
|
|
26
26
|
const cts = ( new CancellationTokenSource(token));
|
|
27
27
|
model.textEditorModel?.pushStackElement();
|
|
28
28
|
progress.report({
|
|
29
|
-
message: ( localize(
|
|
29
|
+
message: ( localize(12015, "Running Code Actions and Formatters..."))
|
|
30
30
|
});
|
|
31
31
|
let bubbleCancel = false;
|
|
32
32
|
await this.progressService.withProgress({
|
|
33
33
|
priority: NotificationPriority.URGENT,
|
|
34
34
|
location: ProgressLocation.Notification,
|
|
35
|
-
cancellable: ( localize(
|
|
35
|
+
cancellable: ( localize(12016, "Skip")),
|
|
36
36
|
delay: model.isDirty() ? 5000 : 3000
|
|
37
37
|
}, async (progress) => {
|
|
38
38
|
for (const saveParticipant of this.saveParticipants) {
|