@codingame/monaco-vscode-files-service-override 3.2.3 → 4.1.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.
- package/files.js +5 -4
- package/index.js +1 -1
- package/package.json +2 -2
- package/vscode/src/vs/workbench/services/files/browser/elevatedFileService.js +2 -0
- package/override/vs/platform/dialogs/common/dialogs.js +0 -8
- package/vscode/src/vs/platform/files/browser/indexedDBFileSystemProvider.js +0 -406
- package/vscode/src/vs/platform/files/common/fileService.js +0 -988
- package/vscode/src/vs/platform/files/common/io.js +0 -77
- package/vscode/src/vs/workbench/services/textfile/browser/browserTextFileService.js +0 -58
- package/vscode/src/vs/workbench/services/textfile/browser/textFileService.js +0 -644
- package/vscode/src/vs/workbench/services/textfile/common/textFileEditorModelManager.js +0 -404
- package/vscode/src/vs/workbench/services/textfile/common/textFileSaveParticipant.js +0 -64
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { VSBuffer } from 'vscode/vscode/vs/base/common/buffer';
|
|
2
|
-
import { canceled } from 'vscode/vscode/vs/base/common/errors';
|
|
3
|
-
import { localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
4
|
-
import { ensureFileSystemProviderError, createFileSystemProviderError, FileSystemProviderErrorCode } from 'vscode/vscode/vs/platform/files/common/files';
|
|
5
|
-
|
|
6
|
-
async function readFileIntoStream(provider, resource, target, transformer, options, token) {
|
|
7
|
-
let error = undefined;
|
|
8
|
-
try {
|
|
9
|
-
await doReadFileIntoStream(provider, resource, target, transformer, options, token);
|
|
10
|
-
}
|
|
11
|
-
catch (err) {
|
|
12
|
-
error = err;
|
|
13
|
-
}
|
|
14
|
-
finally {
|
|
15
|
-
if (error && options.errorTransformer) {
|
|
16
|
-
error = options.errorTransformer(error);
|
|
17
|
-
}
|
|
18
|
-
if (typeof error !== 'undefined') {
|
|
19
|
-
target.error(error);
|
|
20
|
-
}
|
|
21
|
-
target.end();
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
async function doReadFileIntoStream(provider, resource, target, transformer, options, token) {
|
|
25
|
-
throwIfCancelled(token);
|
|
26
|
-
const handle = await provider.open(resource, { create: false });
|
|
27
|
-
try {
|
|
28
|
-
throwIfCancelled(token);
|
|
29
|
-
let totalBytesRead = 0;
|
|
30
|
-
let bytesRead = 0;
|
|
31
|
-
let allowedRemainingBytes = (options && typeof options.length === 'number') ? options.length : undefined;
|
|
32
|
-
let buffer = VSBuffer.alloc(Math.min(options.bufferSize, typeof allowedRemainingBytes === 'number' ? allowedRemainingBytes : options.bufferSize));
|
|
33
|
-
let posInFile = options && typeof options.position === 'number' ? options.position : 0;
|
|
34
|
-
let posInBuffer = 0;
|
|
35
|
-
do {
|
|
36
|
-
bytesRead = await provider.read(handle, posInFile, buffer.buffer, posInBuffer, buffer.byteLength - posInBuffer);
|
|
37
|
-
posInFile += bytesRead;
|
|
38
|
-
posInBuffer += bytesRead;
|
|
39
|
-
totalBytesRead += bytesRead;
|
|
40
|
-
if (typeof allowedRemainingBytes === 'number') {
|
|
41
|
-
allowedRemainingBytes -= bytesRead;
|
|
42
|
-
}
|
|
43
|
-
if (posInBuffer === buffer.byteLength) {
|
|
44
|
-
await target.write(transformer(buffer));
|
|
45
|
-
buffer = VSBuffer.alloc(Math.min(options.bufferSize, typeof allowedRemainingBytes === 'number' ? allowedRemainingBytes : options.bufferSize));
|
|
46
|
-
posInBuffer = 0;
|
|
47
|
-
}
|
|
48
|
-
} while (bytesRead > 0 && (typeof allowedRemainingBytes !== 'number' || allowedRemainingBytes > 0) && throwIfCancelled(token) && throwIfTooLarge(totalBytesRead, options));
|
|
49
|
-
if (posInBuffer > 0) {
|
|
50
|
-
let lastChunkLength = posInBuffer;
|
|
51
|
-
if (typeof allowedRemainingBytes === 'number') {
|
|
52
|
-
lastChunkLength = Math.min(posInBuffer, allowedRemainingBytes);
|
|
53
|
-
}
|
|
54
|
-
target.write(transformer(buffer.slice(0, lastChunkLength)));
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
catch (error) {
|
|
58
|
-
throw ensureFileSystemProviderError(error);
|
|
59
|
-
}
|
|
60
|
-
finally {
|
|
61
|
-
await provider.close(handle);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
function throwIfCancelled(token) {
|
|
65
|
-
if (token.isCancellationRequested) {
|
|
66
|
-
throw canceled();
|
|
67
|
-
}
|
|
68
|
-
return true;
|
|
69
|
-
}
|
|
70
|
-
function throwIfTooLarge(totalBytesRead, options) {
|
|
71
|
-
if (typeof options?.limits?.size === 'number' && totalBytesRead > options.limits.size) {
|
|
72
|
-
throw createFileSystemProviderError(localizeWithPath('vs/platform/files/common/io', 'fileTooLargeError', "File is too large to open"), FileSystemProviderErrorCode.FileTooLarge);
|
|
73
|
-
}
|
|
74
|
-
return true;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
export { readFileIntoStream };
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
-
import { AbstractTextFileService } from './textFileService.js';
|
|
3
|
-
import { IWorkbenchEnvironmentService } from 'vscode/vscode/vs/workbench/services/environment/common/environmentService';
|
|
4
|
-
import { ICodeEditorService } from 'vscode/vscode/vs/editor/browser/services/codeEditorService';
|
|
5
|
-
import { IModelService } from 'vscode/vscode/vs/editor/common/services/model';
|
|
6
|
-
import { ILanguageService } from 'vscode/vscode/vs/editor/common/languages/language';
|
|
7
|
-
import { ITextResourceConfigurationService } from 'vscode/vscode/vs/editor/common/services/textResourceConfiguration';
|
|
8
|
-
import '../../../../../../../override/vs/platform/dialogs/common/dialogs.js';
|
|
9
|
-
import { IFileService } from 'vscode/vscode/vs/platform/files/common/files';
|
|
10
|
-
import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
11
|
-
import { ILogService } from 'vscode/vscode/vs/platform/log/common/log';
|
|
12
|
-
import { IElevatedFileService } from 'vscode/vscode/vs/workbench/services/files/common/elevatedFileService';
|
|
13
|
-
import { IFilesConfigurationService } from 'vscode/vscode/vs/workbench/services/filesConfiguration/common/filesConfigurationService';
|
|
14
|
-
import { ILifecycleService } from 'vscode/vscode/vs/workbench/services/lifecycle/common/lifecycle';
|
|
15
|
-
import { IPathService } from 'vscode/vscode/vs/workbench/services/path/common/pathService';
|
|
16
|
-
import { IUntitledTextEditorService } from 'vscode/vscode/vs/workbench/services/untitled/common/untitledTextEditorService';
|
|
17
|
-
import { IUriIdentityService } from 'vscode/vscode/vs/platform/uriIdentity/common/uriIdentity';
|
|
18
|
-
import { IWorkingCopyFileService } from 'vscode/vscode/vs/workbench/services/workingCopy/common/workingCopyFileService';
|
|
19
|
-
import { IDecorationsService } from 'vscode/vscode/vs/workbench/services/decorations/common/decorations';
|
|
20
|
-
import { IDialogService, IFileDialogService } from 'vscode/vscode/vs/platform/dialogs/common/dialogs';
|
|
21
|
-
|
|
22
|
-
let BrowserTextFileService = class BrowserTextFileService extends AbstractTextFileService {
|
|
23
|
-
constructor(fileService, untitledTextEditorService, lifecycleService, instantiationService, modelService, environmentService, dialogService, fileDialogService, textResourceConfigurationService, filesConfigurationService, codeEditorService, pathService, workingCopyFileService, uriIdentityService, languageService, elevatedFileService, logService, decorationsService) {
|
|
24
|
-
super(fileService, untitledTextEditorService, lifecycleService, instantiationService, modelService, environmentService, dialogService, fileDialogService, textResourceConfigurationService, filesConfigurationService, codeEditorService, pathService, workingCopyFileService, uriIdentityService, languageService, logService, elevatedFileService, decorationsService);
|
|
25
|
-
this.registerListeners();
|
|
26
|
-
}
|
|
27
|
-
registerListeners() {
|
|
28
|
-
this._register(this.lifecycleService.onBeforeShutdown(event => event.veto(this.onBeforeShutdown(), 'veto.textFiles')));
|
|
29
|
-
}
|
|
30
|
-
onBeforeShutdown() {
|
|
31
|
-
if (( this.files.models.some(model => model.hasState(2 )))) {
|
|
32
|
-
return true;
|
|
33
|
-
}
|
|
34
|
-
return false;
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
BrowserTextFileService = ( __decorate([
|
|
38
|
-
( __param(0, IFileService)),
|
|
39
|
-
( __param(1, IUntitledTextEditorService)),
|
|
40
|
-
( __param(2, ILifecycleService)),
|
|
41
|
-
( __param(3, IInstantiationService)),
|
|
42
|
-
( __param(4, IModelService)),
|
|
43
|
-
( __param(5, IWorkbenchEnvironmentService)),
|
|
44
|
-
( __param(6, IDialogService)),
|
|
45
|
-
( __param(7, IFileDialogService)),
|
|
46
|
-
( __param(8, ITextResourceConfigurationService)),
|
|
47
|
-
( __param(9, IFilesConfigurationService)),
|
|
48
|
-
( __param(10, ICodeEditorService)),
|
|
49
|
-
( __param(11, IPathService)),
|
|
50
|
-
( __param(12, IWorkingCopyFileService)),
|
|
51
|
-
( __param(13, IUriIdentityService)),
|
|
52
|
-
( __param(14, ILanguageService)),
|
|
53
|
-
( __param(15, IElevatedFileService)),
|
|
54
|
-
( __param(16, ILogService)),
|
|
55
|
-
( __param(17, IDecorationsService))
|
|
56
|
-
], BrowserTextFileService));
|
|
57
|
-
|
|
58
|
-
export { BrowserTextFileService };
|