@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,210 +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 { forEachAdjacent } from '../../../../../base/common/arrays';
|
|
9
|
-
import { BugIndicatingError } from '../../../../../base/common/errors';
|
|
10
|
-
import { OffsetRange } from '../../../core/ranges/offsetRange';
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Represents a synchronous diff algorithm. Should be executed in a worker.
|
|
14
|
-
*/
|
|
15
|
-
export interface IDiffAlgorithm {
|
|
16
|
-
compute(sequence1: ISequence, sequence2: ISequence, timeout?: ITimeout): DiffAlgorithmResult;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export class DiffAlgorithmResult {
|
|
20
|
-
static trivial(seq1: ISequence, seq2: ISequence): DiffAlgorithmResult {
|
|
21
|
-
return new DiffAlgorithmResult([new SequenceDiff(OffsetRange.ofLength(seq1.length), OffsetRange.ofLength(seq2.length))], false);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
static trivialTimedOut(seq1: ISequence, seq2: ISequence): DiffAlgorithmResult {
|
|
25
|
-
return new DiffAlgorithmResult([new SequenceDiff(OffsetRange.ofLength(seq1.length), OffsetRange.ofLength(seq2.length))], true);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
constructor(
|
|
29
|
-
public readonly diffs: SequenceDiff[],
|
|
30
|
-
/**
|
|
31
|
-
* Indicates if the time out was reached.
|
|
32
|
-
* In that case, the diffs might be an approximation and the user should be asked to rerun the diff with more time.
|
|
33
|
-
*/
|
|
34
|
-
public readonly hitTimeout: boolean,
|
|
35
|
-
) { }
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export class SequenceDiff {
|
|
39
|
-
public static invert(sequenceDiffs: SequenceDiff[], doc1Length: number): SequenceDiff[] {
|
|
40
|
-
const result: SequenceDiff[] = [];
|
|
41
|
-
forEachAdjacent(sequenceDiffs, (a, b) => {
|
|
42
|
-
result.push(SequenceDiff.fromOffsetPairs(
|
|
43
|
-
a ? a.getEndExclusives() : OffsetPair.zero,
|
|
44
|
-
b ? b.getStarts() : new OffsetPair(doc1Length, (a ? a.seq2Range.endExclusive - a.seq1Range.endExclusive : 0) + doc1Length)
|
|
45
|
-
));
|
|
46
|
-
});
|
|
47
|
-
return result;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
public static fromOffsetPairs(start: OffsetPair, endExclusive: OffsetPair): SequenceDiff {
|
|
51
|
-
return new SequenceDiff(
|
|
52
|
-
new OffsetRange(start.offset1, endExclusive.offset1),
|
|
53
|
-
new OffsetRange(start.offset2, endExclusive.offset2),
|
|
54
|
-
);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
public static assertSorted(sequenceDiffs: SequenceDiff[]): void {
|
|
58
|
-
let last: SequenceDiff | undefined = undefined;
|
|
59
|
-
for (const cur of sequenceDiffs) {
|
|
60
|
-
if (last) {
|
|
61
|
-
if (!(last.seq1Range.endExclusive <= cur.seq1Range.start && last.seq2Range.endExclusive <= cur.seq2Range.start)) {
|
|
62
|
-
throw new BugIndicatingError('Sequence diffs must be sorted');
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
last = cur;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
constructor(
|
|
70
|
-
public readonly seq1Range: OffsetRange,
|
|
71
|
-
public readonly seq2Range: OffsetRange,
|
|
72
|
-
) { }
|
|
73
|
-
|
|
74
|
-
public swap(): SequenceDiff {
|
|
75
|
-
return new SequenceDiff(this.seq2Range, this.seq1Range);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
public toString(): string {
|
|
79
|
-
return `${this.seq1Range} <-> ${this.seq2Range}`;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
public join(other: SequenceDiff): SequenceDiff {
|
|
83
|
-
return new SequenceDiff(this.seq1Range.join(other.seq1Range), this.seq2Range.join(other.seq2Range));
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
public delta(offset: number): SequenceDiff {
|
|
87
|
-
if (offset === 0) {
|
|
88
|
-
return this;
|
|
89
|
-
}
|
|
90
|
-
return new SequenceDiff(this.seq1Range.delta(offset), this.seq2Range.delta(offset));
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
public deltaStart(offset: number): SequenceDiff {
|
|
94
|
-
if (offset === 0) {
|
|
95
|
-
return this;
|
|
96
|
-
}
|
|
97
|
-
return new SequenceDiff(this.seq1Range.deltaStart(offset), this.seq2Range.deltaStart(offset));
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
public deltaEnd(offset: number): SequenceDiff {
|
|
101
|
-
if (offset === 0) {
|
|
102
|
-
return this;
|
|
103
|
-
}
|
|
104
|
-
return new SequenceDiff(this.seq1Range.deltaEnd(offset), this.seq2Range.deltaEnd(offset));
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
public intersectsOrTouches(other: SequenceDiff): boolean {
|
|
108
|
-
return this.seq1Range.intersectsOrTouches(other.seq1Range) || this.seq2Range.intersectsOrTouches(other.seq2Range);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
public intersect(other: SequenceDiff): SequenceDiff | undefined {
|
|
112
|
-
const i1 = this.seq1Range.intersect(other.seq1Range);
|
|
113
|
-
const i2 = this.seq2Range.intersect(other.seq2Range);
|
|
114
|
-
if (!i1 || !i2) {
|
|
115
|
-
return undefined;
|
|
116
|
-
}
|
|
117
|
-
return new SequenceDiff(i1, i2);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
public getStarts(): OffsetPair {
|
|
121
|
-
return new OffsetPair(this.seq1Range.start, this.seq2Range.start);
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
public getEndExclusives(): OffsetPair {
|
|
125
|
-
return new OffsetPair(this.seq1Range.endExclusive, this.seq2Range.endExclusive);
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
export class OffsetPair {
|
|
130
|
-
public static readonly zero = new OffsetPair(0, 0);
|
|
131
|
-
public static readonly max = new OffsetPair(Number.MAX_SAFE_INTEGER, Number.MAX_SAFE_INTEGER);
|
|
132
|
-
|
|
133
|
-
constructor(
|
|
134
|
-
public readonly offset1: number,
|
|
135
|
-
public readonly offset2: number,
|
|
136
|
-
) {
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
public toString(): string {
|
|
140
|
-
return `${this.offset1} <-> ${this.offset2}`;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
public delta(offset: number): OffsetPair {
|
|
144
|
-
if (offset === 0) {
|
|
145
|
-
return this;
|
|
146
|
-
}
|
|
147
|
-
return new OffsetPair(this.offset1 + offset, this.offset2 + offset);
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
public equals(other: OffsetPair): boolean {
|
|
151
|
-
return this.offset1 === other.offset1 && this.offset2 === other.offset2;
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
export interface ISequence {
|
|
156
|
-
getElement(offset: number): number;
|
|
157
|
-
get length(): number;
|
|
158
|
-
|
|
159
|
-
/**
|
|
160
|
-
* The higher the score, the better that offset can be used to split the sequence.
|
|
161
|
-
* Is used to optimize insertions.
|
|
162
|
-
* Must not be negative.
|
|
163
|
-
*/
|
|
164
|
-
getBoundaryScore?(length: number): number;
|
|
165
|
-
|
|
166
|
-
/**
|
|
167
|
-
* For line sequences, getElement returns a number representing trimmed lines.
|
|
168
|
-
* This however checks equality for the original lines.
|
|
169
|
-
* It prevents shifting to less matching lines.
|
|
170
|
-
*/
|
|
171
|
-
isStronglyEqual(offset1: number, offset2: number): boolean;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
export interface ITimeout {
|
|
175
|
-
isValid(): boolean;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
export class InfiniteTimeout implements ITimeout {
|
|
179
|
-
public static instance = new InfiniteTimeout();
|
|
180
|
-
|
|
181
|
-
isValid(): boolean {
|
|
182
|
-
return true;
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
export class DateTimeout implements ITimeout {
|
|
187
|
-
private readonly startTime = Date.now();
|
|
188
|
-
private valid = true;
|
|
189
|
-
|
|
190
|
-
constructor(private timeout: number) {
|
|
191
|
-
if (timeout <= 0) {
|
|
192
|
-
throw new BugIndicatingError('timeout must be positive');
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
// Recommendation: Set a log-point `{this.disable()}` in the body
|
|
197
|
-
public isValid(): boolean {
|
|
198
|
-
const valid = Date.now() - this.startTime < this.timeout;
|
|
199
|
-
if (!valid && this.valid) {
|
|
200
|
-
this.valid = false; // timeout reached
|
|
201
|
-
}
|
|
202
|
-
return this.valid;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
public disable() {
|
|
206
|
-
this.timeout = Number.MAX_SAFE_INTEGER;
|
|
207
|
-
this.isValid = () => true;
|
|
208
|
-
this.valid = true;
|
|
209
|
-
}
|
|
210
|
-
}
|
|
@@ -1,109 +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 { OffsetRange } from '../../../core/ranges/offsetRange';
|
|
9
|
-
import { IDiffAlgorithm, SequenceDiff, ISequence, ITimeout, InfiniteTimeout, DiffAlgorithmResult } from './diffAlgorithm';
|
|
10
|
-
import { Array2D } from '../utils';
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* A O(MN) diffing algorithm that supports a score function.
|
|
14
|
-
* The algorithm can be improved by processing the 2d array diagonally.
|
|
15
|
-
*/
|
|
16
|
-
export class DynamicProgrammingDiffing implements IDiffAlgorithm {
|
|
17
|
-
compute(sequence1: ISequence, sequence2: ISequence, timeout: ITimeout = InfiniteTimeout.instance, equalityScore?: (offset1: number, offset2: number) => number): DiffAlgorithmResult {
|
|
18
|
-
if (sequence1.length === 0 || sequence2.length === 0) {
|
|
19
|
-
return DiffAlgorithmResult.trivial(sequence1, sequence2);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* lcsLengths.get(i, j): Length of the longest common subsequence of sequence1.substring(0, i + 1) and sequence2.substring(0, j + 1).
|
|
24
|
-
*/
|
|
25
|
-
const lcsLengths = new Array2D<number>(sequence1.length, sequence2.length);
|
|
26
|
-
const directions = new Array2D<number>(sequence1.length, sequence2.length);
|
|
27
|
-
const lengths = new Array2D<number>(sequence1.length, sequence2.length);
|
|
28
|
-
|
|
29
|
-
// ==== Initializing lcsLengths ====
|
|
30
|
-
for (let s1 = 0; s1 < sequence1.length; s1++) {
|
|
31
|
-
for (let s2 = 0; s2 < sequence2.length; s2++) {
|
|
32
|
-
if (!timeout.isValid()) {
|
|
33
|
-
return DiffAlgorithmResult.trivialTimedOut(sequence1, sequence2);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const horizontalLen = s1 === 0 ? 0 : lcsLengths.get(s1 - 1, s2);
|
|
37
|
-
const verticalLen = s2 === 0 ? 0 : lcsLengths.get(s1, s2 - 1);
|
|
38
|
-
|
|
39
|
-
let extendedSeqScore: number;
|
|
40
|
-
if (sequence1.getElement(s1) === sequence2.getElement(s2)) {
|
|
41
|
-
if (s1 === 0 || s2 === 0) {
|
|
42
|
-
extendedSeqScore = 0;
|
|
43
|
-
} else {
|
|
44
|
-
extendedSeqScore = lcsLengths.get(s1 - 1, s2 - 1);
|
|
45
|
-
}
|
|
46
|
-
if (s1 > 0 && s2 > 0 && directions.get(s1 - 1, s2 - 1) === 3) {
|
|
47
|
-
// Prefer consecutive diagonals
|
|
48
|
-
extendedSeqScore += lengths.get(s1 - 1, s2 - 1);
|
|
49
|
-
}
|
|
50
|
-
extendedSeqScore += (equalityScore ? equalityScore(s1, s2) : 1);
|
|
51
|
-
} else {
|
|
52
|
-
extendedSeqScore = -1;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
const newValue = Math.max(horizontalLen, verticalLen, extendedSeqScore);
|
|
56
|
-
|
|
57
|
-
if (newValue === extendedSeqScore) {
|
|
58
|
-
// Prefer diagonals
|
|
59
|
-
const prevLen = s1 > 0 && s2 > 0 ? lengths.get(s1 - 1, s2 - 1) : 0;
|
|
60
|
-
lengths.set(s1, s2, prevLen + 1);
|
|
61
|
-
directions.set(s1, s2, 3);
|
|
62
|
-
} else if (newValue === horizontalLen) {
|
|
63
|
-
lengths.set(s1, s2, 0);
|
|
64
|
-
directions.set(s1, s2, 1);
|
|
65
|
-
} else if (newValue === verticalLen) {
|
|
66
|
-
lengths.set(s1, s2, 0);
|
|
67
|
-
directions.set(s1, s2, 2);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
lcsLengths.set(s1, s2, newValue);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
// ==== Backtracking ====
|
|
75
|
-
const result: SequenceDiff[] = [];
|
|
76
|
-
let lastAligningPosS1: number = sequence1.length;
|
|
77
|
-
let lastAligningPosS2: number = sequence2.length;
|
|
78
|
-
|
|
79
|
-
function reportDecreasingAligningPositions(s1: number, s2: number): void {
|
|
80
|
-
if (s1 + 1 !== lastAligningPosS1 || s2 + 1 !== lastAligningPosS2) {
|
|
81
|
-
result.push(new SequenceDiff(
|
|
82
|
-
new OffsetRange(s1 + 1, lastAligningPosS1),
|
|
83
|
-
new OffsetRange(s2 + 1, lastAligningPosS2),
|
|
84
|
-
));
|
|
85
|
-
}
|
|
86
|
-
lastAligningPosS1 = s1;
|
|
87
|
-
lastAligningPosS2 = s2;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
let s1 = sequence1.length - 1;
|
|
91
|
-
let s2 = sequence2.length - 1;
|
|
92
|
-
while (s1 >= 0 && s2 >= 0) {
|
|
93
|
-
if (directions.get(s1, s2) === 3) {
|
|
94
|
-
reportDecreasingAligningPositions(s1, s2);
|
|
95
|
-
s1--;
|
|
96
|
-
s2--;
|
|
97
|
-
} else {
|
|
98
|
-
if (directions.get(s1, s2) === 1) {
|
|
99
|
-
s1--;
|
|
100
|
-
} else {
|
|
101
|
-
s2--;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
reportDecreasingAligningPositions(-1, -1);
|
|
106
|
-
result.reverse();
|
|
107
|
-
return new DiffAlgorithmResult(result, false);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
@@ -1,178 +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 { OffsetRange } from '../../../core/ranges/offsetRange';
|
|
9
|
-
import { DiffAlgorithmResult, IDiffAlgorithm, ISequence, ITimeout, InfiniteTimeout, SequenceDiff } from './diffAlgorithm';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* An O(ND) diff algorithm that has a quadratic space worst-case complexity.
|
|
13
|
-
*/
|
|
14
|
-
export class MyersDiffAlgorithm implements IDiffAlgorithm {
|
|
15
|
-
compute(seq1: ISequence, seq2: ISequence, timeout: ITimeout = InfiniteTimeout.instance): DiffAlgorithmResult {
|
|
16
|
-
// These are common special cases.
|
|
17
|
-
// The early return improves performance dramatically.
|
|
18
|
-
if (seq1.length === 0 || seq2.length === 0) {
|
|
19
|
-
return DiffAlgorithmResult.trivial(seq1, seq2);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const seqX = seq1; // Text on the x axis
|
|
23
|
-
const seqY = seq2; // Text on the y axis
|
|
24
|
-
|
|
25
|
-
function getXAfterSnake(x: number, y: number): number {
|
|
26
|
-
while (x < seqX.length && y < seqY.length && seqX.getElement(x) === seqY.getElement(y)) {
|
|
27
|
-
x++;
|
|
28
|
-
y++;
|
|
29
|
-
}
|
|
30
|
-
return x;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
let d = 0;
|
|
34
|
-
// V[k]: X value of longest d-line that ends in diagonal k.
|
|
35
|
-
// d-line: path from (0,0) to (x,y) that uses exactly d non-diagonals.
|
|
36
|
-
// diagonal k: Set of points (x,y) with x-y = k.
|
|
37
|
-
// k=1 -> (1,0),(2,1)
|
|
38
|
-
const V = new FastInt32Array();
|
|
39
|
-
V.set(0, getXAfterSnake(0, 0));
|
|
40
|
-
|
|
41
|
-
const paths = new FastArrayNegativeIndices<SnakePath | null>();
|
|
42
|
-
paths.set(0, V.get(0) === 0 ? null : new SnakePath(null, 0, 0, V.get(0)));
|
|
43
|
-
|
|
44
|
-
let k = 0;
|
|
45
|
-
|
|
46
|
-
loop: while (true) {
|
|
47
|
-
d++;
|
|
48
|
-
if (!timeout.isValid()) {
|
|
49
|
-
return DiffAlgorithmResult.trivialTimedOut(seqX, seqY);
|
|
50
|
-
}
|
|
51
|
-
// The paper has `for (k = -d; k <= d; k += 2)`, but we can ignore diagonals that cannot influence the result.
|
|
52
|
-
const lowerBound = -Math.min(d, seqY.length + (d % 2));
|
|
53
|
-
const upperBound = Math.min(d, seqX.length + (d % 2));
|
|
54
|
-
for (k = lowerBound; k <= upperBound; k += 2) {
|
|
55
|
-
let step = 0;
|
|
56
|
-
// We can use the X values of (d-1)-lines to compute X value of the longest d-lines.
|
|
57
|
-
const maxXofDLineTop = k === upperBound ? -1 : V.get(k + 1); // We take a vertical non-diagonal (add a symbol in seqX)
|
|
58
|
-
const maxXofDLineLeft = k === lowerBound ? -1 : V.get(k - 1) + 1; // We take a horizontal non-diagonal (+1 x) (delete a symbol in seqX)
|
|
59
|
-
step++;
|
|
60
|
-
const x = Math.min(Math.max(maxXofDLineTop, maxXofDLineLeft), seqX.length);
|
|
61
|
-
const y = x - k;
|
|
62
|
-
step++;
|
|
63
|
-
if (x > seqX.length || y > seqY.length) {
|
|
64
|
-
// This diagonal is irrelevant for the result.
|
|
65
|
-
// TODO: Don't pay the cost for this in the next iteration.
|
|
66
|
-
continue;
|
|
67
|
-
}
|
|
68
|
-
const newMaxX = getXAfterSnake(x, y);
|
|
69
|
-
V.set(k, newMaxX);
|
|
70
|
-
const lastPath = x === maxXofDLineTop ? paths.get(k + 1) : paths.get(k - 1);
|
|
71
|
-
paths.set(k, newMaxX !== x ? new SnakePath(lastPath, x, y, newMaxX - x) : lastPath);
|
|
72
|
-
|
|
73
|
-
if (V.get(k) === seqX.length && V.get(k) - k === seqY.length) {
|
|
74
|
-
break loop;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
let path = paths.get(k);
|
|
80
|
-
const result: SequenceDiff[] = [];
|
|
81
|
-
let lastAligningPosS1: number = seqX.length;
|
|
82
|
-
let lastAligningPosS2: number = seqY.length;
|
|
83
|
-
|
|
84
|
-
while (true) {
|
|
85
|
-
const endX = path ? path.x + path.length : 0;
|
|
86
|
-
const endY = path ? path.y + path.length : 0;
|
|
87
|
-
|
|
88
|
-
if (endX !== lastAligningPosS1 || endY !== lastAligningPosS2) {
|
|
89
|
-
result.push(new SequenceDiff(
|
|
90
|
-
new OffsetRange(endX, lastAligningPosS1),
|
|
91
|
-
new OffsetRange(endY, lastAligningPosS2),
|
|
92
|
-
));
|
|
93
|
-
}
|
|
94
|
-
if (!path) {
|
|
95
|
-
break;
|
|
96
|
-
}
|
|
97
|
-
lastAligningPosS1 = path.x;
|
|
98
|
-
lastAligningPosS2 = path.y;
|
|
99
|
-
|
|
100
|
-
path = path.prev;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
result.reverse();
|
|
104
|
-
return new DiffAlgorithmResult(result, false);
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
class SnakePath {
|
|
109
|
-
constructor(
|
|
110
|
-
public readonly prev: SnakePath | null,
|
|
111
|
-
public readonly x: number,
|
|
112
|
-
public readonly y: number,
|
|
113
|
-
public readonly length: number
|
|
114
|
-
) {
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* An array that supports fast negative indices.
|
|
120
|
-
*/
|
|
121
|
-
class FastInt32Array {
|
|
122
|
-
private positiveArr: Int32Array = new Int32Array(10);
|
|
123
|
-
private negativeArr: Int32Array = new Int32Array(10);
|
|
124
|
-
|
|
125
|
-
get(idx: number): number {
|
|
126
|
-
if (idx < 0) {
|
|
127
|
-
idx = -idx - 1;
|
|
128
|
-
return this.negativeArr[idx];
|
|
129
|
-
} else {
|
|
130
|
-
return this.positiveArr[idx];
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
set(idx: number, value: number): void {
|
|
135
|
-
if (idx < 0) {
|
|
136
|
-
idx = -idx - 1;
|
|
137
|
-
if (idx >= this.negativeArr.length) {
|
|
138
|
-
const arr = this.negativeArr;
|
|
139
|
-
this.negativeArr = new Int32Array(arr.length * 2);
|
|
140
|
-
this.negativeArr.set(arr);
|
|
141
|
-
}
|
|
142
|
-
this.negativeArr[idx] = value;
|
|
143
|
-
} else {
|
|
144
|
-
if (idx >= this.positiveArr.length) {
|
|
145
|
-
const arr = this.positiveArr;
|
|
146
|
-
this.positiveArr = new Int32Array(arr.length * 2);
|
|
147
|
-
this.positiveArr.set(arr);
|
|
148
|
-
}
|
|
149
|
-
this.positiveArr[idx] = value;
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
/**
|
|
155
|
-
* An array that supports fast negative indices.
|
|
156
|
-
*/
|
|
157
|
-
class FastArrayNegativeIndices<T> {
|
|
158
|
-
private readonly positiveArr: T[] = [];
|
|
159
|
-
private readonly negativeArr: T[] = [];
|
|
160
|
-
|
|
161
|
-
get(idx: number): T {
|
|
162
|
-
if (idx < 0) {
|
|
163
|
-
idx = -idx - 1;
|
|
164
|
-
return this.negativeArr[idx];
|
|
165
|
-
} else {
|
|
166
|
-
return this.positiveArr[idx];
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
set(idx: number, value: T): void {
|
|
171
|
-
if (idx < 0) {
|
|
172
|
-
idx = -idx - 1;
|
|
173
|
-
this.negativeArr[idx] = value;
|
|
174
|
-
} else {
|
|
175
|
-
this.positiveArr[idx] = value;
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
}
|