@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,61 +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 { DetailedLineRangeMapping, LineRangeMapping } from './rangeMapping';
|
|
9
|
-
|
|
10
|
-
export interface ILinesDiffComputer {
|
|
11
|
-
computeDiff(originalLines: string[], modifiedLines: string[], options: ILinesDiffComputerOptions): LinesDiff;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export interface ILinesDiffComputerOptions {
|
|
15
|
-
readonly ignoreTrimWhitespace: boolean;
|
|
16
|
-
readonly maxComputationTimeMs: number;
|
|
17
|
-
readonly computeMoves: boolean;
|
|
18
|
-
readonly extendToSubwords?: boolean;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export class LinesDiff {
|
|
22
|
-
constructor(
|
|
23
|
-
readonly changes: readonly DetailedLineRangeMapping[],
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Sorted by original line ranges.
|
|
27
|
-
* The original line ranges and the modified line ranges must be disjoint (but can be touching).
|
|
28
|
-
*/
|
|
29
|
-
readonly moves: readonly MovedText[],
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Indicates if the time out was reached.
|
|
33
|
-
* In that case, the diffs might be an approximation and the user should be asked to rerun the diff with more time.
|
|
34
|
-
*/
|
|
35
|
-
readonly hitTimeout: boolean,
|
|
36
|
-
) {
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export class MovedText {
|
|
41
|
-
public readonly lineRangeMapping: LineRangeMapping;
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* The diff from the original text to the moved text.
|
|
45
|
-
* Must be contained in the original/modified line range.
|
|
46
|
-
* Can be empty if the text didn't change (only moved).
|
|
47
|
-
*/
|
|
48
|
-
public readonly changes: readonly DetailedLineRangeMapping[];
|
|
49
|
-
|
|
50
|
-
constructor(
|
|
51
|
-
lineRangeMapping: LineRangeMapping,
|
|
52
|
-
changes: readonly DetailedLineRangeMapping[],
|
|
53
|
-
) {
|
|
54
|
-
this.lineRangeMapping = lineRangeMapping;
|
|
55
|
-
this.changes = changes;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
public flip(): MovedText {
|
|
59
|
-
return new MovedText(this.lineRangeMapping.flip(), this.changes.map(c => c.flip()));
|
|
60
|
-
}
|
|
61
|
-
}
|
|
@@ -1,418 +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 { groupAdjacentBy } from '../../../base/common/arrays';
|
|
9
|
-
import { assertFn, checkAdjacentItems } from '../../../base/common/assert';
|
|
10
|
-
import { BugIndicatingError } from '../../../base/common/errors';
|
|
11
|
-
import { LineRange } from '../core/ranges/lineRange';
|
|
12
|
-
import { Position } from '../core/position';
|
|
13
|
-
import { Range } from '../core/range';
|
|
14
|
-
import { TextReplacement, TextEdit } from '../core/edits/textEdit';
|
|
15
|
-
import { AbstractText } from '../core/text/abstractText';
|
|
16
|
-
import { IChange } from './legacyLinesDiffComputer';
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Maps a line range in the original text model to a line range in the modified text model.
|
|
20
|
-
*/
|
|
21
|
-
export class LineRangeMapping {
|
|
22
|
-
public static inverse(mapping: readonly LineRangeMapping[], originalLineCount: number, modifiedLineCount: number): LineRangeMapping[] {
|
|
23
|
-
const result: LineRangeMapping[] = [];
|
|
24
|
-
let lastOriginalEndLineNumber = 1;
|
|
25
|
-
let lastModifiedEndLineNumber = 1;
|
|
26
|
-
|
|
27
|
-
for (const m of mapping) {
|
|
28
|
-
const r = new LineRangeMapping(
|
|
29
|
-
new LineRange(lastOriginalEndLineNumber, m.original.startLineNumber),
|
|
30
|
-
new LineRange(lastModifiedEndLineNumber, m.modified.startLineNumber),
|
|
31
|
-
);
|
|
32
|
-
if (!r.modified.isEmpty) {
|
|
33
|
-
result.push(r);
|
|
34
|
-
}
|
|
35
|
-
lastOriginalEndLineNumber = m.original.endLineNumberExclusive;
|
|
36
|
-
lastModifiedEndLineNumber = m.modified.endLineNumberExclusive;
|
|
37
|
-
}
|
|
38
|
-
const r = new LineRangeMapping(
|
|
39
|
-
new LineRange(lastOriginalEndLineNumber, originalLineCount + 1),
|
|
40
|
-
new LineRange(lastModifiedEndLineNumber, modifiedLineCount + 1),
|
|
41
|
-
);
|
|
42
|
-
if (!r.modified.isEmpty) {
|
|
43
|
-
result.push(r);
|
|
44
|
-
}
|
|
45
|
-
return result;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
public static clip(mapping: readonly LineRangeMapping[], originalRange: LineRange, modifiedRange: LineRange): LineRangeMapping[] {
|
|
49
|
-
const result: LineRangeMapping[] = [];
|
|
50
|
-
for (const m of mapping) {
|
|
51
|
-
const original = m.original.intersect(originalRange);
|
|
52
|
-
const modified = m.modified.intersect(modifiedRange);
|
|
53
|
-
if (original && !original.isEmpty && modified && !modified.isEmpty) {
|
|
54
|
-
result.push(new LineRangeMapping(original, modified));
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
return result;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* The line range in the original text model.
|
|
62
|
-
*/
|
|
63
|
-
public readonly original: LineRange;
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* The line range in the modified text model.
|
|
67
|
-
*/
|
|
68
|
-
public readonly modified: LineRange;
|
|
69
|
-
|
|
70
|
-
constructor(
|
|
71
|
-
originalRange: LineRange,
|
|
72
|
-
modifiedRange: LineRange
|
|
73
|
-
) {
|
|
74
|
-
this.original = originalRange;
|
|
75
|
-
this.modified = modifiedRange;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
public toString(): string {
|
|
80
|
-
return `{${this.original.toString()}->${this.modified.toString()}}`;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
public flip(): LineRangeMapping {
|
|
84
|
-
return new LineRangeMapping(this.modified, this.original);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
public join(other: LineRangeMapping): LineRangeMapping {
|
|
88
|
-
return new LineRangeMapping(
|
|
89
|
-
this.original.join(other.original),
|
|
90
|
-
this.modified.join(other.modified)
|
|
91
|
-
);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
public get changedLineCount() {
|
|
95
|
-
return Math.max(this.original.length, this.modified.length);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* This method assumes that the LineRangeMapping describes a valid diff!
|
|
100
|
-
* I.e. if one range is empty, the other range cannot be the entire document.
|
|
101
|
-
* It avoids various problems when the line range points to non-existing line-numbers.
|
|
102
|
-
*/
|
|
103
|
-
public toRangeMapping(): RangeMapping {
|
|
104
|
-
const origInclusiveRange = this.original.toInclusiveRange();
|
|
105
|
-
const modInclusiveRange = this.modified.toInclusiveRange();
|
|
106
|
-
if (origInclusiveRange && modInclusiveRange) {
|
|
107
|
-
return new RangeMapping(origInclusiveRange, modInclusiveRange);
|
|
108
|
-
} else if (this.original.startLineNumber === 1 || this.modified.startLineNumber === 1) {
|
|
109
|
-
if (!(this.modified.startLineNumber === 1 && this.original.startLineNumber === 1)) {
|
|
110
|
-
// If one line range starts at 1, the other one must start at 1 as well.
|
|
111
|
-
throw new BugIndicatingError('not a valid diff');
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
// Because one range is empty and both ranges start at line 1, none of the ranges can cover all lines.
|
|
115
|
-
// Thus, `endLineNumberExclusive` is a valid line number.
|
|
116
|
-
return new RangeMapping(
|
|
117
|
-
new Range(this.original.startLineNumber, 1, this.original.endLineNumberExclusive, 1),
|
|
118
|
-
new Range(this.modified.startLineNumber, 1, this.modified.endLineNumberExclusive, 1),
|
|
119
|
-
);
|
|
120
|
-
} else {
|
|
121
|
-
// We can assume here that both startLineNumbers are greater than 1.
|
|
122
|
-
return new RangeMapping(
|
|
123
|
-
new Range(this.original.startLineNumber - 1, Number.MAX_SAFE_INTEGER, this.original.endLineNumberExclusive - 1, Number.MAX_SAFE_INTEGER),
|
|
124
|
-
new Range(this.modified.startLineNumber - 1, Number.MAX_SAFE_INTEGER, this.modified.endLineNumberExclusive - 1, Number.MAX_SAFE_INTEGER),
|
|
125
|
-
);
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* This method assumes that the LineRangeMapping describes a valid diff!
|
|
131
|
-
* I.e. if one range is empty, the other range cannot be the entire document.
|
|
132
|
-
* It avoids various problems when the line range points to non-existing line-numbers.
|
|
133
|
-
*/
|
|
134
|
-
public toRangeMapping2(original: string[], modified: string[]): RangeMapping {
|
|
135
|
-
if (isValidLineNumber(this.original.endLineNumberExclusive, original)
|
|
136
|
-
&& isValidLineNumber(this.modified.endLineNumberExclusive, modified)) {
|
|
137
|
-
return new RangeMapping(
|
|
138
|
-
new Range(this.original.startLineNumber, 1, this.original.endLineNumberExclusive, 1),
|
|
139
|
-
new Range(this.modified.startLineNumber, 1, this.modified.endLineNumberExclusive, 1),
|
|
140
|
-
);
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
if (!this.original.isEmpty && !this.modified.isEmpty) {
|
|
144
|
-
return new RangeMapping(
|
|
145
|
-
Range.fromPositions(
|
|
146
|
-
new Position(this.original.startLineNumber, 1),
|
|
147
|
-
normalizePosition(new Position(this.original.endLineNumberExclusive - 1, Number.MAX_SAFE_INTEGER), original)
|
|
148
|
-
),
|
|
149
|
-
Range.fromPositions(
|
|
150
|
-
new Position(this.modified.startLineNumber, 1),
|
|
151
|
-
normalizePosition(new Position(this.modified.endLineNumberExclusive - 1, Number.MAX_SAFE_INTEGER), modified)
|
|
152
|
-
),
|
|
153
|
-
);
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
if (this.original.startLineNumber > 1 && this.modified.startLineNumber > 1) {
|
|
157
|
-
return new RangeMapping(
|
|
158
|
-
Range.fromPositions(
|
|
159
|
-
normalizePosition(new Position(this.original.startLineNumber - 1, Number.MAX_SAFE_INTEGER), original),
|
|
160
|
-
normalizePosition(new Position(this.original.endLineNumberExclusive - 1, Number.MAX_SAFE_INTEGER), original)
|
|
161
|
-
),
|
|
162
|
-
Range.fromPositions(
|
|
163
|
-
normalizePosition(new Position(this.modified.startLineNumber - 1, Number.MAX_SAFE_INTEGER), modified),
|
|
164
|
-
normalizePosition(new Position(this.modified.endLineNumberExclusive - 1, Number.MAX_SAFE_INTEGER), modified)
|
|
165
|
-
),
|
|
166
|
-
);
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
// Situation now: one range is empty and one range touches the last line and one range starts at line 1.
|
|
170
|
-
// I don't think this can happen.
|
|
171
|
-
|
|
172
|
-
throw new BugIndicatingError();
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
function normalizePosition(position: Position, content: string[]): Position {
|
|
177
|
-
if (position.lineNumber < 1) {
|
|
178
|
-
return new Position(1, 1);
|
|
179
|
-
}
|
|
180
|
-
if (position.lineNumber > content.length) {
|
|
181
|
-
return new Position(content.length, content[content.length - 1].length + 1);
|
|
182
|
-
}
|
|
183
|
-
const line = content[position.lineNumber - 1];
|
|
184
|
-
if (position.column > line.length + 1) {
|
|
185
|
-
return new Position(position.lineNumber, line.length + 1);
|
|
186
|
-
}
|
|
187
|
-
return position;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
function isValidLineNumber(lineNumber: number, lines: string[]): boolean {
|
|
191
|
-
return lineNumber >= 1 && lineNumber <= lines.length;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
/**
|
|
195
|
-
* Maps a line range in the original text model to a line range in the modified text model.
|
|
196
|
-
* Also contains inner range mappings.
|
|
197
|
-
*/
|
|
198
|
-
export class DetailedLineRangeMapping extends LineRangeMapping {
|
|
199
|
-
public static toTextEdit(mapping: readonly DetailedLineRangeMapping[], modified: AbstractText): TextEdit {
|
|
200
|
-
const replacements: TextReplacement[] = [];
|
|
201
|
-
for (const m of mapping) {
|
|
202
|
-
for (const r of m.innerChanges ?? []) {
|
|
203
|
-
const replacement = r.toTextEdit(modified);
|
|
204
|
-
replacements.push(replacement);
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
return new TextEdit(replacements);
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
public static fromRangeMappings(rangeMappings: RangeMapping[]): DetailedLineRangeMapping {
|
|
211
|
-
const originalRange = LineRange.join(rangeMappings.map(r => LineRange.fromRangeInclusive(r.originalRange)));
|
|
212
|
-
const modifiedRange = LineRange.join(rangeMappings.map(r => LineRange.fromRangeInclusive(r.modifiedRange)));
|
|
213
|
-
return new DetailedLineRangeMapping(originalRange, modifiedRange, rangeMappings);
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
/**
|
|
217
|
-
* If inner changes have not been computed, this is set to undefined.
|
|
218
|
-
* Otherwise, it represents the character-level diff in this line range.
|
|
219
|
-
* The original range of each range mapping should be contained in the original line range (same for modified), exceptions are new-lines.
|
|
220
|
-
* Must not be an empty array.
|
|
221
|
-
*/
|
|
222
|
-
public readonly innerChanges: RangeMapping[] | undefined;
|
|
223
|
-
|
|
224
|
-
constructor(
|
|
225
|
-
originalRange: LineRange,
|
|
226
|
-
modifiedRange: LineRange,
|
|
227
|
-
innerChanges: RangeMapping[] | undefined
|
|
228
|
-
) {
|
|
229
|
-
super(originalRange, modifiedRange);
|
|
230
|
-
this.innerChanges = innerChanges;
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
public override flip(): DetailedLineRangeMapping {
|
|
234
|
-
return new DetailedLineRangeMapping(this.modified, this.original, this.innerChanges?.map(c => c.flip()));
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
public withInnerChangesFromLineRanges(): DetailedLineRangeMapping {
|
|
238
|
-
return new DetailedLineRangeMapping(this.original, this.modified, [this.toRangeMapping()]);
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
/**
|
|
243
|
-
* Maps a range in the original text model to a range in the modified text model.
|
|
244
|
-
*/
|
|
245
|
-
export class RangeMapping {
|
|
246
|
-
public static fromEdit(edit: TextEdit): RangeMapping[] {
|
|
247
|
-
const newRanges = edit.getNewRanges();
|
|
248
|
-
const result = edit.replacements.map((e, idx) => new RangeMapping(e.range, newRanges[idx]));
|
|
249
|
-
return result;
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
public static fromEditJoin(edit: TextEdit): RangeMapping {
|
|
253
|
-
const newRanges = edit.getNewRanges();
|
|
254
|
-
const result = edit.replacements.map((e, idx) => new RangeMapping(e.range, newRanges[idx]));
|
|
255
|
-
return RangeMapping.join(result);
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
public static join(rangeMappings: RangeMapping[]): RangeMapping {
|
|
259
|
-
if (rangeMappings.length === 0) {
|
|
260
|
-
throw new BugIndicatingError('Cannot join an empty list of range mappings');
|
|
261
|
-
}
|
|
262
|
-
let result = rangeMappings[0];
|
|
263
|
-
for (let i = 1; i < rangeMappings.length; i++) {
|
|
264
|
-
result = result.join(rangeMappings[i]);
|
|
265
|
-
}
|
|
266
|
-
return result;
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
public static assertSorted(rangeMappings: RangeMapping[]): void {
|
|
270
|
-
for (let i = 1; i < rangeMappings.length; i++) {
|
|
271
|
-
const previous = rangeMappings[i - 1];
|
|
272
|
-
const current = rangeMappings[i];
|
|
273
|
-
if (!(
|
|
274
|
-
previous.originalRange.getEndPosition().isBeforeOrEqual(current.originalRange.getStartPosition())
|
|
275
|
-
&& previous.modifiedRange.getEndPosition().isBeforeOrEqual(current.modifiedRange.getStartPosition())
|
|
276
|
-
)) {
|
|
277
|
-
throw new BugIndicatingError('Range mappings must be sorted');
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
/**
|
|
283
|
-
* The original range.
|
|
284
|
-
*/
|
|
285
|
-
readonly originalRange: Range;
|
|
286
|
-
|
|
287
|
-
/**
|
|
288
|
-
* The modified range.
|
|
289
|
-
*/
|
|
290
|
-
readonly modifiedRange: Range;
|
|
291
|
-
|
|
292
|
-
constructor(
|
|
293
|
-
originalRange: Range,
|
|
294
|
-
modifiedRange: Range
|
|
295
|
-
) {
|
|
296
|
-
this.originalRange = originalRange;
|
|
297
|
-
this.modifiedRange = modifiedRange;
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
public toString(): string {
|
|
301
|
-
return `{${this.originalRange.toString()}->${this.modifiedRange.toString()}}`;
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
public flip(): RangeMapping {
|
|
305
|
-
return new RangeMapping(this.modifiedRange, this.originalRange);
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
/**
|
|
309
|
-
* Creates a single text edit that describes the change from the original to the modified text.
|
|
310
|
-
*/
|
|
311
|
-
public toTextEdit(modified: AbstractText): TextReplacement {
|
|
312
|
-
const newText = modified.getValueOfRange(this.modifiedRange);
|
|
313
|
-
return new TextReplacement(this.originalRange, newText);
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
public join(other: RangeMapping): RangeMapping {
|
|
317
|
-
return new RangeMapping(
|
|
318
|
-
this.originalRange.plusRange(other.originalRange),
|
|
319
|
-
this.modifiedRange.plusRange(other.modifiedRange)
|
|
320
|
-
);
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
export function lineRangeMappingFromRangeMappings(alignments: readonly RangeMapping[], originalLines: AbstractText, modifiedLines: AbstractText, dontAssertStartLine: boolean = false): DetailedLineRangeMapping[] {
|
|
325
|
-
const changes: DetailedLineRangeMapping[] = [];
|
|
326
|
-
for (const g of groupAdjacentBy(
|
|
327
|
-
alignments.map(a => getLineRangeMapping(a, originalLines, modifiedLines)),
|
|
328
|
-
(a1, a2) =>
|
|
329
|
-
a1.original.intersectsOrTouches(a2.original)
|
|
330
|
-
|| a1.modified.intersectsOrTouches(a2.modified)
|
|
331
|
-
)) {
|
|
332
|
-
const first = g[0];
|
|
333
|
-
const last = g[g.length - 1];
|
|
334
|
-
|
|
335
|
-
changes.push(new DetailedLineRangeMapping(
|
|
336
|
-
first.original.join(last.original),
|
|
337
|
-
first.modified.join(last.modified),
|
|
338
|
-
g.map(a => a.innerChanges![0]),
|
|
339
|
-
));
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
assertFn(() => {
|
|
343
|
-
if (!dontAssertStartLine && changes.length > 0) {
|
|
344
|
-
if (changes[0].modified.startLineNumber !== changes[0].original.startLineNumber) {
|
|
345
|
-
return false;
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
if (modifiedLines.length.lineCount - changes[changes.length - 1].modified.endLineNumberExclusive !== originalLines.length.lineCount - changes[changes.length - 1].original.endLineNumberExclusive) {
|
|
349
|
-
return false;
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
return checkAdjacentItems(changes,
|
|
353
|
-
(m1, m2) => m2.original.startLineNumber - m1.original.endLineNumberExclusive === m2.modified.startLineNumber - m1.modified.endLineNumberExclusive &&
|
|
354
|
-
// There has to be an unchanged line in between (otherwise both diffs should have been joined)
|
|
355
|
-
m1.original.endLineNumberExclusive < m2.original.startLineNumber &&
|
|
356
|
-
m1.modified.endLineNumberExclusive < m2.modified.startLineNumber,
|
|
357
|
-
);
|
|
358
|
-
});
|
|
359
|
-
|
|
360
|
-
return changes;
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
export function getLineRangeMapping(rangeMapping: RangeMapping, originalLines: AbstractText, modifiedLines: AbstractText): DetailedLineRangeMapping {
|
|
364
|
-
let lineStartDelta = 0;
|
|
365
|
-
let lineEndDelta = 0;
|
|
366
|
-
|
|
367
|
-
// rangeMapping describes the edit that replaces `rangeMapping.originalRange` with `newText := getText(modifiedLines, rangeMapping.modifiedRange)`.
|
|
368
|
-
|
|
369
|
-
// original: ]xxx \n <- this line is not modified
|
|
370
|
-
// modified: ]xx \n
|
|
371
|
-
if (rangeMapping.modifiedRange.endColumn === 1 && rangeMapping.originalRange.endColumn === 1
|
|
372
|
-
&& rangeMapping.originalRange.startLineNumber + lineStartDelta <= rangeMapping.originalRange.endLineNumber
|
|
373
|
-
&& rangeMapping.modifiedRange.startLineNumber + lineStartDelta <= rangeMapping.modifiedRange.endLineNumber) {
|
|
374
|
-
// We can only do this if the range is not empty yet
|
|
375
|
-
lineEndDelta = -1;
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
// original: xxx[ \n <- this line is not modified
|
|
379
|
-
// modified: xxx[ \n
|
|
380
|
-
if (rangeMapping.modifiedRange.startColumn - 1 >= modifiedLines.getLineLength(rangeMapping.modifiedRange.startLineNumber)
|
|
381
|
-
&& rangeMapping.originalRange.startColumn - 1 >= originalLines.getLineLength(rangeMapping.originalRange.startLineNumber)
|
|
382
|
-
&& rangeMapping.originalRange.startLineNumber <= rangeMapping.originalRange.endLineNumber + lineEndDelta
|
|
383
|
-
&& rangeMapping.modifiedRange.startLineNumber <= rangeMapping.modifiedRange.endLineNumber + lineEndDelta) {
|
|
384
|
-
// We can only do this if the range is not empty yet
|
|
385
|
-
lineStartDelta = 1;
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
const originalLineRange = new LineRange(
|
|
389
|
-
rangeMapping.originalRange.startLineNumber + lineStartDelta,
|
|
390
|
-
rangeMapping.originalRange.endLineNumber + 1 + lineEndDelta
|
|
391
|
-
);
|
|
392
|
-
const modifiedLineRange = new LineRange(
|
|
393
|
-
rangeMapping.modifiedRange.startLineNumber + lineStartDelta,
|
|
394
|
-
rangeMapping.modifiedRange.endLineNumber + 1 + lineEndDelta
|
|
395
|
-
);
|
|
396
|
-
|
|
397
|
-
return new DetailedLineRangeMapping(originalLineRange, modifiedLineRange, [rangeMapping]);
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
export function lineRangeMappingFromChange(change: IChange): LineRangeMapping {
|
|
401
|
-
let originalRange: LineRange;
|
|
402
|
-
if (change.originalEndLineNumber === 0) {
|
|
403
|
-
// Insertion
|
|
404
|
-
originalRange = new LineRange(change.originalStartLineNumber + 1, change.originalStartLineNumber + 1);
|
|
405
|
-
} else {
|
|
406
|
-
originalRange = new LineRange(change.originalStartLineNumber, change.originalEndLineNumber + 1);
|
|
407
|
-
}
|
|
408
|
-
|
|
409
|
-
let modifiedRange: LineRange;
|
|
410
|
-
if (change.modifiedEndLineNumber === 0) {
|
|
411
|
-
// Deletion
|
|
412
|
-
modifiedRange = new LineRange(change.modifiedStartLineNumber + 1, change.modifiedStartLineNumber + 1);
|
|
413
|
-
} else {
|
|
414
|
-
modifiedRange = new LineRange(change.modifiedStartLineNumber, change.modifiedEndLineNumber + 1);
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
return new LineRangeMapping(originalRange, modifiedRange);
|
|
418
|
-
}
|