@vscode/chat-lib 0.0.1 → 0.0.2
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/dist/src/_internal/extension/xtab/common/promptCrafting.d.ts.map +1 -1
- package/dist/src/_internal/extension/xtab/common/promptCrafting.js +6 -5
- package/dist/src/_internal/extension/xtab/common/promptCrafting.js.map +1 -1
- package/dist/src/_internal/platform/configuration/common/configurationService.d.ts +1 -0
- package/dist/src/_internal/platform/configuration/common/configurationService.d.ts.map +1 -1
- package/dist/src/_internal/platform/configuration/common/configurationService.js +1 -0
- package/dist/src/_internal/platform/configuration/common/configurationService.js.map +1 -1
- package/dist/src/_internal/platform/env/common/envService.d.ts +5 -0
- package/dist/src/_internal/platform/env/common/envService.d.ts.map +1 -1
- package/dist/src/_internal/platform/env/common/envService.js +2 -1
- package/dist/src/_internal/platform/env/common/envService.js.map +1 -1
- package/dist/src/_internal/platform/env/common/nullEnvService.d.ts +3 -0
- package/dist/src/_internal/platform/env/common/nullEnvService.d.ts.map +1 -1
- package/dist/src/_internal/platform/env/common/nullEnvService.js +8 -1
- package/dist/src/_internal/platform/env/common/nullEnvService.js.map +1 -1
- package/dist/src/_internal/platform/telemetry/common/nullExperimentationService.d.ts +7 -0
- package/dist/src/_internal/platform/telemetry/common/nullExperimentationService.d.ts.map +1 -1
- package/dist/src/_internal/platform/telemetry/common/nullExperimentationService.js +1 -0
- package/dist/src/_internal/platform/telemetry/common/nullExperimentationService.js.map +1 -1
- package/dist/src/_internal/util/common/test/shims/chatTypes.d.ts +8 -0
- package/dist/src/_internal/util/common/test/shims/chatTypes.d.ts.map +1 -1
- package/dist/src/_internal/util/common/test/shims/chatTypes.js +19 -1
- package/dist/src/_internal/util/common/test/shims/chatTypes.js.map +1 -1
- package/dist/src/_internal/util/common/test/shims/vscodeTypesShim.d.ts.map +1 -1
- package/dist/src/_internal/util/common/test/shims/vscodeTypesShim.js +8 -1
- package/dist/src/_internal/util/common/test/shims/vscodeTypesShim.js.map +1 -1
- package/dist/src/_internal/vscodeTypes.d.ts +4 -0
- package/dist/src/_internal/vscodeTypes.d.ts.map +1 -1
- package/dist/src/_internal/vscodeTypes.js +5 -1
- package/dist/src/_internal/vscodeTypes.js.map +1 -1
- package/dist/src/main.d.ts +5 -0
- package/dist/src/main.d.ts.map +1 -1
- package/dist/src/main.js +12 -0
- package/dist/src/main.js.map +1 -1
- package/dist/src/package.json +46 -19
- package/package.json +3 -6
- package/src/_internal/extension/byok/node/openAIEndpoint.ts +0 -171
- package/src/_internal/extension/common/constants.ts +0 -90
- package/src/_internal/extension/inlineEdits/common/delayer.ts +0 -108
- package/src/_internal/extension/inlineEdits/common/editRebase.ts +0 -268
- package/src/_internal/extension/inlineEdits/common/ghNearbyNesProvider.tsx +0 -163
- package/src/_internal/extension/inlineEdits/common/nearbyCursorInlineEditProvider.ts +0 -225
- package/src/_internal/extension/inlineEdits/common/rejectionCollector.ts +0 -164
- package/src/_internal/extension/inlineEdits/node/debugRecorder.ts +0 -205
- package/src/_internal/extension/inlineEdits/node/importFiltering.ts +0 -25
- package/src/_internal/extension/inlineEdits/node/nesConfigs.ts +0 -12
- package/src/_internal/extension/inlineEdits/node/nextEditCache.ts +0 -278
- package/src/_internal/extension/inlineEdits/node/nextEditProvider.ts +0 -778
- package/src/_internal/extension/inlineEdits/node/nextEditProviderTelemetry.ts +0 -983
- package/src/_internal/extension/inlineEdits/node/nextEditResult.ts +0 -40
- package/src/_internal/extension/prompt/common/importStatement.ts +0 -25
- package/src/_internal/extension/prompt/node/chatMLFetcher.ts +0 -706
- package/src/_internal/extension/prompts/node/inline/summarizedDocument/fragments.ts +0 -146
- package/src/_internal/extension/prompts/node/inline/summarizedDocument/implementation.ts +0 -527
- package/src/_internal/extension/prompts/node/inline/summarizedDocument/projectedText.ts +0 -76
- package/src/_internal/extension/prompts/node/inline/visualization.ts +0 -65
- package/src/_internal/extension/vscode.proposed.activeComment.d.ts +0 -23
- package/src/_internal/extension/vscode.proposed.aiRelatedInformation.d.ts +0 -49
- package/src/_internal/extension/vscode.proposed.aiSettingsSearch.d.ts +0 -31
- package/src/_internal/extension/vscode.proposed.aiTextSearchProvider.d.ts +0 -41
- package/src/_internal/extension/vscode.proposed.authLearnMore.d.ts +0 -16
- package/src/_internal/extension/vscode.proposed.chatBinaryReferenceData.d.ts +0 -41
- package/src/_internal/extension/vscode.proposed.chatEditing.d.ts +0 -29
- package/src/_internal/extension/vscode.proposed.chatParticipantAdditions.d.ts +0 -636
- package/src/_internal/extension/vscode.proposed.chatParticipantPrivate.d.ts +0 -276
- package/src/_internal/extension/vscode.proposed.chatProvider.d.ts +0 -62
- package/src/_internal/extension/vscode.proposed.chatReadonlyPromptReference.d.ts +0 -17
- package/src/_internal/extension/vscode.proposed.chatReferenceDiagnostic.d.ts +0 -23
- package/src/_internal/extension/vscode.proposed.chatSessionsProvider.d.ts +0 -218
- package/src/_internal/extension/vscode.proposed.chatStatusItem.d.ts +0 -61
- package/src/_internal/extension/vscode.proposed.codeActionAI.d.ts +0 -16
- package/src/_internal/extension/vscode.proposed.commentReveal.d.ts +0 -32
- package/src/_internal/extension/vscode.proposed.contribCommentThreadAdditionalMenu.d.ts +0 -8
- package/src/_internal/extension/vscode.proposed.contribCommentsViewThreadMenus.d.ts +0 -6
- package/src/_internal/extension/vscode.proposed.contribSourceControlInputBoxMenu.d.ts +0 -7
- package/src/_internal/extension/vscode.proposed.dataChannels.d.ts +0 -19
- package/src/_internal/extension/vscode.proposed.defaultChatParticipant.d.ts +0 -52
- package/src/_internal/extension/vscode.proposed.documentFiltersExclusive.d.ts +0 -13
- package/src/_internal/extension/vscode.proposed.embeddings.d.ts +0 -33
- package/src/_internal/extension/vscode.proposed.extensionsAny.d.ts +0 -40
- package/src/_internal/extension/vscode.proposed.findFiles2.d.ts +0 -125
- package/src/_internal/extension/vscode.proposed.findTextInFiles.d.ts +0 -104
- package/src/_internal/extension/vscode.proposed.findTextInFiles2.d.ts +0 -144
- package/src/_internal/extension/vscode.proposed.inlineCompletionsAdditions.d.ts +0 -202
- package/src/_internal/extension/vscode.proposed.interactive.d.ts +0 -11
- package/src/_internal/extension/vscode.proposed.languageModelCapabilities.d.ts +0 -25
- package/src/_internal/extension/vscode.proposed.languageModelDataPart.d.ts +0 -163
- package/src/_internal/extension/vscode.proposed.languageModelSystem.d.ts +0 -17
- package/src/_internal/extension/vscode.proposed.languageModelThinkingPart.d.ts +0 -49
- package/src/_internal/extension/vscode.proposed.languageModelToolResultAudience.d.ts +0 -36
- package/src/_internal/extension/vscode.proposed.mappedEditsProvider.d.ts +0 -110
- package/src/_internal/extension/vscode.proposed.newSymbolNamesProvider.d.ts +0 -47
- package/src/_internal/extension/vscode.proposed.readonlyMessage.d.ts +0 -14
- package/src/_internal/extension/vscode.proposed.resolvers.d.ts +0 -475
- package/src/_internal/extension/vscode.proposed.scmInputBoxValueProvider.d.ts +0 -25
- package/src/_internal/extension/vscode.proposed.taskProblemMatcherStatus.d.ts +0 -42
- package/src/_internal/extension/vscode.proposed.terminalDataWriteEvent.d.ts +0 -32
- package/src/_internal/extension/vscode.proposed.terminalExecuteCommandEvent.d.ts +0 -48
- package/src/_internal/extension/vscode.proposed.terminalQuickFixProvider.d.ts +0 -87
- package/src/_internal/extension/vscode.proposed.terminalSelection.d.ts +0 -16
- package/src/_internal/extension/vscode.proposed.testObserver.d.ts +0 -199
- package/src/_internal/extension/vscode.proposed.textDocumentChangeReason.d.ts +0 -30
- package/src/_internal/extension/vscode.proposed.textSearchProvider.d.ts +0 -281
- package/src/_internal/extension/vscode.proposed.textSearchProvider2.d.ts +0 -297
- package/src/_internal/extension/xtab/common/promptCrafting.ts +0 -670
- package/src/_internal/extension/xtab/node/xtabEndpoint.ts +0 -102
- package/src/_internal/extension/xtab/node/xtabProvider.ts +0 -976
- package/src/_internal/extension/xtab/node/xtabUtils.ts +0 -62
- package/src/_internal/platform/authentication/common/authentication.ts +0 -309
- package/src/_internal/platform/authentication/common/copilotToken.ts +0 -300
- package/src/_internal/platform/authentication/common/copilotTokenManager.ts +0 -59
- package/src/_internal/platform/authentication/common/copilotTokenStore.ts +0 -40
- package/src/_internal/platform/authentication/common/staticGitHubAuthenticationService.ts +0 -96
- package/src/_internal/platform/authentication/node/copilotTokenManager.ts +0 -303
- package/src/_internal/platform/chat/common/chatMLFetcher.ts +0 -124
- package/src/_internal/platform/chat/common/chatQuotaService.ts +0 -63
- package/src/_internal/platform/chat/common/chatQuotaServiceImpl.ts +0 -96
- package/src/_internal/platform/chat/common/commonTypes.ts +0 -353
- package/src/_internal/platform/chat/common/conversationOptions.ts +0 -16
- package/src/_internal/platform/chat/common/globalStringUtils.ts +0 -54
- package/src/_internal/platform/chat/common/interactionService.ts +0 -35
- package/src/_internal/platform/configuration/common/configurationService.ts +0 -803
- package/src/_internal/platform/configuration/common/defaultsOnlyConfigurationService.ts +0 -39
- package/src/_internal/platform/configuration/common/jsonSchema.ts +0 -139
- package/src/_internal/platform/configuration/common/validator.ts +0 -242
- package/src/_internal/platform/diff/common/diffService.ts +0 -41
- package/src/_internal/platform/diff/common/diffWorker.ts +0 -83
- package/src/_internal/platform/diff/node/diffServiceImpl.ts +0 -85
- package/src/_internal/platform/editing/common/abstractText.ts +0 -177
- package/src/_internal/platform/editing/common/notebookDocumentSnapshot.ts +0 -122
- package/src/_internal/platform/editing/common/positionOffsetTransformer.ts +0 -202
- package/src/_internal/platform/editing/common/textDocumentSnapshot.ts +0 -274
- package/src/_internal/platform/endpoint/common/capiClient.ts +0 -37
- package/src/_internal/platform/endpoint/common/chatModelCapabilities.ts +0 -115
- package/src/_internal/platform/endpoint/common/domainService.ts +0 -27
- package/src/_internal/platform/endpoint/common/endpointProvider.ts +0 -104
- package/src/_internal/platform/endpoint/common/endpointTypes.ts +0 -12
- package/src/_internal/platform/endpoint/common/licenseAgreement.ts +0 -11
- package/src/_internal/platform/endpoint/common/statefulMarkerContainer.tsx +0 -85
- package/src/_internal/platform/endpoint/common/thinkingDataContainer.tsx +0 -44
- package/src/_internal/platform/endpoint/node/capiClientImpl.ts +0 -18
- package/src/_internal/platform/endpoint/node/chatEndpoint.ts +0 -435
- package/src/_internal/platform/endpoint/node/domainServiceImpl.ts +0 -80
- package/src/_internal/platform/endpoint/node/proxyXtabEndpoint.ts +0 -43
- package/src/_internal/platform/endpoint/node/responsesApi.ts +0 -326
- package/src/_internal/platform/env/common/envService.ts +0 -134
- package/src/_internal/platform/env/common/nullEnvService.ts +0 -68
- package/src/_internal/platform/env/common/packagejson.ts +0 -49
- package/src/_internal/platform/git/common/gitExtensionService.ts +0 -21
- package/src/_internal/platform/git/common/nullGitExtensionService.ts +0 -20
- package/src/_internal/platform/git/vscode/git.d.ts +0 -414
- package/src/_internal/platform/github/common/githubAPI.ts +0 -44
- package/src/_internal/platform/github/common/githubService.ts +0 -87
- package/src/_internal/platform/github/common/nullOctokitServiceImpl.ts +0 -21
- package/src/_internal/platform/ignore/common/ignoreService.ts +0 -72
- package/src/_internal/platform/inlineCompletions/common/api.ts +0 -198
- package/src/_internal/platform/inlineEdits/common/dataTypes/diagnosticData.ts +0 -32
- package/src/_internal/platform/inlineEdits/common/dataTypes/documentId.ts +0 -52
- package/src/_internal/platform/inlineEdits/common/dataTypes/edit.ts +0 -165
- package/src/_internal/platform/inlineEdits/common/dataTypes/editUtils.ts +0 -74
- package/src/_internal/platform/inlineEdits/common/dataTypes/fetchCancellationError.ts +0 -14
- package/src/_internal/platform/inlineEdits/common/dataTypes/languageContext.ts +0 -107
- package/src/_internal/platform/inlineEdits/common/dataTypes/languageId.ts +0 -14
- package/src/_internal/platform/inlineEdits/common/dataTypes/permutation.ts +0 -69
- package/src/_internal/platform/inlineEdits/common/dataTypes/rootedLineEdit.ts +0 -49
- package/src/_internal/platform/inlineEdits/common/dataTypes/textEditLength.ts +0 -74
- package/src/_internal/platform/inlineEdits/common/dataTypes/textEditLengthHelper/combineTextEditInfos.ts +0 -132
- package/src/_internal/platform/inlineEdits/common/dataTypes/textEditLengthHelper/length.ts +0 -184
- package/src/_internal/platform/inlineEdits/common/dataTypes/textEditLengthHelper/textEditInfo.ts +0 -32
- package/src/_internal/platform/inlineEdits/common/dataTypes/xtabPromptOptions.ts +0 -89
- package/src/_internal/platform/inlineEdits/common/debugRecorderBookmark.ts +0 -10
- package/src/_internal/platform/inlineEdits/common/editReason.ts +0 -134
- package/src/_internal/platform/inlineEdits/common/inlineEditLogContext.ts +0 -490
- package/src/_internal/platform/inlineEdits/common/observableGit.ts +0 -49
- package/src/_internal/platform/inlineEdits/common/observableWorkspace.ts +0 -239
- package/src/_internal/platform/inlineEdits/common/responseProcessor.ts +0 -249
- package/src/_internal/platform/inlineEdits/common/statelessNextEditProvider.ts +0 -468
- package/src/_internal/platform/inlineEdits/common/statelessNextEditProviders.ts +0 -59
- package/src/_internal/platform/inlineEdits/common/utils/observable.ts +0 -54
- package/src/_internal/platform/inlineEdits/common/utils/stringifyChatMessages.ts +0 -29
- package/src/_internal/platform/inlineEdits/common/utils/utils.ts +0 -56
- package/src/_internal/platform/inlineEdits/common/workspaceEditTracker/historyContextProvider.ts +0 -60
- package/src/_internal/platform/inlineEdits/common/workspaceEditTracker/nesHistoryContextProvider.ts +0 -353
- package/src/_internal/platform/inlineEdits/common/workspaceEditTracker/nesXtabHistoryTracker.ts +0 -176
- package/src/_internal/platform/languageContextProvider/common/languageContextProviderService.ts +0 -25
- package/src/_internal/platform/languageContextProvider/common/nullLanguageContextProviderService.ts +0 -38
- package/src/_internal/platform/languageServer/common/languageContextService.ts +0 -186
- package/src/_internal/platform/languages/common/languageDiagnosticsService.ts +0 -67
- package/src/_internal/platform/languages/common/testLanguageDiagnosticsService.ts +0 -28
- package/src/_internal/platform/log/common/logService.ts +0 -232
- package/src/_internal/platform/nesFetch/common/completionsAPI.ts +0 -78
- package/src/_internal/platform/nesFetch/common/completionsFetchService.ts +0 -118
- package/src/_internal/platform/nesFetch/common/responseStream.ts +0 -151
- package/src/_internal/platform/nesFetch/node/completionsFetchServiceImpl.ts +0 -236
- package/src/_internal/platform/nesFetch/node/streamTransformer.ts +0 -95
- package/src/_internal/platform/networking/common/fetch.ts +0 -349
- package/src/_internal/platform/networking/common/fetcherService.ts +0 -84
- package/src/_internal/platform/networking/common/networking.ts +0 -442
- package/src/_internal/platform/networking/common/openai.ts +0 -273
- package/src/_internal/platform/networking/node/chatStream.ts +0 -137
- package/src/_internal/platform/networking/node/stream.ts +0 -749
- package/src/_internal/platform/notebook/common/alternativeContent.ts +0 -89
- package/src/_internal/platform/notebook/common/alternativeContentFormat.ts +0 -10
- package/src/_internal/platform/notebook/common/alternativeContentProvider.json.ts +0 -262
- package/src/_internal/platform/notebook/common/alternativeContentProvider.text.ts +0 -243
- package/src/_internal/platform/notebook/common/alternativeContentProvider.ts +0 -41
- package/src/_internal/platform/notebook/common/alternativeContentProvider.xml.ts +0 -205
- package/src/_internal/platform/notebook/common/alternativeNotebookDocument.ts +0 -155
- package/src/_internal/platform/notebook/common/helpers.ts +0 -212
- package/src/_internal/platform/notebook/common/notebookService.ts +0 -43
- package/src/_internal/platform/openai/node/fetch.ts +0 -596
- package/src/_internal/platform/parser/node/nodes.ts +0 -190
- package/src/_internal/platform/requestLogger/node/nullRequestLogger.ts +0 -26
- package/src/_internal/platform/requestLogger/node/requestLogger.ts +0 -383
- package/src/_internal/platform/simulationTestContext/common/simulationTestContext.ts +0 -29
- package/src/_internal/platform/snippy/common/snippyService.ts +0 -25
- package/src/_internal/platform/telemetry/common/nullExperimentationService.ts +0 -64
- package/src/_internal/platform/telemetry/common/nullTelemetryService.ts +0 -53
- package/src/_internal/platform/telemetry/common/telemetry.ts +0 -215
- package/src/_internal/platform/telemetry/common/telemetryData.ts +0 -205
- package/src/_internal/platform/thinking/common/thinking.ts +0 -61
- package/src/_internal/platform/thinking/common/thinkingUtils.ts +0 -57
- package/src/_internal/platform/tokenizer/node/parseTikTokens.ts +0 -23
- package/src/_internal/platform/tokenizer/node/tikTokenizerImpl.ts +0 -74
- package/src/_internal/platform/tokenizer/node/tikTokenizerWorker.ts +0 -24
- package/src/_internal/platform/tokenizer/node/tokenizer.ts +0 -357
- package/src/_internal/platform/workspace/common/workspaceService.ts +0 -226
- package/src/_internal/platform/workspaceRecorder/common/workspaceLog.ts +0 -118
- package/src/_internal/util/common/anomalyDetection.ts +0 -112
- package/src/_internal/util/common/arrays.ts +0 -81
- package/src/_internal/util/common/async.ts +0 -155
- package/src/_internal/util/common/cache.ts +0 -183
- package/src/_internal/util/common/crypto.ts +0 -41
- package/src/_internal/util/common/errors.ts +0 -22
- package/src/_internal/util/common/globals.d.ts +0 -12
- package/src/_internal/util/common/imageUtils.ts +0 -154
- package/src/_internal/util/common/languages.ts +0 -940
- package/src/_internal/util/common/notebooks.ts +0 -286
- package/src/_internal/util/common/result.ts +0 -71
- package/src/_internal/util/common/services.ts +0 -43
- package/src/_internal/util/common/test/shims/chatTypes.ts +0 -448
- package/src/_internal/util/common/test/shims/editing.ts +0 -233
- package/src/_internal/util/common/test/shims/enums.ts +0 -61
- package/src/_internal/util/common/test/shims/l10n.ts +0 -37
- package/src/_internal/util/common/test/shims/newSymbolName.ts +0 -23
- package/src/_internal/util/common/test/shims/terminal.ts +0 -33
- package/src/_internal/util/common/test/shims/vscodeTypesShim.ts +0 -115
- package/src/_internal/util/common/time.ts +0 -31
- package/src/_internal/util/common/tokenizer.ts +0 -30
- package/src/_internal/util/common/tracing.ts +0 -52
- package/src/_internal/util/common/types.ts +0 -33
- package/src/_internal/util/common/variableLengthQuantity.ts +0 -40
- package/src/_internal/util/node/worker.ts +0 -130
- package/src/_internal/util/vs/base/common/arrays.ts +0 -926
- package/src/_internal/util/vs/base/common/arraysFind.ts +0 -206
- package/src/_internal/util/vs/base/common/assert.ts +0 -89
- package/src/_internal/util/vs/base/common/async.ts +0 -2582
- package/src/_internal/util/vs/base/common/buffer.ts +0 -501
- package/src/_internal/util/vs/base/common/cache.ts +0 -122
- package/src/_internal/util/vs/base/common/cancellation.ts +0 -150
- package/src/_internal/util/vs/base/common/charCode.ts +0 -452
- package/src/_internal/util/vs/base/common/codicons.ts +0 -66
- package/src/_internal/util/vs/base/common/codiconsLibrary.ts +0 -618
- package/src/_internal/util/vs/base/common/codiconsUtil.ts +0 -30
- package/src/_internal/util/vs/base/common/collections.ts +0 -156
- package/src/_internal/util/vs/base/common/diff/diff.ts +0 -1317
- package/src/_internal/util/vs/base/common/diff/diffChange.ts +0 -62
- package/src/_internal/util/vs/base/common/equals.ts +0 -148
- package/src/_internal/util/vs/base/common/errors.ts +0 -342
- package/src/_internal/util/vs/base/common/event.ts +0 -1782
- package/src/_internal/util/vs/base/common/extpath.ts +0 -425
- package/src/_internal/util/vs/base/common/filters.ts +0 -928
- package/src/_internal/util/vs/base/common/functional.ts +0 -34
- package/src/_internal/util/vs/base/common/glob.ts +0 -839
- package/src/_internal/util/vs/base/common/hash.ts +0 -326
- package/src/_internal/util/vs/base/common/htmlContent.ts +0 -212
- package/src/_internal/util/vs/base/common/iconLabels.ts +0 -118
- package/src/_internal/util/vs/base/common/iterator.ts +0 -196
- package/src/_internal/util/vs/base/common/lazy.ts +0 -59
- package/src/_internal/util/vs/base/common/lifecycle.ts +0 -845
- package/src/_internal/util/vs/base/common/linkedList.ts +0 -144
- package/src/_internal/util/vs/base/common/map.ts +0 -954
- package/src/_internal/util/vs/base/common/marshallingIds.ts +0 -35
- package/src/_internal/util/vs/base/common/mime.ts +0 -136
- package/src/_internal/util/vs/base/common/naturalLanguage/korean.ts +0 -425
- package/src/_internal/util/vs/base/common/network.ts +0 -429
- package/src/_internal/util/vs/base/common/numbers.ts +0 -166
- package/src/_internal/util/vs/base/common/objects.ts +0 -242
- package/src/_internal/util/vs/base/common/observable.ts +0 -10
- package/src/_internal/util/vs/base/common/observableInternal/base.ts +0 -208
- package/src/_internal/util/vs/base/common/observableInternal/changeTracker.ts +0 -96
- package/src/_internal/util/vs/base/common/observableInternal/commonFacade/cancellation.ts +0 -9
- package/src/_internal/util/vs/base/common/observableInternal/commonFacade/deps.ts +0 -12
- package/src/_internal/util/vs/base/common/observableInternal/debugLocation.ts +0 -88
- package/src/_internal/util/vs/base/common/observableInternal/debugName.ts +0 -150
- package/src/_internal/util/vs/base/common/observableInternal/experimental/utils.ts +0 -62
- package/src/_internal/util/vs/base/common/observableInternal/index.ts +0 -61
- package/src/_internal/util/vs/base/common/observableInternal/logging/consoleObservableLogger.ts +0 -388
- package/src/_internal/util/vs/base/common/observableInternal/logging/debugger/debuggerApi.d.ts +0 -154
- package/src/_internal/util/vs/base/common/observableInternal/logging/debugger/debuggerRpc.ts +0 -80
- package/src/_internal/util/vs/base/common/observableInternal/logging/debugger/devToolsLogger.ts +0 -485
- package/src/_internal/util/vs/base/common/observableInternal/logging/debugger/rpc.ts +0 -103
- package/src/_internal/util/vs/base/common/observableInternal/logging/debugger/utils.ts +0 -69
- package/src/_internal/util/vs/base/common/observableInternal/logging/logging.ts +0 -133
- package/src/_internal/util/vs/base/common/observableInternal/map.ts +0 -81
- package/src/_internal/util/vs/base/common/observableInternal/observables/baseObservable.ts +0 -172
- package/src/_internal/util/vs/base/common/observableInternal/observables/constObservable.ts +0 -44
- package/src/_internal/util/vs/base/common/observableInternal/observables/derived.ts +0 -190
- package/src/_internal/util/vs/base/common/observableInternal/observables/derivedImpl.ts +0 -445
- package/src/_internal/util/vs/base/common/observableInternal/observables/lazyObservableValue.ts +0 -154
- package/src/_internal/util/vs/base/common/observableInternal/observables/observableFromEvent.ts +0 -174
- package/src/_internal/util/vs/base/common/observableInternal/observables/observableSignal.ts +0 -67
- package/src/_internal/util/vs/base/common/observableInternal/observables/observableSignalFromEvent.ts +0 -62
- package/src/_internal/util/vs/base/common/observableInternal/observables/observableValue.ts +0 -131
- package/src/_internal/util/vs/base/common/observableInternal/observables/observableValueOpts.ts +0 -37
- package/src/_internal/util/vs/base/common/observableInternal/reactions/autorun.ts +0 -188
- package/src/_internal/util/vs/base/common/observableInternal/reactions/autorunImpl.ts +0 -256
- package/src/_internal/util/vs/base/common/observableInternal/set.ts +0 -78
- package/src/_internal/util/vs/base/common/observableInternal/transaction.ts +0 -115
- package/src/_internal/util/vs/base/common/observableInternal/utils/promise.ts +0 -129
- package/src/_internal/util/vs/base/common/observableInternal/utils/runOnChange.ts +0 -65
- package/src/_internal/util/vs/base/common/observableInternal/utils/utils.ts +0 -281
- package/src/_internal/util/vs/base/common/observableInternal/utils/utilsCancellation.ts +0 -101
- package/src/_internal/util/vs/base/common/observableInternal/utils/valueWithChangeEvent.ts +0 -31
- package/src/_internal/util/vs/base/common/path.ts +0 -1591
- package/src/_internal/util/vs/base/common/platform.ts +0 -282
- package/src/_internal/util/vs/base/common/process.ts +0 -78
- package/src/_internal/util/vs/base/common/resources.ts +0 -446
- package/src/_internal/util/vs/base/common/sequence.ts +0 -36
- package/src/_internal/util/vs/base/common/sseParser.ts +0 -247
- package/src/_internal/util/vs/base/common/stopwatch.ts +0 -43
- package/src/_internal/util/vs/base/common/stream.ts +0 -792
- package/src/_internal/util/vs/base/common/strings.ts +0 -1364
- package/src/_internal/util/vs/base/common/symbols.ts +0 -11
- package/src/_internal/util/vs/base/common/themables.ts +0 -106
- package/src/_internal/util/vs/base/common/types.ts +0 -345
- package/src/_internal/util/vs/base/common/uint.ts +0 -61
- package/src/_internal/util/vs/base/common/uri.ts +0 -752
- package/src/_internal/util/vs/base/common/uuid.ts +0 -72
- package/src/_internal/util/vs/base-common.d.ts +0 -42
- package/src/_internal/util/vs/editor/common/core/editOperation.ts +0 -62
- package/src/_internal/util/vs/editor/common/core/edits/edit.ts +0 -399
- package/src/_internal/util/vs/editor/common/core/edits/lineEdit.ts +0 -414
- package/src/_internal/util/vs/editor/common/core/edits/stringEdit.ts +0 -568
- package/src/_internal/util/vs/editor/common/core/edits/textEdit.ts +0 -411
- package/src/_internal/util/vs/editor/common/core/position.ts +0 -186
- package/src/_internal/util/vs/editor/common/core/range.ts +0 -519
- package/src/_internal/util/vs/editor/common/core/ranges/lineRange.ts +0 -416
- package/src/_internal/util/vs/editor/common/core/ranges/offsetRange.ts +0 -275
- package/src/_internal/util/vs/editor/common/core/text/abstractText.ts +0 -127
- package/src/_internal/util/vs/editor/common/core/text/positionToOffset.ts +0 -26
- package/src/_internal/util/vs/editor/common/core/text/positionToOffsetImpl.ts +0 -144
- package/src/_internal/util/vs/editor/common/core/text/textLength.ts +0 -150
- package/src/_internal/util/vs/editor/common/core/wordHelper.ts +0 -177
- package/src/_internal/util/vs/editor/common/diff/defaultLinesDiffComputer/algorithms/diffAlgorithm.ts +0 -210
- package/src/_internal/util/vs/editor/common/diff/defaultLinesDiffComputer/algorithms/dynamicProgrammingDiffing.ts +0 -109
- package/src/_internal/util/vs/editor/common/diff/defaultLinesDiffComputer/algorithms/myersDiffAlgorithm.ts +0 -178
- package/src/_internal/util/vs/editor/common/diff/defaultLinesDiffComputer/computeMovedLines.ts +0 -331
- package/src/_internal/util/vs/editor/common/diff/defaultLinesDiffComputer/defaultLinesDiffComputer.ts +0 -273
- package/src/_internal/util/vs/editor/common/diff/defaultLinesDiffComputer/heuristicSequenceOptimizations.ts +0 -475
- package/src/_internal/util/vs/editor/common/diff/defaultLinesDiffComputer/lineSequence.ts +0 -47
- package/src/_internal/util/vs/editor/common/diff/defaultLinesDiffComputer/linesSliceCharSequence.ts +0 -248
- package/src/_internal/util/vs/editor/common/diff/defaultLinesDiffComputer/utils.ts +0 -76
- package/src/_internal/util/vs/editor/common/diff/legacyLinesDiffComputer.ts +0 -693
- package/src/_internal/util/vs/editor/common/diff/linesDiffComputer.ts +0 -61
- package/src/_internal/util/vs/editor/common/diff/rangeMapping.ts +0 -418
- package/src/_internal/util/vs/editor/common/model/prefixSumComputer.ts +0 -304
- package/src/_internal/util/vs/nls.messages.ts +0 -21
- package/src/_internal/util/vs/nls.ts +0 -243
- package/src/_internal/util/vs/platform/instantiation/common/descriptors.ts +0 -23
- package/src/_internal/util/vs/platform/instantiation/common/graph.ts +0 -113
- package/src/_internal/util/vs/platform/instantiation/common/instantiation.ts +0 -127
- package/src/_internal/util/vs/platform/instantiation/common/instantiationService.ts +0 -483
- package/src/_internal/util/vs/platform/instantiation/common/serviceCollection.ts +0 -34
- package/src/_internal/util/vs/vscode-globals-nls.d.ts +0 -42
- package/src/_internal/util/vs/vscode-globals-product.d.ts +0 -35
- package/src/_internal/util/vs/workbench/api/common/extHostTypes/diagnostic.ts +0 -109
- package/src/_internal/util/vs/workbench/api/common/extHostTypes/es5ClassCompat.ts +0 -34
- package/src/_internal/util/vs/workbench/api/common/extHostTypes/location.ts +0 -51
- package/src/_internal/util/vs/workbench/api/common/extHostTypes/markdownString.ts +0 -83
- package/src/_internal/util/vs/workbench/api/common/extHostTypes/notebooks.ts +0 -296
- package/src/_internal/util/vs/workbench/api/common/extHostTypes/position.ts +0 -195
- package/src/_internal/util/vs/workbench/api/common/extHostTypes/range.ts +0 -167
- package/src/_internal/util/vs/workbench/api/common/extHostTypes/selection.ts +0 -94
- package/src/_internal/util/vs/workbench/api/common/extHostTypes/snippetString.ts +0 -103
- package/src/_internal/util/vs/workbench/api/common/extHostTypes/snippetTextEdit.ts +0 -44
- package/src/_internal/util/vs/workbench/api/common/extHostTypes/symbolInformation.ts +0 -89
- package/src/_internal/util/vs/workbench/api/common/extHostTypes/textEdit.ts +0 -99
- package/src/_internal/vscodeTypes.ts +0 -100
- package/src/main.ts +0 -207
- package/src/package.json +0 -4063
|
@@ -1,281 +0,0 @@
|
|
|
1
|
-
//!!! DO NOT modify, this file was COPIED from 'microsoft/vscode'
|
|
2
|
-
|
|
3
|
-
/*---------------------------------------------------------------------------------------------
|
|
4
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5
|
-
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
6
|
-
*--------------------------------------------------------------------------------------------*/
|
|
7
|
-
|
|
8
|
-
import { autorun } from '../reactions/autorun';
|
|
9
|
-
import { IObservable, IObservableWithChange, IObserver, IReader, ITransaction } from '../base';
|
|
10
|
-
import { transaction } from '../transaction';
|
|
11
|
-
import { observableValue } from '../observables/observableValue';
|
|
12
|
-
import { DebugOwner } from '../debugName';
|
|
13
|
-
import { DisposableStore, Event, IDisposable, toDisposable } from '../commonFacade/deps';
|
|
14
|
-
import { derived, derivedOpts } from '../observables/derived';
|
|
15
|
-
import { observableFromEvent } from '../observables/observableFromEvent';
|
|
16
|
-
import { observableSignal } from '../observables/observableSignal';
|
|
17
|
-
import { _setKeepObserved, _setRecomputeInitiallyAndOnChange } from '../observables/baseObservable';
|
|
18
|
-
|
|
19
|
-
export function observableFromPromise<T>(promise: Promise<T>): IObservable<{ value?: T }> {
|
|
20
|
-
const observable = observableValue<{ value?: T }>('promiseValue', {});
|
|
21
|
-
promise.then((value) => {
|
|
22
|
-
observable.set({ value }, undefined);
|
|
23
|
-
});
|
|
24
|
-
return observable;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export function signalFromObservable<T>(owner: DebugOwner | undefined, observable: IObservable<T>): IObservable<void> {
|
|
28
|
-
return derivedOpts({
|
|
29
|
-
owner,
|
|
30
|
-
equalsFn: () => false,
|
|
31
|
-
}, reader => {
|
|
32
|
-
observable.read(reader);
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* @deprecated Use `debouncedObservable` instead.
|
|
38
|
-
*/
|
|
39
|
-
export function debouncedObservableDeprecated<T>(observable: IObservable<T>, debounceMs: number, disposableStore: DisposableStore): IObservable<T | undefined> {
|
|
40
|
-
const debouncedObservable = observableValue<T | undefined>('debounced', undefined);
|
|
41
|
-
|
|
42
|
-
let timeout: Timeout | undefined = undefined;
|
|
43
|
-
|
|
44
|
-
disposableStore.add(autorun(reader => {
|
|
45
|
-
/** @description debounce */
|
|
46
|
-
const value = observable.read(reader);
|
|
47
|
-
|
|
48
|
-
if (timeout) {
|
|
49
|
-
clearTimeout(timeout);
|
|
50
|
-
}
|
|
51
|
-
timeout = setTimeout(() => {
|
|
52
|
-
transaction(tx => {
|
|
53
|
-
debouncedObservable.set(value, tx);
|
|
54
|
-
});
|
|
55
|
-
}, debounceMs);
|
|
56
|
-
|
|
57
|
-
}));
|
|
58
|
-
|
|
59
|
-
return debouncedObservable;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Creates an observable that debounces the input observable.
|
|
64
|
-
*/
|
|
65
|
-
export function debouncedObservable<T>(observable: IObservable<T>, debounceMs: number): IObservable<T> {
|
|
66
|
-
let hasValue = false;
|
|
67
|
-
let lastValue: T | undefined;
|
|
68
|
-
|
|
69
|
-
let timeout: Timeout | undefined = undefined;
|
|
70
|
-
|
|
71
|
-
return observableFromEvent<T, void>(cb => {
|
|
72
|
-
const d = autorun(reader => {
|
|
73
|
-
const value = observable.read(reader);
|
|
74
|
-
|
|
75
|
-
if (!hasValue) {
|
|
76
|
-
hasValue = true;
|
|
77
|
-
lastValue = value;
|
|
78
|
-
} else {
|
|
79
|
-
if (timeout) {
|
|
80
|
-
clearTimeout(timeout);
|
|
81
|
-
}
|
|
82
|
-
timeout = setTimeout(() => {
|
|
83
|
-
lastValue = value;
|
|
84
|
-
cb();
|
|
85
|
-
}, debounceMs);
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
return {
|
|
89
|
-
dispose() {
|
|
90
|
-
d.dispose();
|
|
91
|
-
hasValue = false;
|
|
92
|
-
lastValue = undefined;
|
|
93
|
-
},
|
|
94
|
-
};
|
|
95
|
-
}, () => {
|
|
96
|
-
if (hasValue) {
|
|
97
|
-
return lastValue!;
|
|
98
|
-
} else {
|
|
99
|
-
return observable.get();
|
|
100
|
-
}
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
export function wasEventTriggeredRecently(event: Event<any>, timeoutMs: number, disposableStore: DisposableStore): IObservable<boolean> {
|
|
105
|
-
const observable = observableValue('triggeredRecently', false);
|
|
106
|
-
|
|
107
|
-
let timeout: Timeout | undefined = undefined;
|
|
108
|
-
|
|
109
|
-
disposableStore.add(event(() => {
|
|
110
|
-
observable.set(true, undefined);
|
|
111
|
-
|
|
112
|
-
if (timeout) {
|
|
113
|
-
clearTimeout(timeout);
|
|
114
|
-
}
|
|
115
|
-
timeout = setTimeout(() => {
|
|
116
|
-
observable.set(false, undefined);
|
|
117
|
-
}, timeoutMs);
|
|
118
|
-
}));
|
|
119
|
-
|
|
120
|
-
return observable;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
/**
|
|
124
|
-
* This makes sure the observable is being observed and keeps its cache alive.
|
|
125
|
-
*/
|
|
126
|
-
export function keepObserved<T>(observable: IObservable<T>): IDisposable {
|
|
127
|
-
const o = new KeepAliveObserver(false, undefined);
|
|
128
|
-
observable.addObserver(o);
|
|
129
|
-
return toDisposable(() => {
|
|
130
|
-
observable.removeObserver(o);
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
_setKeepObserved(keepObserved);
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
* This converts the given observable into an autorun.
|
|
138
|
-
*/
|
|
139
|
-
export function recomputeInitiallyAndOnChange<T>(observable: IObservable<T>, handleValue?: (value: T) => void): IDisposable {
|
|
140
|
-
const o = new KeepAliveObserver(true, handleValue);
|
|
141
|
-
observable.addObserver(o);
|
|
142
|
-
try {
|
|
143
|
-
o.beginUpdate(observable);
|
|
144
|
-
} finally {
|
|
145
|
-
o.endUpdate(observable);
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
return toDisposable(() => {
|
|
149
|
-
observable.removeObserver(o);
|
|
150
|
-
});
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
_setRecomputeInitiallyAndOnChange(recomputeInitiallyAndOnChange);
|
|
154
|
-
|
|
155
|
-
export class KeepAliveObserver implements IObserver {
|
|
156
|
-
private _counter = 0;
|
|
157
|
-
|
|
158
|
-
constructor(
|
|
159
|
-
private readonly _forceRecompute: boolean,
|
|
160
|
-
private readonly _handleValue: ((value: any) => void) | undefined,
|
|
161
|
-
) { }
|
|
162
|
-
|
|
163
|
-
beginUpdate<T>(observable: IObservable<T>): void {
|
|
164
|
-
this._counter++;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
endUpdate<T>(observable: IObservable<T>): void {
|
|
168
|
-
if (this._counter === 1 && this._forceRecompute) {
|
|
169
|
-
if (this._handleValue) {
|
|
170
|
-
this._handleValue(observable.get());
|
|
171
|
-
} else {
|
|
172
|
-
observable.reportChanges();
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
this._counter--;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
handlePossibleChange<T>(observable: IObservable<T>): void {
|
|
179
|
-
// NO OP
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
handleChange<T, TChange>(observable: IObservableWithChange<T, TChange>, change: TChange): void {
|
|
183
|
-
// NO OP
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
export function derivedObservableWithCache<T>(owner: DebugOwner, computeFn: (reader: IReader, lastValue: T | undefined) => T): IObservable<T> {
|
|
188
|
-
let lastValue: T | undefined = undefined;
|
|
189
|
-
const observable = derivedOpts({ owner, debugReferenceFn: computeFn }, reader => {
|
|
190
|
-
lastValue = computeFn(reader, lastValue);
|
|
191
|
-
return lastValue;
|
|
192
|
-
});
|
|
193
|
-
return observable;
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
export function derivedObservableWithWritableCache<T>(owner: object, computeFn: (reader: IReader, lastValue: T | undefined) => T): IObservable<T>
|
|
197
|
-
& { clearCache(transaction: ITransaction): void; setCache(newValue: T | undefined, tx: ITransaction | undefined): void } {
|
|
198
|
-
let lastValue: T | undefined = undefined;
|
|
199
|
-
const onChange = observableSignal('derivedObservableWithWritableCache');
|
|
200
|
-
const observable = derived(owner, reader => {
|
|
201
|
-
onChange.read(reader);
|
|
202
|
-
lastValue = computeFn(reader, lastValue);
|
|
203
|
-
return lastValue;
|
|
204
|
-
});
|
|
205
|
-
return Object.assign(observable, {
|
|
206
|
-
clearCache: (tx: ITransaction) => {
|
|
207
|
-
lastValue = undefined;
|
|
208
|
-
onChange.trigger(tx);
|
|
209
|
-
},
|
|
210
|
-
setCache: (newValue: T | undefined, tx: ITransaction | undefined) => {
|
|
211
|
-
lastValue = newValue;
|
|
212
|
-
onChange.trigger(tx);
|
|
213
|
-
}
|
|
214
|
-
});
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
/**
|
|
218
|
-
* When the items array changes, referential equal items are not mapped again.
|
|
219
|
-
*/
|
|
220
|
-
export function mapObservableArrayCached<TIn, TOut, TKey = TIn>(owner: DebugOwner, items: IObservable<readonly TIn[]>, map: (input: TIn, store: DisposableStore) => TOut, keySelector?: (input: TIn) => TKey): IObservable<readonly TOut[]> {
|
|
221
|
-
let m = new ArrayMap(map, keySelector);
|
|
222
|
-
const self = derivedOpts({
|
|
223
|
-
debugReferenceFn: map,
|
|
224
|
-
owner,
|
|
225
|
-
onLastObserverRemoved: () => {
|
|
226
|
-
m.dispose();
|
|
227
|
-
m = new ArrayMap(map);
|
|
228
|
-
}
|
|
229
|
-
}, (reader) => {
|
|
230
|
-
m.setItems(items.read(reader));
|
|
231
|
-
return m.getItems();
|
|
232
|
-
});
|
|
233
|
-
return self;
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
class ArrayMap<TIn, TOut, TKey> implements IDisposable {
|
|
237
|
-
private readonly _cache = new Map<TKey, { out: TOut; store: DisposableStore }>();
|
|
238
|
-
private _items: TOut[] = [];
|
|
239
|
-
constructor(
|
|
240
|
-
private readonly _map: (input: TIn, store: DisposableStore) => TOut,
|
|
241
|
-
private readonly _keySelector?: (input: TIn) => TKey,
|
|
242
|
-
) {
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
public dispose(): void {
|
|
246
|
-
this._cache.forEach(entry => entry.store.dispose());
|
|
247
|
-
this._cache.clear();
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
public setItems(items: readonly TIn[]): void {
|
|
251
|
-
const newItems: TOut[] = [];
|
|
252
|
-
const itemsToRemove = new Set(this._cache.keys());
|
|
253
|
-
|
|
254
|
-
for (const item of items) {
|
|
255
|
-
const key = this._keySelector ? this._keySelector(item) : item as unknown as TKey;
|
|
256
|
-
|
|
257
|
-
let entry = this._cache.get(key);
|
|
258
|
-
if (!entry) {
|
|
259
|
-
const store = new DisposableStore();
|
|
260
|
-
const out = this._map(item, store);
|
|
261
|
-
entry = { out, store };
|
|
262
|
-
this._cache.set(key, entry);
|
|
263
|
-
} else {
|
|
264
|
-
itemsToRemove.delete(key);
|
|
265
|
-
}
|
|
266
|
-
newItems.push(entry.out);
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
for (const item of itemsToRemove) {
|
|
270
|
-
const entry = this._cache.get(item)!;
|
|
271
|
-
entry.store.dispose();
|
|
272
|
-
this._cache.delete(item);
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
this._items = newItems;
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
public getItems(): TOut[] {
|
|
279
|
-
return this._items;
|
|
280
|
-
}
|
|
281
|
-
}
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
//!!! DO NOT modify, this file was COPIED from 'microsoft/vscode'
|
|
2
|
-
|
|
3
|
-
/*---------------------------------------------------------------------------------------------
|
|
4
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5
|
-
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
6
|
-
*--------------------------------------------------------------------------------------------*/
|
|
7
|
-
|
|
8
|
-
import { IReader, IObservable } from '../base';
|
|
9
|
-
import { DebugOwner, DebugNameData } from '../debugName';
|
|
10
|
-
import { CancellationError, CancellationToken, CancellationTokenSource } from '../commonFacade/cancellation';
|
|
11
|
-
import { strictEquals } from '../commonFacade/deps';
|
|
12
|
-
import { autorun } from '../reactions/autorun';
|
|
13
|
-
import { Derived } from '../observables/derivedImpl';
|
|
14
|
-
import { DebugLocation } from '../debugLocation';
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Resolves the promise when the observables state matches the predicate.
|
|
18
|
-
*/
|
|
19
|
-
export function waitForState<T>(observable: IObservable<T | null | undefined>): Promise<T>;
|
|
20
|
-
export function waitForState<T, TState extends T>(observable: IObservable<T>, predicate: (state: T) => state is TState, isError?: (state: T) => boolean | unknown | undefined, cancellationToken?: CancellationToken): Promise<TState>;
|
|
21
|
-
export function waitForState<T>(observable: IObservable<T>, predicate: (state: T) => boolean, isError?: (state: T) => boolean | unknown | undefined, cancellationToken?: CancellationToken): Promise<T>;
|
|
22
|
-
export function waitForState<T>(observable: IObservable<T>, predicate?: (state: T) => boolean, isError?: (state: T) => boolean | unknown | undefined, cancellationToken?: CancellationToken): Promise<T> {
|
|
23
|
-
if (!predicate) {
|
|
24
|
-
predicate = state => state !== null && state !== undefined;
|
|
25
|
-
}
|
|
26
|
-
return new Promise((resolve, reject) => {
|
|
27
|
-
let isImmediateRun = true;
|
|
28
|
-
let shouldDispose = false;
|
|
29
|
-
const stateObs = observable.map(state => {
|
|
30
|
-
/** @description waitForState.state */
|
|
31
|
-
return {
|
|
32
|
-
isFinished: predicate(state),
|
|
33
|
-
error: isError ? isError(state) : false,
|
|
34
|
-
state
|
|
35
|
-
};
|
|
36
|
-
});
|
|
37
|
-
const d = autorun(reader => {
|
|
38
|
-
/** @description waitForState */
|
|
39
|
-
const { isFinished, error, state } = stateObs.read(reader);
|
|
40
|
-
if (isFinished || error) {
|
|
41
|
-
if (isImmediateRun) {
|
|
42
|
-
// The variable `d` is not initialized yet
|
|
43
|
-
shouldDispose = true;
|
|
44
|
-
} else {
|
|
45
|
-
d.dispose();
|
|
46
|
-
}
|
|
47
|
-
if (error) {
|
|
48
|
-
reject(error === true ? state : error);
|
|
49
|
-
} else {
|
|
50
|
-
resolve(state);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
if (cancellationToken) {
|
|
55
|
-
const dc = cancellationToken.onCancellationRequested(() => {
|
|
56
|
-
d.dispose();
|
|
57
|
-
dc.dispose();
|
|
58
|
-
reject(new CancellationError());
|
|
59
|
-
});
|
|
60
|
-
if (cancellationToken.isCancellationRequested) {
|
|
61
|
-
d.dispose();
|
|
62
|
-
dc.dispose();
|
|
63
|
-
reject(new CancellationError());
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
isImmediateRun = false;
|
|
68
|
-
if (shouldDispose) {
|
|
69
|
-
d.dispose();
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export function derivedWithCancellationToken<T>(computeFn: (reader: IReader, cancellationToken: CancellationToken) => T): IObservable<T>;
|
|
75
|
-
export function derivedWithCancellationToken<T>(owner: object, computeFn: (reader: IReader, cancellationToken: CancellationToken) => T): IObservable<T>;
|
|
76
|
-
export function derivedWithCancellationToken<T>(computeFnOrOwner: ((reader: IReader, cancellationToken: CancellationToken) => T) | object, computeFnOrUndefined?: ((reader: IReader, cancellationToken: CancellationToken) => T)): IObservable<T> {
|
|
77
|
-
let computeFn: (reader: IReader, store: CancellationToken) => T;
|
|
78
|
-
let owner: DebugOwner;
|
|
79
|
-
if (computeFnOrUndefined === undefined) {
|
|
80
|
-
computeFn = computeFnOrOwner as any;
|
|
81
|
-
owner = undefined;
|
|
82
|
-
} else {
|
|
83
|
-
owner = computeFnOrOwner;
|
|
84
|
-
computeFn = computeFnOrUndefined as any;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
let cancellationTokenSource: CancellationTokenSource | undefined = undefined;
|
|
88
|
-
return new Derived(
|
|
89
|
-
new DebugNameData(owner, undefined, computeFn),
|
|
90
|
-
r => {
|
|
91
|
-
if (cancellationTokenSource) {
|
|
92
|
-
cancellationTokenSource.dispose(true);
|
|
93
|
-
}
|
|
94
|
-
cancellationTokenSource = new CancellationTokenSource();
|
|
95
|
-
return computeFn(r, cancellationTokenSource.token);
|
|
96
|
-
}, undefined,
|
|
97
|
-
() => cancellationTokenSource?.dispose(),
|
|
98
|
-
strictEquals,
|
|
99
|
-
DebugLocation.ofCaller()
|
|
100
|
-
);
|
|
101
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
//!!! DO NOT modify, this file was COPIED from 'microsoft/vscode'
|
|
2
|
-
|
|
3
|
-
/*---------------------------------------------------------------------------------------------
|
|
4
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5
|
-
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
6
|
-
*--------------------------------------------------------------------------------------------*/
|
|
7
|
-
|
|
8
|
-
import { IObservable } from '../base';
|
|
9
|
-
import { Event, IValueWithChangeEvent } from '../commonFacade/deps';
|
|
10
|
-
import { DebugOwner } from '../debugName';
|
|
11
|
-
import { observableFromEvent } from '../observables/observableFromEvent';
|
|
12
|
-
|
|
13
|
-
export class ValueWithChangeEventFromObservable<T> implements IValueWithChangeEvent<T> {
|
|
14
|
-
constructor(public readonly observable: IObservable<T>) {
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
get onDidChange(): Event<void> {
|
|
18
|
-
return Event.fromObservableLight(this.observable);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
get value(): T {
|
|
22
|
-
return this.observable.get();
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export function observableFromValueWithChangeEvent<T>(owner: DebugOwner, value: IValueWithChangeEvent<T>): IObservable<T> {
|
|
27
|
-
if (value instanceof ValueWithChangeEventFromObservable) {
|
|
28
|
-
return value.observable;
|
|
29
|
-
}
|
|
30
|
-
return observableFromEvent(owner, value.onDidChange, () => value.value);
|
|
31
|
-
}
|