@codingame/monaco-vscode-extensions-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/extensions.js +6 -87
- package/override/vs/platform/dialogs/common/dialogs.js +2 -0
- package/package.json +9 -9
- package/_virtual/semver.js +0 -3
- package/external/vscode-semver/semver.js +0 -985
- package/override/vs/workbench/browser/parts/editor/textEditor.weak.js +0 -8
- package/vscode/src/vs/base/common/console.js +0 -59
- package/vscode/src/vs/platform/extensionManagement/common/extensionManagementCLI.js +0 -497
- package/vscode/src/vs/platform/extensionResourceLoader/browser/extensionResourceLoaderService.js +0 -44
- package/vscode/src/vs/platform/lifecycle/common/lifecycle.js +0 -27
- package/vscode/src/vs/platform/remote/common/managedSocket.js +0 -98
- package/vscode/src/vs/workbench/api/browser/mainThreadAiEmbeddingVector.js +0 -31
- package/vscode/src/vs/workbench/api/browser/mainThreadAiRelatedInformation.js +0 -35
- package/vscode/src/vs/workbench/api/browser/mainThreadAuthentication.js +0 -227
- package/vscode/src/vs/workbench/api/browser/mainThreadBulkEdits.js +0 -68
- package/vscode/src/vs/workbench/api/browser/mainThreadCLICommands.js +0 -103
- package/vscode/src/vs/workbench/api/browser/mainThreadChat.js +0 -83
- package/vscode/src/vs/workbench/api/browser/mainThreadChatAgents2.js +0 -203
- package/vscode/src/vs/workbench/api/browser/mainThreadChatProvider.js +0 -201
- package/vscode/src/vs/workbench/api/browser/mainThreadChatVariables.js +0 -41
- package/vscode/src/vs/workbench/api/browser/mainThreadClipboard.js +0 -24
- package/vscode/src/vs/workbench/api/browser/mainThreadCodeInsets.js +0 -107
- package/vscode/src/vs/workbench/api/browser/mainThreadCommands.js +0 -98
- package/vscode/src/vs/workbench/api/browser/mainThreadComments.js +0 -545
- package/vscode/src/vs/workbench/api/browser/mainThreadConfiguration.js +0 -80
- package/vscode/src/vs/workbench/api/browser/mainThreadConsole.js +0 -35
- package/vscode/src/vs/workbench/api/browser/mainThreadCustomEditors.js +0 -578
- package/vscode/src/vs/workbench/api/browser/mainThreadDebugService.js +0 -424
- package/vscode/src/vs/workbench/api/browser/mainThreadDecorations.js +0 -102
- package/vscode/src/vs/workbench/api/browser/mainThreadDiagnostics.js +0 -69
- package/vscode/src/vs/workbench/api/browser/mainThreadDialogs.js +0 -68
- package/vscode/src/vs/workbench/api/browser/mainThreadDocumentContentProviders.js +0 -79
- package/vscode/src/vs/workbench/api/browser/mainThreadDocuments.js +0 -253
- package/vscode/src/vs/workbench/api/browser/mainThreadDocumentsAndEditors.js +0 -370
- package/vscode/src/vs/workbench/api/browser/mainThreadDownloadService.js +0 -22
- package/vscode/src/vs/workbench/api/browser/mainThreadEditSessionIdentityParticipant.js +0 -41
- package/vscode/src/vs/workbench/api/browser/mainThreadEditor.js +0 -414
- package/vscode/src/vs/workbench/api/browser/mainThreadEditorTabs.js +0 -482
- package/vscode/src/vs/workbench/api/browser/mainThreadEditors.js +0 -227
- package/vscode/src/vs/workbench/api/browser/mainThreadErrors.js +0 -24
- package/vscode/src/vs/workbench/api/browser/mainThreadExtensionService.js +0 -317
- package/vscode/src/vs/workbench/api/browser/mainThreadFileSystem.js +0 -208
- package/vscode/src/vs/workbench/api/browser/mainThreadFileSystemEventService.js +0 -374
- package/vscode/src/vs/workbench/api/browser/mainThreadInlineChat.js +0 -72
- package/vscode/src/vs/workbench/api/browser/mainThreadInteractive.js +0 -28
- package/vscode/src/vs/workbench/api/browser/mainThreadIssueReporter.js +0 -50
- package/vscode/src/vs/workbench/api/browser/mainThreadLabelService.js +0 -27
- package/vscode/src/vs/workbench/api/browser/mainThreadLanguageFeatures.js +0 -991
- package/vscode/src/vs/workbench/api/browser/mainThreadLanguages.js +0 -78
- package/vscode/src/vs/workbench/api/browser/mainThreadLocalization.js +0 -35
- package/vscode/src/vs/workbench/api/browser/mainThreadLogService.js +0 -78
- package/vscode/src/vs/workbench/api/browser/mainThreadManagedSockets.js +0 -93
- package/vscode/src/vs/workbench/api/browser/mainThreadMessageService.js +0 -137
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebook.js +0 -194
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebookDocuments.js +0 -123
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebookDocumentsAndEditors.js +0 -188
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebookDto.js +0 -129
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebookEditors.js +0 -131
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebookKernels.js +0 -374
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebookRenderers.js +0 -25
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebookSaveParticipant.js +0 -48
- package/vscode/src/vs/workbench/api/browser/mainThreadOutputService.js +0 -76
- package/vscode/src/vs/workbench/api/browser/mainThreadProfilContentHandlers.js +0 -38
- package/vscode/src/vs/workbench/api/browser/mainThreadProgress.js +0 -68
- package/vscode/src/vs/workbench/api/browser/mainThreadQuickDiff.js +0 -42
- package/vscode/src/vs/workbench/api/browser/mainThreadQuickOpen.js +0 -185
- package/vscode/src/vs/workbench/api/browser/mainThreadRemoteConnectionData.js +0 -30
- package/vscode/src/vs/workbench/api/browser/mainThreadSCM.js +0 -493
- package/vscode/src/vs/workbench/api/browser/mainThreadSaveParticipant.js +0 -49
- package/vscode/src/vs/workbench/api/browser/mainThreadSearch.js +0 -146
- package/vscode/src/vs/workbench/api/browser/mainThreadSecretState.js +0 -70
- package/vscode/src/vs/workbench/api/browser/mainThreadShare.js +0 -50
- package/vscode/src/vs/workbench/api/browser/mainThreadSpeech.js +0 -99
- package/vscode/src/vs/workbench/api/browser/mainThreadStatusBar.js +0 -53
- package/vscode/src/vs/workbench/api/browser/mainThreadStorage.js +0 -72
- package/vscode/src/vs/workbench/api/browser/mainThreadTask.js +0 -731
- package/vscode/src/vs/workbench/api/browser/mainThreadTelemetry.js +0 -53
- package/vscode/src/vs/workbench/api/browser/mainThreadTerminalService.js +0 -408
- package/vscode/src/vs/workbench/api/browser/mainThreadTesting.js +0 -195
- package/vscode/src/vs/workbench/api/browser/mainThreadTheming.js +0 -24
- package/vscode/src/vs/workbench/api/browser/mainThreadTimeline.js +0 -55
- package/vscode/src/vs/workbench/api/browser/mainThreadTreeViews.js +0 -312
- package/vscode/src/vs/workbench/api/browser/mainThreadTunnelService.js +0 -223
- package/vscode/src/vs/workbench/api/browser/mainThreadUriOpeners.js +0 -110
- package/vscode/src/vs/workbench/api/browser/mainThreadUrls.js +0 -61
- package/vscode/src/vs/workbench/api/browser/mainThreadWebviewManager.js +0 -29
- package/vscode/src/vs/workbench/api/browser/mainThreadWebviewPanels.js +0 -283
- package/vscode/src/vs/workbench/api/browser/mainThreadWebviewViews.js +0 -100
- package/vscode/src/vs/workbench/api/browser/mainThreadWebviews.js +0 -135
- package/vscode/src/vs/workbench/api/browser/mainThreadWindow.js +0 -57
- package/vscode/src/vs/workbench/api/browser/mainThreadWorkspace.js +0 -268
- package/vscode/src/vs/workbench/api/common/shared/dataTransferCache.js +0 -35
- package/vscode/src/vs/workbench/contrib/customEditor/common/customTextEditorModel.js +0 -73
- package/vscode/src/vs/workbench/contrib/externalUriOpener/common/contributedOpeners.js +0 -83
- package/vscode/src/vs/workbench/services/extensions/browser/extensionService.js +0 -284
- package/vscode/src/vs/workbench/services/extensions/browser/webWorkerExtensionHost.js +0 -276
- package/vscode/src/vs/workbench/services/extensions/browser/webWorkerFileSystemProvider.js +0 -52
- package/vscode/src/vs/workbench/services/extensions/common/abstractExtensionService.js +0 -1138
- package/vscode/src/vs/workbench/services/extensions/common/extHostCustomers.js +0 -41
- package/vscode/src/vs/workbench/services/extensions/common/extensionDevOptions.js +0 -25
- package/vscode/src/vs/workbench/services/extensions/common/extensionHostManager.js +0 -512
- package/vscode/src/vs/workbench/services/extensions/common/extensionRunningLocationTracker.js +0 -274
- package/vscode/src/vs/workbench/services/extensions/common/extensionStorageMigration.js +0 -58
- package/vscode/src/vs/workbench/services/extensions/common/extensionsProposedApi.js +0 -80
- package/vscode/src/vs/workbench/services/extensions/common/extensionsUtil.js +0 -64
- package/vscode/src/vs/workbench/services/extensions/common/lazyCreateExtensionHostManager.js +0 -161
- package/vscode/src/vs/workbench/services/extensions/common/remoteConsoleUtil.js +0 -49
- package/vscode/src/vs/workbench/services/extensions/common/remoteExtensionHost.js +0 -222
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { __decorate, __param } from '../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
-
import { onUnexpectedError } from 'vscode/vscode/vs/base/common/errors';
|
|
3
|
-
import { DisposableMap, dispose } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
4
|
-
import { URI } from 'vscode/vscode/vs/base/common/uri';
|
|
5
|
-
import { EditOperation } from 'vscode/vscode/vs/editor/common/core/editOperation';
|
|
6
|
-
import { Range } from 'vscode/vscode/vs/editor/common/core/range';
|
|
7
|
-
import { IEditorWorkerService } from 'vscode/vscode/vs/editor/common/services/editorWorker';
|
|
8
|
-
import { IModelService } from 'vscode/vscode/vs/editor/common/services/model';
|
|
9
|
-
import { ILanguageService } from 'vscode/vscode/vs/editor/common/languages/language';
|
|
10
|
-
import { ITextModelService } from 'vscode/vscode/vs/editor/common/services/resolverService';
|
|
11
|
-
import { extHostNamedCustomer } from '../../services/extensions/common/extHostCustomers.js';
|
|
12
|
-
import { MainContext, ExtHostContext } from 'vscode/vscode/vs/workbench/api/common/extHost.protocol';
|
|
13
|
-
import { CancellationTokenSource } from 'vscode/vscode/vs/base/common/cancellation';
|
|
14
|
-
|
|
15
|
-
let MainThreadDocumentContentProviders = class MainThreadDocumentContentProviders {
|
|
16
|
-
constructor(extHostContext, _textModelResolverService, _languageService, _modelService, _editorWorkerService) {
|
|
17
|
-
this._textModelResolverService = _textModelResolverService;
|
|
18
|
-
this._languageService = _languageService;
|
|
19
|
-
this._modelService = _modelService;
|
|
20
|
-
this._editorWorkerService = _editorWorkerService;
|
|
21
|
-
this._resourceContentProvider = ( new DisposableMap());
|
|
22
|
-
this._pendingUpdate = ( new Map());
|
|
23
|
-
this._proxy = ( extHostContext.getProxy(ExtHostContext.ExtHostDocumentContentProviders));
|
|
24
|
-
}
|
|
25
|
-
dispose() {
|
|
26
|
-
this._resourceContentProvider.dispose();
|
|
27
|
-
dispose(( this._pendingUpdate.values()));
|
|
28
|
-
}
|
|
29
|
-
$registerTextContentProvider(handle, scheme) {
|
|
30
|
-
const registration = this._textModelResolverService.registerTextModelContentProvider(scheme, {
|
|
31
|
-
provideTextContent: (uri) => {
|
|
32
|
-
return this._proxy.$provideTextDocumentContent(handle, uri).then(value => {
|
|
33
|
-
if (typeof value === 'string') {
|
|
34
|
-
const firstLineText = value.substr(0, 1 + value.search(/\r?\n/));
|
|
35
|
-
const languageSelection = this._languageService.createByFilepathOrFirstLine(uri, firstLineText);
|
|
36
|
-
return this._modelService.createModel(value, languageSelection, uri);
|
|
37
|
-
}
|
|
38
|
-
return null;
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
this._resourceContentProvider.set(handle, registration);
|
|
43
|
-
}
|
|
44
|
-
$unregisterTextContentProvider(handle) {
|
|
45
|
-
this._resourceContentProvider.deleteAndDispose(handle);
|
|
46
|
-
}
|
|
47
|
-
async $onVirtualDocumentChange(uri, value) {
|
|
48
|
-
const model = this._modelService.getModel(URI.revive(uri));
|
|
49
|
-
if (!model) {
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
const pending = this._pendingUpdate.get(model.id);
|
|
53
|
-
pending?.cancel();
|
|
54
|
-
const myToken = ( new CancellationTokenSource());
|
|
55
|
-
this._pendingUpdate.set(model.id, myToken);
|
|
56
|
-
try {
|
|
57
|
-
const edits = await this._editorWorkerService.computeMoreMinimalEdits(model.uri, [{ text: value, range: model.getFullModelRange() }]);
|
|
58
|
-
this._pendingUpdate.delete(model.id);
|
|
59
|
-
if (myToken.token.isCancellationRequested) {
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
if (edits && edits.length > 0) {
|
|
63
|
-
model.applyEdits(( edits.map(edit => EditOperation.replace(Range.lift(edit.range), edit.text))));
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
catch (error) {
|
|
67
|
-
onUnexpectedError(error);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
MainThreadDocumentContentProviders = __decorate([
|
|
72
|
-
extHostNamedCustomer(MainContext.MainThreadDocumentContentProviders),
|
|
73
|
-
( __param(1, ITextModelService)),
|
|
74
|
-
( __param(2, ILanguageService)),
|
|
75
|
-
( __param(3, IModelService)),
|
|
76
|
-
( __param(4, IEditorWorkerService))
|
|
77
|
-
], MainThreadDocumentContentProviders);
|
|
78
|
-
|
|
79
|
-
export { MainThreadDocumentContentProviders };
|
|
@@ -1,253 +0,0 @@
|
|
|
1
|
-
import { __decorate, __param } from '../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
-
import { toErrorMessage } from 'vscode/vscode/vs/base/common/errorMessage';
|
|
3
|
-
import { Disposable, dispose } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
4
|
-
import { Schemas } from 'vscode/vscode/vs/base/common/network';
|
|
5
|
-
import { URI } from 'vscode/vscode/vs/base/common/uri';
|
|
6
|
-
import { shouldSynchronizeModel } from 'vscode/vscode/vs/editor/common/model';
|
|
7
|
-
import { IModelService } from 'vscode/vscode/vs/editor/common/services/model';
|
|
8
|
-
import { ITextModelService } from 'vscode/vscode/vs/editor/common/services/resolverService';
|
|
9
|
-
import { IFileService } from 'vscode/vscode/vs/platform/files/common/files';
|
|
10
|
-
import { ExtHostContext } from 'vscode/vscode/vs/workbench/api/common/extHost.protocol';
|
|
11
|
-
import { ITextFileService } from 'vscode/vscode/vs/workbench/services/textfile/common/textfiles';
|
|
12
|
-
import { IWorkbenchEnvironmentService } from 'vscode/vscode/vs/workbench/services/environment/common/environmentService';
|
|
13
|
-
import { extUri, toLocalResource } from 'vscode/vscode/vs/base/common/resources';
|
|
14
|
-
import { IWorkingCopyFileService } from 'vscode/vscode/vs/workbench/services/workingCopy/common/workingCopyFileService';
|
|
15
|
-
import { IUriIdentityService } from 'vscode/vscode/vs/platform/uriIdentity/common/uriIdentity';
|
|
16
|
-
import { Emitter, Event } from 'vscode/vscode/vs/base/common/event';
|
|
17
|
-
import { IPathService } from 'vscode/vscode/vs/workbench/services/path/common/pathService';
|
|
18
|
-
import { ResourceMap } from 'vscode/vscode/vs/base/common/map';
|
|
19
|
-
import { ErrorNoTelemetry } from 'vscode/vscode/vs/base/common/errors';
|
|
20
|
-
|
|
21
|
-
class BoundModelReferenceCollection {
|
|
22
|
-
constructor(_extUri, _maxAge = 1000 * 60 * 3,
|
|
23
|
-
_maxLength = 1024 * 1024 * 80,
|
|
24
|
-
_maxSize = 50
|
|
25
|
-
) {
|
|
26
|
-
this._extUri = _extUri;
|
|
27
|
-
this._maxAge = _maxAge;
|
|
28
|
-
this._maxLength = _maxLength;
|
|
29
|
-
this._maxSize = _maxSize;
|
|
30
|
-
this._data = ( new Array());
|
|
31
|
-
this._length = 0;
|
|
32
|
-
}
|
|
33
|
-
dispose() {
|
|
34
|
-
this._data = dispose(this._data);
|
|
35
|
-
}
|
|
36
|
-
remove(uri) {
|
|
37
|
-
for (const entry of [...this._data] ) {
|
|
38
|
-
if (this._extUri.isEqualOrParent(entry.uri, uri)) {
|
|
39
|
-
entry.dispose();
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
add(uri, ref, length = 0) {
|
|
44
|
-
const dispose = () => {
|
|
45
|
-
const idx = this._data.indexOf(entry);
|
|
46
|
-
if (idx >= 0) {
|
|
47
|
-
this._length -= length;
|
|
48
|
-
ref.dispose();
|
|
49
|
-
clearTimeout(handle);
|
|
50
|
-
this._data.splice(idx, 1);
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
const handle = setTimeout(dispose, this._maxAge);
|
|
54
|
-
const entry = { uri, length, dispose };
|
|
55
|
-
this._data.push(entry);
|
|
56
|
-
this._length += length;
|
|
57
|
-
this._cleanup();
|
|
58
|
-
}
|
|
59
|
-
_cleanup() {
|
|
60
|
-
while (this._length > this._maxLength) {
|
|
61
|
-
this._data[0].dispose();
|
|
62
|
-
}
|
|
63
|
-
const extraSize = Math.ceil(this._maxSize * 1.2);
|
|
64
|
-
if (this._data.length >= extraSize) {
|
|
65
|
-
dispose(this._data.slice(0, extraSize - this._maxSize));
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
class ModelTracker extends Disposable {
|
|
70
|
-
constructor(_model, _onIsCaughtUpWithContentChanges, _proxy, _textFileService) {
|
|
71
|
-
super();
|
|
72
|
-
this._model = _model;
|
|
73
|
-
this._onIsCaughtUpWithContentChanges = _onIsCaughtUpWithContentChanges;
|
|
74
|
-
this._proxy = _proxy;
|
|
75
|
-
this._textFileService = _textFileService;
|
|
76
|
-
this._knownVersionId = this._model.getVersionId();
|
|
77
|
-
this._store.add(this._model.onDidChangeContent((e) => {
|
|
78
|
-
this._knownVersionId = e.versionId;
|
|
79
|
-
this._proxy.$acceptModelChanged(this._model.uri, e, this._textFileService.isDirty(this._model.uri));
|
|
80
|
-
if (this.isCaughtUpWithContentChanges()) {
|
|
81
|
-
this._onIsCaughtUpWithContentChanges.fire(this._model.uri);
|
|
82
|
-
}
|
|
83
|
-
}));
|
|
84
|
-
}
|
|
85
|
-
isCaughtUpWithContentChanges() {
|
|
86
|
-
return (this._model.getVersionId() === this._knownVersionId);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
let MainThreadDocuments = class MainThreadDocuments extends Disposable {
|
|
90
|
-
constructor(extHostContext, _modelService, _textFileService, _fileService, _textModelResolverService, _environmentService, _uriIdentityService, workingCopyFileService, _pathService) {
|
|
91
|
-
super();
|
|
92
|
-
this._modelService = _modelService;
|
|
93
|
-
this._textFileService = _textFileService;
|
|
94
|
-
this._fileService = _fileService;
|
|
95
|
-
this._textModelResolverService = _textModelResolverService;
|
|
96
|
-
this._environmentService = _environmentService;
|
|
97
|
-
this._uriIdentityService = _uriIdentityService;
|
|
98
|
-
this._pathService = _pathService;
|
|
99
|
-
this._onIsCaughtUpWithContentChanges = this._store.add(( new Emitter()));
|
|
100
|
-
this.onIsCaughtUpWithContentChanges = this._onIsCaughtUpWithContentChanges.event;
|
|
101
|
-
this._modelTrackers = ( new ResourceMap());
|
|
102
|
-
this._modelReferenceCollection = this._store.add(( new BoundModelReferenceCollection(_uriIdentityService.extUri)));
|
|
103
|
-
this._proxy = ( extHostContext.getProxy(ExtHostContext.ExtHostDocuments));
|
|
104
|
-
this._store.add(_modelService.onModelLanguageChanged(this._onModelModeChanged, this));
|
|
105
|
-
this._store.add(_textFileService.files.onDidSave(e => {
|
|
106
|
-
if (this._shouldHandleFileEvent(e.model.resource)) {
|
|
107
|
-
this._proxy.$acceptModelSaved(e.model.resource);
|
|
108
|
-
}
|
|
109
|
-
}));
|
|
110
|
-
this._store.add(_textFileService.files.onDidChangeDirty(m => {
|
|
111
|
-
if (this._shouldHandleFileEvent(m.resource)) {
|
|
112
|
-
this._proxy.$acceptDirtyStateChanged(m.resource, m.isDirty());
|
|
113
|
-
}
|
|
114
|
-
}));
|
|
115
|
-
this._store.add(workingCopyFileService.onDidRunWorkingCopyFileOperation(e => {
|
|
116
|
-
const isMove = e.operation === 2 ;
|
|
117
|
-
if (isMove || e.operation === 1 ) {
|
|
118
|
-
for (const pair of e.files) {
|
|
119
|
-
const removed = isMove ? pair.source : pair.target;
|
|
120
|
-
if (removed) {
|
|
121
|
-
this._modelReferenceCollection.remove(removed);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
}));
|
|
126
|
-
}
|
|
127
|
-
dispose() {
|
|
128
|
-
dispose(( this._modelTrackers.values()));
|
|
129
|
-
this._modelTrackers.clear();
|
|
130
|
-
super.dispose();
|
|
131
|
-
}
|
|
132
|
-
isCaughtUpWithContentChanges(resource) {
|
|
133
|
-
const tracker = this._modelTrackers.get(resource);
|
|
134
|
-
if (tracker) {
|
|
135
|
-
return tracker.isCaughtUpWithContentChanges();
|
|
136
|
-
}
|
|
137
|
-
return true;
|
|
138
|
-
}
|
|
139
|
-
_shouldHandleFileEvent(resource) {
|
|
140
|
-
const model = this._modelService.getModel(resource);
|
|
141
|
-
return !!model && shouldSynchronizeModel(model);
|
|
142
|
-
}
|
|
143
|
-
handleModelAdded(model) {
|
|
144
|
-
if (!shouldSynchronizeModel(model)) {
|
|
145
|
-
return;
|
|
146
|
-
}
|
|
147
|
-
this._modelTrackers.set(model.uri, ( new ModelTracker(
|
|
148
|
-
model,
|
|
149
|
-
this._onIsCaughtUpWithContentChanges,
|
|
150
|
-
this._proxy,
|
|
151
|
-
this._textFileService
|
|
152
|
-
)));
|
|
153
|
-
}
|
|
154
|
-
_onModelModeChanged(event) {
|
|
155
|
-
const { model } = event;
|
|
156
|
-
if (!( this._modelTrackers.has(model.uri))) {
|
|
157
|
-
return;
|
|
158
|
-
}
|
|
159
|
-
this._proxy.$acceptModelLanguageChanged(model.uri, model.getLanguageId());
|
|
160
|
-
}
|
|
161
|
-
handleModelRemoved(modelUrl) {
|
|
162
|
-
if (!( this._modelTrackers.has(modelUrl))) {
|
|
163
|
-
return;
|
|
164
|
-
}
|
|
165
|
-
this._modelTrackers.get(modelUrl).dispose();
|
|
166
|
-
this._modelTrackers.delete(modelUrl);
|
|
167
|
-
}
|
|
168
|
-
async $trySaveDocument(uri) {
|
|
169
|
-
const target = await this._textFileService.save(URI.revive(uri));
|
|
170
|
-
return Boolean(target);
|
|
171
|
-
}
|
|
172
|
-
async $tryOpenDocument(uriData) {
|
|
173
|
-
const inputUri = URI.revive(uriData);
|
|
174
|
-
if (!inputUri.scheme || !(inputUri.fsPath || inputUri.authority)) {
|
|
175
|
-
throw new ErrorNoTelemetry(`Invalid uri. Scheme and authority or path must be set.`);
|
|
176
|
-
}
|
|
177
|
-
const canonicalUri = this._uriIdentityService.asCanonicalUri(inputUri);
|
|
178
|
-
let promise;
|
|
179
|
-
switch (canonicalUri.scheme) {
|
|
180
|
-
case Schemas.untitled:
|
|
181
|
-
promise = this._handleUntitledScheme(canonicalUri);
|
|
182
|
-
break;
|
|
183
|
-
case Schemas.file:
|
|
184
|
-
default:
|
|
185
|
-
promise = this._handleAsResourceInput(canonicalUri);
|
|
186
|
-
break;
|
|
187
|
-
}
|
|
188
|
-
let documentUri;
|
|
189
|
-
try {
|
|
190
|
-
documentUri = await promise;
|
|
191
|
-
}
|
|
192
|
-
catch (err) {
|
|
193
|
-
throw new ErrorNoTelemetry(`cannot open ${canonicalUri.toString()}. Detail: ${toErrorMessage(err)}`);
|
|
194
|
-
}
|
|
195
|
-
if (!documentUri) {
|
|
196
|
-
throw new ErrorNoTelemetry(`cannot open ${canonicalUri.toString()}`);
|
|
197
|
-
}
|
|
198
|
-
else if (!extUri.isEqual(documentUri, canonicalUri)) {
|
|
199
|
-
throw new ErrorNoTelemetry(`cannot open ${canonicalUri.toString()}. Detail: Actual document opened as ${documentUri.toString()}`);
|
|
200
|
-
}
|
|
201
|
-
else if (!( this._modelTrackers.has(canonicalUri))) {
|
|
202
|
-
throw new ErrorNoTelemetry(`cannot open ${canonicalUri.toString()}. Detail: Files above 50MB cannot be synchronized with extensions.`);
|
|
203
|
-
}
|
|
204
|
-
else {
|
|
205
|
-
return canonicalUri;
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
$tryCreateDocument(options) {
|
|
209
|
-
return this._doCreateUntitled(undefined, options ? options.language : undefined, options ? options.content : undefined);
|
|
210
|
-
}
|
|
211
|
-
async _handleAsResourceInput(uri) {
|
|
212
|
-
const ref = await this._textModelResolverService.createModelReference(uri);
|
|
213
|
-
this._modelReferenceCollection.add(uri, ref, ref.object.textEditorModel.getValueLength());
|
|
214
|
-
return ref.object.textEditorModel.uri;
|
|
215
|
-
}
|
|
216
|
-
async _handleUntitledScheme(uri) {
|
|
217
|
-
const asLocalUri = toLocalResource(uri, this._environmentService.remoteAuthority, this._pathService.defaultUriScheme);
|
|
218
|
-
const exists = await this._fileService.exists(asLocalUri);
|
|
219
|
-
if (exists) {
|
|
220
|
-
return Promise.reject(( new Error('file already exists')));
|
|
221
|
-
}
|
|
222
|
-
return await this._doCreateUntitled(Boolean(uri.path) ? uri : undefined);
|
|
223
|
-
}
|
|
224
|
-
async _doCreateUntitled(associatedResource, languageId, initialValue) {
|
|
225
|
-
const model = this._textFileService.untitled.create({
|
|
226
|
-
associatedResource,
|
|
227
|
-
languageId,
|
|
228
|
-
initialValue
|
|
229
|
-
});
|
|
230
|
-
const resource = model.resource;
|
|
231
|
-
const ref = await this._textModelResolverService.createModelReference(resource);
|
|
232
|
-
if (!( this._modelTrackers.has(resource))) {
|
|
233
|
-
ref.dispose();
|
|
234
|
-
throw new Error(`expected URI ${resource.toString()} to have come to LIFE`);
|
|
235
|
-
}
|
|
236
|
-
this._modelReferenceCollection.add(resource, ref, ref.object.textEditorModel.getValueLength());
|
|
237
|
-
Event.once(model.onDidRevert)(() => this._modelReferenceCollection.remove(resource));
|
|
238
|
-
this._proxy.$acceptDirtyStateChanged(resource, true);
|
|
239
|
-
return resource;
|
|
240
|
-
}
|
|
241
|
-
};
|
|
242
|
-
MainThreadDocuments = ( __decorate([
|
|
243
|
-
( __param(1, IModelService)),
|
|
244
|
-
( __param(2, ITextFileService)),
|
|
245
|
-
( __param(3, IFileService)),
|
|
246
|
-
( __param(4, ITextModelService)),
|
|
247
|
-
( __param(5, IWorkbenchEnvironmentService)),
|
|
248
|
-
( __param(6, IUriIdentityService)),
|
|
249
|
-
( __param(7, IWorkingCopyFileService)),
|
|
250
|
-
( __param(8, IPathService))
|
|
251
|
-
], MainThreadDocuments));
|
|
252
|
-
|
|
253
|
-
export { BoundModelReferenceCollection, MainThreadDocuments };
|