@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,239 +0,0 @@
|
|
|
1
|
-
/*---------------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
4
|
-
*--------------------------------------------------------------------------------------------*/
|
|
5
|
-
|
|
6
|
-
import { assert } from '../../../util/vs/base/common/assert';
|
|
7
|
-
import { Disposable, toDisposable } from '../../../util/vs/base/common/lifecycle';
|
|
8
|
-
import { autorunWithStore, derivedHandleChanges, derivedWithStore, IObservable, IObservableWithChange, ISettableObservable, ITransaction, observableValue, runOnChange, subtransaction } from '../../../util/vs/base/common/observableInternal';
|
|
9
|
-
import { URI } from '../../../util/vs/base/common/uri';
|
|
10
|
-
import { StringEdit, StringReplacement } from '../../../util/vs/editor/common/core/edits/stringEdit';
|
|
11
|
-
import { OffsetRange } from '../../../util/vs/editor/common/core/ranges/offsetRange';
|
|
12
|
-
import { StringText } from '../../../util/vs/editor/common/core/text/abstractText';
|
|
13
|
-
import { DiagnosticData } from './dataTypes/diagnosticData';
|
|
14
|
-
import { DocumentId } from './dataTypes/documentId';
|
|
15
|
-
import { LanguageId } from './dataTypes/languageId';
|
|
16
|
-
import { EditReason } from './editReason';
|
|
17
|
-
|
|
18
|
-
export abstract class ObservableWorkspace {
|
|
19
|
-
abstract get openDocuments(): IObservableWithChange<readonly IObservableDocument[], { added: readonly IObservableDocument[]; removed: readonly IObservableDocument[] }>;
|
|
20
|
-
|
|
21
|
-
abstract getWorkspaceRoot(documentId: DocumentId): URI | undefined;
|
|
22
|
-
|
|
23
|
-
getFirstOpenDocument(): IObservableDocument | undefined {
|
|
24
|
-
return this.openDocuments.get()[0];
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
getDocument(documentId: DocumentId): IObservableDocument | undefined {
|
|
28
|
-
return this.openDocuments.get().find(d => d.id === documentId);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
private _version = 0;
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Is fired when any open document changes.
|
|
35
|
-
*/
|
|
36
|
-
public readonly onDidOpenDocumentChange = derivedHandleChanges({
|
|
37
|
-
owner: this,
|
|
38
|
-
changeTracker: {
|
|
39
|
-
createChangeSummary: () => ({ didChange: false }),
|
|
40
|
-
handleChange: (ctx, changeSummary) => {
|
|
41
|
-
if (!ctx.didChange(this.openDocuments)) {
|
|
42
|
-
changeSummary.didChange = true; // A document changed
|
|
43
|
-
}
|
|
44
|
-
return true;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}, (reader, changeSummary) => {
|
|
48
|
-
const docs = this.openDocuments.read(reader);
|
|
49
|
-
for (const d of docs) {
|
|
50
|
-
d.value.read(reader); // add dependency
|
|
51
|
-
}
|
|
52
|
-
if (changeSummary.didChange) {
|
|
53
|
-
this._version++; // to force a change
|
|
54
|
-
}
|
|
55
|
-
return this._version;
|
|
56
|
-
|
|
57
|
-
// TODO@hediet make this work:
|
|
58
|
-
/*
|
|
59
|
-
const docs = this.openDocuments.read(reader);
|
|
60
|
-
for (const d of docs) {
|
|
61
|
-
if (reader.readChangesSinceLastRun(d.value).length > 0) {
|
|
62
|
-
reader.reportChange(d);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
return undefined;
|
|
66
|
-
*/
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
public readonly lastActiveDocument = derivedWithStore((_reader, store) => {
|
|
70
|
-
const obs = observableValue('lastActiveDocument', undefined as IObservableDocument | undefined);
|
|
71
|
-
store.add(autorunWithStore((reader, store) => {
|
|
72
|
-
const docs = this.openDocuments.read(reader);
|
|
73
|
-
for (const d of docs) {
|
|
74
|
-
store.add(runOnChange(d.value, () => {
|
|
75
|
-
obs.set(d, undefined);
|
|
76
|
-
}));
|
|
77
|
-
}
|
|
78
|
-
}));
|
|
79
|
-
return obs;
|
|
80
|
-
}).flatten();
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
export interface IObservableDocument {
|
|
84
|
-
readonly id: DocumentId;
|
|
85
|
-
readonly value: IObservableWithChange<StringText, StringEditWithReason>;
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* Increases whenever the value changes. Is also used to reference document states from the past.
|
|
89
|
-
*/
|
|
90
|
-
readonly version: IObservable<number>;
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* `selection` is an array because of `multi-cursor` support.
|
|
94
|
-
*/
|
|
95
|
-
readonly selection: IObservable<readonly OffsetRange[]>;
|
|
96
|
-
readonly visibleRanges: IObservable<readonly OffsetRange[]>;
|
|
97
|
-
readonly languageId: IObservable<LanguageId>;
|
|
98
|
-
readonly diagnostics: IObservable<readonly DiagnosticData[]>;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
export class StringEditWithReason extends StringEdit {
|
|
102
|
-
constructor(
|
|
103
|
-
replacements: StringEdit['replacements'],
|
|
104
|
-
public readonly reason: EditReason,
|
|
105
|
-
) {
|
|
106
|
-
super(replacements);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
export class MutableObservableWorkspace extends ObservableWorkspace {
|
|
111
|
-
private readonly _openDocuments = observableValue<readonly IObservableDocument[], { added: readonly IObservableDocument[]; removed: readonly IObservableDocument[] }>(this, []);
|
|
112
|
-
public readonly openDocuments = this._openDocuments;
|
|
113
|
-
|
|
114
|
-
private readonly _documents = new Map<DocumentId, MutableObservableDocument>();
|
|
115
|
-
|
|
116
|
-
constructor() {
|
|
117
|
-
super();
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* Dispose to remove.
|
|
122
|
-
*/
|
|
123
|
-
public addDocument(options: { id: DocumentId; workspaceRoot?: URI; initialValue?: string; initialVersionId?: number; languageId?: LanguageId }, tx: ITransaction | undefined = undefined): MutableObservableDocument {
|
|
124
|
-
assert(!this._documents.has(options.id));
|
|
125
|
-
|
|
126
|
-
const document = new MutableObservableDocument(
|
|
127
|
-
options.id,
|
|
128
|
-
new StringText(options.initialValue ?? ''),
|
|
129
|
-
[],
|
|
130
|
-
options.languageId ?? LanguageId.PlainText,
|
|
131
|
-
() => {
|
|
132
|
-
this._documents.delete(options.id);
|
|
133
|
-
const docs = this._openDocuments.get();
|
|
134
|
-
const filteredDocs = docs.filter(d => d.id !== document.id);
|
|
135
|
-
if (filteredDocs.length !== docs.length) {
|
|
136
|
-
this._openDocuments.set(filteredDocs, tx, { added: [], removed: [document] });
|
|
137
|
-
}
|
|
138
|
-
},
|
|
139
|
-
options.initialVersionId ?? 0,
|
|
140
|
-
options.workspaceRoot,
|
|
141
|
-
);
|
|
142
|
-
|
|
143
|
-
this._documents.set(options.id, document);
|
|
144
|
-
this._openDocuments.set([...this._openDocuments.get(), document], tx, { added: [document], removed: [] });
|
|
145
|
-
|
|
146
|
-
return document;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
public override getDocument(id: DocumentId): MutableObservableDocument | undefined {
|
|
150
|
-
return this._documents.get(id);
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
public clear(): void {
|
|
154
|
-
this._openDocuments.set([], undefined, { added: [], removed: this._openDocuments.get() });
|
|
155
|
-
for (const doc of this._documents.values()) {
|
|
156
|
-
doc.dispose();
|
|
157
|
-
}
|
|
158
|
-
this._documents.clear();
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
getWorkspaceRoot(documentId: DocumentId): URI | undefined {
|
|
162
|
-
return this._documents.get(documentId)?.workspaceRoot;
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
export class MutableObservableDocument extends Disposable implements IObservableDocument {
|
|
167
|
-
private readonly _value: ISettableObservable<StringText, StringEditWithReason>;
|
|
168
|
-
public get value(): IObservableWithChange<StringText, StringEditWithReason> { return this._value; }
|
|
169
|
-
|
|
170
|
-
private readonly _selection: ISettableObservable<readonly OffsetRange[]>;
|
|
171
|
-
public get selection(): IObservable<readonly OffsetRange[]> { return this._selection; }
|
|
172
|
-
|
|
173
|
-
private readonly _visibleRanges: ISettableObservable<readonly OffsetRange[]>;
|
|
174
|
-
public get visibleRanges(): IObservable<readonly OffsetRange[]> { return this._visibleRanges; }
|
|
175
|
-
|
|
176
|
-
private readonly _languageId: ISettableObservable<LanguageId>;
|
|
177
|
-
public get languageId(): IObservable<LanguageId> { return this._languageId; }
|
|
178
|
-
|
|
179
|
-
private readonly _version: ISettableObservable<number>;
|
|
180
|
-
public get version(): IObservable<number> { return this._version; }
|
|
181
|
-
|
|
182
|
-
private readonly _diagnostics: ISettableObservable<readonly DiagnosticData[]>;
|
|
183
|
-
public get diagnostics(): IObservable<readonly DiagnosticData[]> { return this._diagnostics; }
|
|
184
|
-
|
|
185
|
-
constructor(
|
|
186
|
-
public readonly id: DocumentId,
|
|
187
|
-
value: StringText,
|
|
188
|
-
selection: readonly OffsetRange[],
|
|
189
|
-
languageId: LanguageId,
|
|
190
|
-
onDispose: () => void,
|
|
191
|
-
versionId: number,
|
|
192
|
-
public readonly workspaceRoot: URI | undefined,
|
|
193
|
-
) {
|
|
194
|
-
super();
|
|
195
|
-
|
|
196
|
-
this._value = observableValue(this, value);
|
|
197
|
-
this._selection = observableValue(this, selection);
|
|
198
|
-
this._visibleRanges = observableValue(this, []);
|
|
199
|
-
this._languageId = observableValue(this, languageId);
|
|
200
|
-
this._version = observableValue(this, versionId);
|
|
201
|
-
this._diagnostics = observableValue(this, []);
|
|
202
|
-
|
|
203
|
-
this._register(toDisposable(onDispose));
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
setSelection(selection: readonly OffsetRange[], tx: ITransaction | undefined = undefined): void {
|
|
207
|
-
this._selection.set(selection, tx);
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
setVisibleRange(visibleRanges: readonly OffsetRange[], tx: ITransaction | undefined = undefined): void {
|
|
211
|
-
this._visibleRanges.set(visibleRanges, tx);
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
applyEdit(edit: StringEdit | StringEditWithReason, tx: ITransaction | undefined = undefined, newVersion: number | undefined = undefined): void {
|
|
215
|
-
const newValue = edit.applyOnText(this.value.get());
|
|
216
|
-
const e = edit instanceof StringEditWithReason ? edit : new StringEditWithReason(edit.replacements, EditReason.unknown);
|
|
217
|
-
subtransaction(tx, tx => {
|
|
218
|
-
this._value.set(newValue, tx, e);
|
|
219
|
-
this._version.set(newVersion ?? this._version.get() + 1, tx);
|
|
220
|
-
});
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
updateSelection(selection: readonly OffsetRange[], tx: ITransaction | undefined = undefined): void {
|
|
224
|
-
this._selection.set(selection, tx);
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
setValue(value: StringText, tx: ITransaction | undefined = undefined, newVersion: number | undefined = undefined): void {
|
|
228
|
-
const reason = EditReason.unknown;
|
|
229
|
-
const e = new StringEditWithReason([StringReplacement.replace(new OffsetRange(0, this.value.get().value.length), value.value)], reason);
|
|
230
|
-
subtransaction(tx, tx => {
|
|
231
|
-
this._value.set(value, tx, e);
|
|
232
|
-
this._version.set(newVersion ?? this._version.get() + 1, tx);
|
|
233
|
-
});
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
updateDiagnostics(diagnostics: readonly DiagnosticData[], tx: ITransaction | undefined = undefined): void {
|
|
237
|
-
this._diagnostics.set(diagnostics, tx);
|
|
238
|
-
}
|
|
239
|
-
}
|
|
@@ -1,249 +0,0 @@
|
|
|
1
|
-
/*---------------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
4
|
-
*--------------------------------------------------------------------------------------------*/
|
|
5
|
-
import { AsyncIterableObject } from '../../../util/vs/base/common/async';
|
|
6
|
-
import { illegalArgument } from '../../../util/vs/base/common/errors';
|
|
7
|
-
import { LineReplacement } from '../../../util/vs/editor/common/core/edits/lineEdit';
|
|
8
|
-
import { LineRange } from '../../../util/vs/editor/common/core/ranges/lineRange';
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
export namespace ResponseProcessor {
|
|
12
|
-
|
|
13
|
-
export type DiffParams = {
|
|
14
|
-
/**
|
|
15
|
-
* Whether to emit a fast cursor line change event.
|
|
16
|
-
* Defaults to false.
|
|
17
|
-
*/
|
|
18
|
-
readonly emitFastCursorLineChange: boolean;
|
|
19
|
-
readonly nSignificantLinesToConverge: number;
|
|
20
|
-
readonly nLinesToConverge: number;
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
export const DEFAULT_DIFF_PARAMS: DiffParams = {
|
|
24
|
-
emitFastCursorLineChange: false,
|
|
25
|
-
nSignificantLinesToConverge: 2,
|
|
26
|
-
nLinesToConverge: 3,
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
type DivergenceState =
|
|
30
|
-
| { k: 'aligned' }
|
|
31
|
-
| {
|
|
32
|
-
k: 'diverged';
|
|
33
|
-
startLineIdx: number;
|
|
34
|
-
newLines: string[];
|
|
35
|
-
convergenceCandidates?: number[];
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
*
|
|
40
|
-
* @param originalLines
|
|
41
|
-
* @param modifiedLines
|
|
42
|
-
* @param cursorOriginalLinesOffset offset of cursor within original lines
|
|
43
|
-
*/
|
|
44
|
-
export async function* diff(originalLines: string[], modifiedLines: AsyncIterableObject<string>, cursorOriginalLinesOffset: number, params: DiffParams): AsyncIterable<LineReplacement> {
|
|
45
|
-
|
|
46
|
-
const lineToIdxs = new ArrayMap<string, number>();
|
|
47
|
-
for (const [i, line] of originalLines.entries()) {
|
|
48
|
-
lineToIdxs.add(line, i);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
let editWindowIdx = 0;
|
|
52
|
-
let updatedEditWindowIdx = -1;
|
|
53
|
-
|
|
54
|
-
let state: DivergenceState = { k: 'aligned' };
|
|
55
|
-
|
|
56
|
-
for await (const line of modifiedLines) {
|
|
57
|
-
++updatedEditWindowIdx;
|
|
58
|
-
|
|
59
|
-
// handle modifiedLines.length > originalLines.length
|
|
60
|
-
if (editWindowIdx >= originalLines.length) {
|
|
61
|
-
switch (state.k) {
|
|
62
|
-
case 'aligned': {
|
|
63
|
-
state = { k: 'diverged', startLineIdx: editWindowIdx, newLines: [line] };
|
|
64
|
-
break;
|
|
65
|
-
}
|
|
66
|
-
case 'diverged': {
|
|
67
|
-
state.newLines.push(line);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
continue;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
if (state.k === 'aligned') {
|
|
74
|
-
if (originalLines[editWindowIdx] === line) { // if line is the same as in originalLines, skip over it
|
|
75
|
-
++editWindowIdx;
|
|
76
|
-
continue;
|
|
77
|
-
}
|
|
78
|
-
state = { k: 'diverged', startLineIdx: editWindowIdx, newLines: [] };
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
state.newLines.push(line);
|
|
82
|
-
|
|
83
|
-
const convergenceResult = checkForConvergence(
|
|
84
|
-
originalLines,
|
|
85
|
-
cursorOriginalLinesOffset,
|
|
86
|
-
lineToIdxs,
|
|
87
|
-
state,
|
|
88
|
-
editWindowIdx,
|
|
89
|
-
params,
|
|
90
|
-
);
|
|
91
|
-
|
|
92
|
-
if (convergenceResult) {
|
|
93
|
-
yield convergenceResult.singleLineEdit;
|
|
94
|
-
editWindowIdx = convergenceResult.convergenceEndIdx;
|
|
95
|
-
state = { k: 'aligned' };
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
switch (state.k) {
|
|
100
|
-
case 'diverged': {
|
|
101
|
-
const lineRange = new LineRange(state.startLineIdx + 1, originalLines.length + 1);
|
|
102
|
-
yield new LineReplacement(lineRange, state.newLines);
|
|
103
|
-
break;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
case 'aligned': {
|
|
107
|
-
if (editWindowIdx < originalLines.length) {
|
|
108
|
-
const lineRange = new LineRange(editWindowIdx + 1, originalLines.length + 1);
|
|
109
|
-
yield new LineReplacement(lineRange, []);
|
|
110
|
-
}
|
|
111
|
-
break;
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
function isSignificant(s: string) {
|
|
117
|
-
return !!s.match(/[a-zA-Z1-9]+/);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
function checkForConvergence(
|
|
121
|
-
originalLines: string[],
|
|
122
|
-
cursorOriginalLinesOffset: number,
|
|
123
|
-
lineToIndexes: ArrayMap<string, number>,
|
|
124
|
-
state: DivergenceState & { k: 'diverged' },
|
|
125
|
-
editWindowIdx: number,
|
|
126
|
-
params: DiffParams,
|
|
127
|
-
): undefined | {
|
|
128
|
-
singleLineEdit: LineReplacement;
|
|
129
|
-
convergenceEndIdx: number;
|
|
130
|
-
} {
|
|
131
|
-
if (state.newLines.length === 0) {
|
|
132
|
-
throw illegalArgument('Cannot check for convergence without new lines');
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
let newLinesIdx = state.newLines.length - 1;
|
|
136
|
-
let candidates = lineToIndexes.get(state.newLines[newLinesIdx]).map((idx): [number, number] => [idx, idx]);
|
|
137
|
-
|
|
138
|
-
if (candidates.length === 0) {
|
|
139
|
-
if (!params.emitFastCursorLineChange ||
|
|
140
|
-
editWindowIdx !== cursorOriginalLinesOffset || state.newLines.length > 1
|
|
141
|
-
) {
|
|
142
|
-
return;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
// we detected that line with the cursor has changed, so we immediately emit an edit for it
|
|
146
|
-
const zeroBasedLineRange = [editWindowIdx, editWindowIdx + 1];
|
|
147
|
-
const lineRange = new LineRange(zeroBasedLineRange[0] + 1, zeroBasedLineRange[1] + 1);
|
|
148
|
-
return {
|
|
149
|
-
singleLineEdit: new LineReplacement(lineRange, state.newLines),
|
|
150
|
-
convergenceEndIdx: editWindowIdx + 1,
|
|
151
|
-
};
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
// we don't have enough lines even for significant-lines convergence which's less than non-significant
|
|
155
|
-
if (state.newLines.length < params.nSignificantLinesToConverge) {
|
|
156
|
-
return;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
let nNonSigMatches = 1;
|
|
160
|
-
let nSigMatches = isSignificant(state.newLines[newLinesIdx]) ? 1 : 0;
|
|
161
|
-
--newLinesIdx;
|
|
162
|
-
|
|
163
|
-
let result: 'found_matches' | 'found_significant_matches' | undefined;
|
|
164
|
-
let match: [number, number] = candidates[0];
|
|
165
|
-
|
|
166
|
-
// if several lines are being just replaced and we found a convergence right after, we want to treat this as a significant match
|
|
167
|
-
// original | modified
|
|
168
|
-
// a | a
|
|
169
|
-
// b | b'
|
|
170
|
-
// c | c'
|
|
171
|
-
// d | d <-- match here should allow convergence
|
|
172
|
-
// e | e
|
|
173
|
-
if (nNonSigMatches > 0 && (match[0] - state.startLineIdx) === state.newLines.length - 1 /* to discount for converging line */) {
|
|
174
|
-
result = 'found_significant_matches';
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
for (; newLinesIdx >= 0; --newLinesIdx) {
|
|
178
|
-
candidates = candidates.map(([convEndIdx, convIdx]): [number, number] => [convEndIdx, convIdx - 1]);
|
|
179
|
-
candidates = candidates.filter(([_, currentIdx]) => currentIdx >= 0 && editWindowIdx <= currentIdx);
|
|
180
|
-
candidates = candidates.filter(([_, currentIdx]) => originalLines[currentIdx] === state.newLines[newLinesIdx]);
|
|
181
|
-
|
|
182
|
-
// count in matches for current batch
|
|
183
|
-
if (candidates.length === 0) {
|
|
184
|
-
break;
|
|
185
|
-
} else {
|
|
186
|
-
++nNonSigMatches;
|
|
187
|
-
if (isSignificant(state.newLines[newLinesIdx])) {
|
|
188
|
-
++nSigMatches;
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
if (nSigMatches === params.nSignificantLinesToConverge) {
|
|
192
|
-
result = 'found_significant_matches';
|
|
193
|
-
match = candidates[0];
|
|
194
|
-
}
|
|
195
|
-
if (nNonSigMatches === params.nLinesToConverge) {
|
|
196
|
-
result = 'found_matches';
|
|
197
|
-
match = candidates[0];
|
|
198
|
-
break;
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
if (!result) {
|
|
203
|
-
return;
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
const originalLinesConvIdx = match[1];
|
|
207
|
-
const originalLinesConvEndIdx = match[0];
|
|
208
|
-
const nLinesToConverge = originalLinesConvEndIdx - originalLinesConvIdx + 1;
|
|
209
|
-
|
|
210
|
-
const nLinesRemoved = originalLinesConvIdx - state.startLineIdx;
|
|
211
|
-
const linesInserted = state.newLines.slice(0, state.newLines.length - nLinesToConverge);
|
|
212
|
-
const nLinesInserted = linesInserted.length;
|
|
213
|
-
if (nLinesRemoved - nLinesInserted > 1 && nLinesInserted > 0) {
|
|
214
|
-
return;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
const zeroBasedLineRange: [startLineOffset: number, endLineOffset: number] = [state.startLineIdx, originalLinesConvIdx];
|
|
218
|
-
const lineRange = new LineRange(zeroBasedLineRange[0] + 1, zeroBasedLineRange[1] + 1);
|
|
219
|
-
const singleLineEdit = new LineReplacement(lineRange, linesInserted);
|
|
220
|
-
return {
|
|
221
|
-
singleLineEdit,
|
|
222
|
-
convergenceEndIdx: originalLinesConvEndIdx + 1,
|
|
223
|
-
};
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
export class ArrayMap<K, V> {
|
|
228
|
-
private map = new Map<K, V[]>();
|
|
229
|
-
|
|
230
|
-
/**
|
|
231
|
-
* Appends a value to the array of values for the given key.
|
|
232
|
-
*/
|
|
233
|
-
add(key: K, value: V): void {
|
|
234
|
-
const values = this.map.get(key);
|
|
235
|
-
if (values) {
|
|
236
|
-
values.push(value);
|
|
237
|
-
} else {
|
|
238
|
-
this.map.set(key, [value]);
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
/**
|
|
243
|
-
* Gets the array of values for the given key.
|
|
244
|
-
* Returns an empty array if the key does not exist.
|
|
245
|
-
*/
|
|
246
|
-
get(key: K): V[] {
|
|
247
|
-
return this.map.get(key) || [];
|
|
248
|
-
}
|
|
249
|
-
}
|