@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,411 +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 { compareBy, equals } from '../../../../base/common/arrays';
|
|
9
|
-
import { assertFn, checkAdjacentItems } from '../../../../base/common/assert';
|
|
10
|
-
import { BugIndicatingError } from '../../../../base/common/errors';
|
|
11
|
-
import { commonPrefixLength, commonSuffixLength } from '../../../../base/common/strings';
|
|
12
|
-
import { ISingleEditOperation } from '../editOperation';
|
|
13
|
-
import { BaseStringEdit, StringReplacement } from './stringEdit';
|
|
14
|
-
import { Position } from '../position';
|
|
15
|
-
import { Range } from '../range';
|
|
16
|
-
import { TextLength } from '../text/textLength';
|
|
17
|
-
import { AbstractText, StringText } from '../text/abstractText';
|
|
18
|
-
|
|
19
|
-
export class TextEdit {
|
|
20
|
-
public static fromStringEdit(edit: BaseStringEdit, initialState: AbstractText): TextEdit {
|
|
21
|
-
const edits = edit.replacements.map(e => TextReplacement.fromStringReplacement(e, initialState));
|
|
22
|
-
return new TextEdit(edits);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
public static replace(originalRange: Range, newText: string): TextEdit {
|
|
26
|
-
return new TextEdit([new TextReplacement(originalRange, newText)]);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
public static delete(range: Range): TextEdit {
|
|
30
|
-
return new TextEdit([new TextReplacement(range, '')]);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
public static insert(position: Position, newText: string): TextEdit {
|
|
34
|
-
return new TextEdit([new TextReplacement(Range.fromPositions(position, position), newText)]);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
public static fromParallelReplacementsUnsorted(replacements: readonly TextReplacement[]): TextEdit {
|
|
38
|
-
const r = replacements.slice().sort(compareBy(i => i.range, Range.compareRangesUsingStarts));
|
|
39
|
-
return new TextEdit(r);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
constructor(
|
|
43
|
-
public readonly replacements: readonly TextReplacement[]
|
|
44
|
-
) {
|
|
45
|
-
assertFn(() => checkAdjacentItems(replacements, (a, b) => a.range.getEndPosition().isBeforeOrEqual(b.range.getStartPosition())));
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Joins touching edits and removes empty edits.
|
|
50
|
-
*/
|
|
51
|
-
normalize(): TextEdit {
|
|
52
|
-
const replacements: TextReplacement[] = [];
|
|
53
|
-
for (const r of this.replacements) {
|
|
54
|
-
if (replacements.length > 0 && replacements[replacements.length - 1].range.getEndPosition().equals(r.range.getStartPosition())) {
|
|
55
|
-
const last = replacements[replacements.length - 1];
|
|
56
|
-
replacements[replacements.length - 1] = new TextReplacement(last.range.plusRange(r.range), last.text + r.text);
|
|
57
|
-
} else if (!r.isEmpty) {
|
|
58
|
-
replacements.push(r);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
return new TextEdit(replacements);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
mapPosition(position: Position): Position | Range {
|
|
65
|
-
let lineDelta = 0;
|
|
66
|
-
let curLine = 0;
|
|
67
|
-
let columnDeltaInCurLine = 0;
|
|
68
|
-
|
|
69
|
-
for (const replacement of this.replacements) {
|
|
70
|
-
const start = replacement.range.getStartPosition();
|
|
71
|
-
|
|
72
|
-
if (position.isBeforeOrEqual(start)) {
|
|
73
|
-
break;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
const end = replacement.range.getEndPosition();
|
|
77
|
-
const len = TextLength.ofText(replacement.text);
|
|
78
|
-
if (position.isBefore(end)) {
|
|
79
|
-
const startPos = new Position(start.lineNumber + lineDelta, start.column + (start.lineNumber + lineDelta === curLine ? columnDeltaInCurLine : 0));
|
|
80
|
-
const endPos = len.addToPosition(startPos);
|
|
81
|
-
return rangeFromPositions(startPos, endPos);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
if (start.lineNumber + lineDelta !== curLine) {
|
|
85
|
-
columnDeltaInCurLine = 0;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
lineDelta += len.lineCount - (replacement.range.endLineNumber - replacement.range.startLineNumber);
|
|
89
|
-
|
|
90
|
-
if (len.lineCount === 0) {
|
|
91
|
-
if (end.lineNumber !== start.lineNumber) {
|
|
92
|
-
columnDeltaInCurLine += len.columnCount - (end.column - 1);
|
|
93
|
-
} else {
|
|
94
|
-
columnDeltaInCurLine += len.columnCount - (end.column - start.column);
|
|
95
|
-
}
|
|
96
|
-
} else {
|
|
97
|
-
columnDeltaInCurLine = len.columnCount;
|
|
98
|
-
}
|
|
99
|
-
curLine = end.lineNumber + lineDelta;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
return new Position(position.lineNumber + lineDelta, position.column + (position.lineNumber + lineDelta === curLine ? columnDeltaInCurLine : 0));
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
mapRange(range: Range): Range {
|
|
106
|
-
function getStart(p: Position | Range) {
|
|
107
|
-
return p instanceof Position ? p : p.getStartPosition();
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
function getEnd(p: Position | Range) {
|
|
111
|
-
return p instanceof Position ? p : p.getEndPosition();
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
const start = getStart(this.mapPosition(range.getStartPosition()));
|
|
115
|
-
const end = getEnd(this.mapPosition(range.getEndPosition()));
|
|
116
|
-
|
|
117
|
-
return rangeFromPositions(start, end);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
// TODO: `doc` is not needed for this!
|
|
121
|
-
inverseMapPosition(positionAfterEdit: Position, doc: AbstractText): Position | Range {
|
|
122
|
-
const reversed = this.inverse(doc);
|
|
123
|
-
return reversed.mapPosition(positionAfterEdit);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
inverseMapRange(range: Range, doc: AbstractText): Range {
|
|
127
|
-
const reversed = this.inverse(doc);
|
|
128
|
-
return reversed.mapRange(range);
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
apply(text: AbstractText): string {
|
|
132
|
-
let result = '';
|
|
133
|
-
let lastEditEnd = new Position(1, 1);
|
|
134
|
-
for (const replacement of this.replacements) {
|
|
135
|
-
const editRange = replacement.range;
|
|
136
|
-
const editStart = editRange.getStartPosition();
|
|
137
|
-
const editEnd = editRange.getEndPosition();
|
|
138
|
-
|
|
139
|
-
const r = rangeFromPositions(lastEditEnd, editStart);
|
|
140
|
-
if (!r.isEmpty()) {
|
|
141
|
-
result += text.getValueOfRange(r);
|
|
142
|
-
}
|
|
143
|
-
result += replacement.text;
|
|
144
|
-
lastEditEnd = editEnd;
|
|
145
|
-
}
|
|
146
|
-
const r = rangeFromPositions(lastEditEnd, text.endPositionExclusive);
|
|
147
|
-
if (!r.isEmpty()) {
|
|
148
|
-
result += text.getValueOfRange(r);
|
|
149
|
-
}
|
|
150
|
-
return result;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
applyToString(str: string): string {
|
|
154
|
-
const strText = new StringText(str);
|
|
155
|
-
return this.apply(strText);
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
inverse(doc: AbstractText): TextEdit {
|
|
159
|
-
const ranges = this.getNewRanges();
|
|
160
|
-
return new TextEdit(this.replacements.map((e, idx) => new TextReplacement(ranges[idx], doc.getValueOfRange(e.range))));
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
getNewRanges(): Range[] {
|
|
164
|
-
const newRanges: Range[] = [];
|
|
165
|
-
let previousEditEndLineNumber = 0;
|
|
166
|
-
let lineOffset = 0;
|
|
167
|
-
let columnOffset = 0;
|
|
168
|
-
for (const replacement of this.replacements) {
|
|
169
|
-
const textLength = TextLength.ofText(replacement.text);
|
|
170
|
-
const newRangeStart = Position.lift({
|
|
171
|
-
lineNumber: replacement.range.startLineNumber + lineOffset,
|
|
172
|
-
column: replacement.range.startColumn + (replacement.range.startLineNumber === previousEditEndLineNumber ? columnOffset : 0)
|
|
173
|
-
});
|
|
174
|
-
const newRange = textLength.createRange(newRangeStart);
|
|
175
|
-
newRanges.push(newRange);
|
|
176
|
-
lineOffset = newRange.endLineNumber - replacement.range.endLineNumber;
|
|
177
|
-
columnOffset = newRange.endColumn - replacement.range.endColumn;
|
|
178
|
-
previousEditEndLineNumber = replacement.range.endLineNumber;
|
|
179
|
-
}
|
|
180
|
-
return newRanges;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
toReplacement(text: AbstractText): TextReplacement {
|
|
184
|
-
if (this.replacements.length === 0) { throw new BugIndicatingError(); }
|
|
185
|
-
if (this.replacements.length === 1) { return this.replacements[0]; }
|
|
186
|
-
|
|
187
|
-
const startPos = this.replacements[0].range.getStartPosition();
|
|
188
|
-
const endPos = this.replacements[this.replacements.length - 1].range.getEndPosition();
|
|
189
|
-
|
|
190
|
-
let newText = '';
|
|
191
|
-
|
|
192
|
-
for (let i = 0; i < this.replacements.length; i++) {
|
|
193
|
-
const curEdit = this.replacements[i];
|
|
194
|
-
newText += curEdit.text;
|
|
195
|
-
if (i < this.replacements.length - 1) {
|
|
196
|
-
const nextEdit = this.replacements[i + 1];
|
|
197
|
-
const gapRange = Range.fromPositions(curEdit.range.getEndPosition(), nextEdit.range.getStartPosition());
|
|
198
|
-
const gapText = text.getValueOfRange(gapRange);
|
|
199
|
-
newText += gapText;
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
return new TextReplacement(Range.fromPositions(startPos, endPos), newText);
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
equals(other: TextEdit): boolean {
|
|
206
|
-
return equals(this.replacements, other.replacements, (a, b) => a.equals(b));
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
toString(text: AbstractText | string | undefined): string {
|
|
210
|
-
if (text === undefined) {
|
|
211
|
-
return this.replacements.map(edit => edit.toString()).join('\n');
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
if (typeof text === 'string') {
|
|
215
|
-
return this.toString(new StringText(text));
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
if (this.replacements.length === 0) {
|
|
219
|
-
return '';
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
return this.replacements.map(r => {
|
|
223
|
-
const maxLength = 10;
|
|
224
|
-
const originalText = text.getValueOfRange(r.range);
|
|
225
|
-
|
|
226
|
-
// Get text before the edit
|
|
227
|
-
const beforeRange = Range.fromPositions(
|
|
228
|
-
new Position(Math.max(1, r.range.startLineNumber - 1), 1),
|
|
229
|
-
r.range.getStartPosition()
|
|
230
|
-
);
|
|
231
|
-
let beforeText = text.getValueOfRange(beforeRange);
|
|
232
|
-
if (beforeText.length > maxLength) {
|
|
233
|
-
beforeText = '...' + beforeText.substring(beforeText.length - maxLength);
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
// Get text after the edit
|
|
237
|
-
const afterRange = Range.fromPositions(
|
|
238
|
-
r.range.getEndPosition(),
|
|
239
|
-
new Position(r.range.endLineNumber + 1, 1)
|
|
240
|
-
);
|
|
241
|
-
let afterText = text.getValueOfRange(afterRange);
|
|
242
|
-
if (afterText.length > maxLength) {
|
|
243
|
-
afterText = afterText.substring(0, maxLength) + '...';
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
// Format the replaced text
|
|
247
|
-
let replacedText = originalText;
|
|
248
|
-
if (replacedText.length > maxLength) {
|
|
249
|
-
const halfMax = Math.floor(maxLength / 2);
|
|
250
|
-
replacedText = replacedText.substring(0, halfMax) + '...' +
|
|
251
|
-
replacedText.substring(replacedText.length - halfMax);
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
// Format the new text
|
|
255
|
-
let newText = r.text;
|
|
256
|
-
if (newText.length > maxLength) {
|
|
257
|
-
const halfMax = Math.floor(maxLength / 2);
|
|
258
|
-
newText = newText.substring(0, halfMax) + '...' +
|
|
259
|
-
newText.substring(newText.length - halfMax);
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
if (replacedText.length === 0) {
|
|
263
|
-
// allow-any-unicode-next-line
|
|
264
|
-
return `${beforeText}❰${newText}❱${afterText}`;
|
|
265
|
-
}
|
|
266
|
-
// allow-any-unicode-next-line
|
|
267
|
-
return `${beforeText}❰${replacedText}↦${newText}❱${afterText}`;
|
|
268
|
-
}).join('\n');
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
export class TextReplacement {
|
|
273
|
-
public static joinReplacements(replacements: TextReplacement[], initialValue: AbstractText): TextReplacement {
|
|
274
|
-
if (replacements.length === 0) { throw new BugIndicatingError(); }
|
|
275
|
-
if (replacements.length === 1) { return replacements[0]; }
|
|
276
|
-
|
|
277
|
-
const startPos = replacements[0].range.getStartPosition();
|
|
278
|
-
const endPos = replacements[replacements.length - 1].range.getEndPosition();
|
|
279
|
-
|
|
280
|
-
let newText = '';
|
|
281
|
-
|
|
282
|
-
for (let i = 0; i < replacements.length; i++) {
|
|
283
|
-
const curEdit = replacements[i];
|
|
284
|
-
newText += curEdit.text;
|
|
285
|
-
if (i < replacements.length - 1) {
|
|
286
|
-
const nextEdit = replacements[i + 1];
|
|
287
|
-
const gapRange = Range.fromPositions(curEdit.range.getEndPosition(), nextEdit.range.getStartPosition());
|
|
288
|
-
const gapText = initialValue.getValueOfRange(gapRange);
|
|
289
|
-
newText += gapText;
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
return new TextReplacement(Range.fromPositions(startPos, endPos), newText);
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
public static fromStringReplacement(replacement: StringReplacement, initialState: AbstractText): TextReplacement {
|
|
296
|
-
return new TextReplacement(initialState.getTransformer().getRange(replacement.replaceRange), replacement.newText);
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
public static delete(range: Range): TextReplacement {
|
|
300
|
-
return new TextReplacement(range, '');
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
constructor(
|
|
304
|
-
public readonly range: Range,
|
|
305
|
-
public readonly text: string,
|
|
306
|
-
) {
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
get isEmpty(): boolean {
|
|
310
|
-
return this.range.isEmpty() && this.text.length === 0;
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
static equals(first: TextReplacement, second: TextReplacement) {
|
|
314
|
-
return first.range.equalsRange(second.range) && first.text === second.text;
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
public toSingleEditOperation(): ISingleEditOperation {
|
|
318
|
-
return {
|
|
319
|
-
range: this.range,
|
|
320
|
-
text: this.text,
|
|
321
|
-
};
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
public toEdit(): TextEdit {
|
|
325
|
-
return new TextEdit([this]);
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
public equals(other: TextReplacement): boolean {
|
|
329
|
-
return TextReplacement.equals(this, other);
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
public extendToCoverRange(range: Range, initialValue: AbstractText): TextReplacement {
|
|
333
|
-
if (this.range.containsRange(range)) { return this; }
|
|
334
|
-
|
|
335
|
-
const newRange = this.range.plusRange(range);
|
|
336
|
-
const textBefore = initialValue.getValueOfRange(Range.fromPositions(newRange.getStartPosition(), this.range.getStartPosition()));
|
|
337
|
-
const textAfter = initialValue.getValueOfRange(Range.fromPositions(this.range.getEndPosition(), newRange.getEndPosition()));
|
|
338
|
-
const newText = textBefore + this.text + textAfter;
|
|
339
|
-
return new TextReplacement(newRange, newText);
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
public extendToFullLine(initialValue: AbstractText): TextReplacement {
|
|
343
|
-
const newRange = new Range(
|
|
344
|
-
this.range.startLineNumber,
|
|
345
|
-
1,
|
|
346
|
-
this.range.endLineNumber,
|
|
347
|
-
initialValue.getTransformer().getLineLength(this.range.endLineNumber) + 1
|
|
348
|
-
);
|
|
349
|
-
return this.extendToCoverRange(newRange, initialValue);
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
public removeCommonPrefixAndSuffix(text: AbstractText): TextReplacement {
|
|
353
|
-
const prefix = this.removeCommonPrefix(text);
|
|
354
|
-
const suffix = prefix.removeCommonSuffix(text);
|
|
355
|
-
return suffix;
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
public removeCommonPrefix(text: AbstractText): TextReplacement {
|
|
359
|
-
const normalizedOriginalText = text.getValueOfRange(this.range).replaceAll('\r\n', '\n');
|
|
360
|
-
const normalizedModifiedText = this.text.replaceAll('\r\n', '\n');
|
|
361
|
-
|
|
362
|
-
const commonPrefixLen = commonPrefixLength(normalizedOriginalText, normalizedModifiedText);
|
|
363
|
-
const start = TextLength.ofText(normalizedOriginalText.substring(0, commonPrefixLen))
|
|
364
|
-
.addToPosition(this.range.getStartPosition());
|
|
365
|
-
|
|
366
|
-
const newText = normalizedModifiedText.substring(commonPrefixLen);
|
|
367
|
-
const range = Range.fromPositions(start, this.range.getEndPosition());
|
|
368
|
-
return new TextReplacement(range, newText);
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
public removeCommonSuffix(text: AbstractText): TextReplacement {
|
|
372
|
-
const normalizedOriginalText = text.getValueOfRange(this.range).replaceAll('\r\n', '\n');
|
|
373
|
-
const normalizedModifiedText = this.text.replaceAll('\r\n', '\n');
|
|
374
|
-
|
|
375
|
-
const commonSuffixLen = commonSuffixLength(normalizedOriginalText, normalizedModifiedText);
|
|
376
|
-
const end = TextLength.ofText(normalizedOriginalText.substring(0, normalizedOriginalText.length - commonSuffixLen))
|
|
377
|
-
.addToPosition(this.range.getStartPosition());
|
|
378
|
-
|
|
379
|
-
const newText = normalizedModifiedText.substring(0, normalizedModifiedText.length - commonSuffixLen);
|
|
380
|
-
const range = Range.fromPositions(this.range.getStartPosition(), end);
|
|
381
|
-
return new TextReplacement(range, newText);
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
public isEffectiveDeletion(text: AbstractText): boolean {
|
|
385
|
-
let newText = this.text.replaceAll('\r\n', '\n');
|
|
386
|
-
let existingText = text.getValueOfRange(this.range).replaceAll('\r\n', '\n');
|
|
387
|
-
const l = commonPrefixLength(newText, existingText);
|
|
388
|
-
newText = newText.substring(l);
|
|
389
|
-
existingText = existingText.substring(l);
|
|
390
|
-
const r = commonSuffixLength(newText, existingText);
|
|
391
|
-
newText = newText.substring(0, newText.length - r);
|
|
392
|
-
existingText = existingText.substring(0, existingText.length - r);
|
|
393
|
-
|
|
394
|
-
return newText === '';
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
public toString(): string {
|
|
398
|
-
const start = this.range.getStartPosition();
|
|
399
|
-
const end = this.range.getEndPosition();
|
|
400
|
-
return `(${start.lineNumber},${start.column} -> ${end.lineNumber},${end.column}): "${this.text}"`;
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
function rangeFromPositions(start: Position, end: Position): Range {
|
|
405
|
-
if (start.lineNumber === end.lineNumber && start.column === Number.MAX_SAFE_INTEGER) {
|
|
406
|
-
return Range.fromPositions(end, end);
|
|
407
|
-
} else if (!start.isBeforeOrEqual(end)) {
|
|
408
|
-
throw new BugIndicatingError('start must be before end');
|
|
409
|
-
}
|
|
410
|
-
return new Range(start.lineNumber, start.column, end.lineNumber, end.column);
|
|
411
|
-
}
|
|
@@ -1,186 +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
|
-
/**
|
|
9
|
-
* A position in the editor. This interface is suitable for serialization.
|
|
10
|
-
*/
|
|
11
|
-
export interface IPosition {
|
|
12
|
-
/**
|
|
13
|
-
* line number (starts at 1)
|
|
14
|
-
*/
|
|
15
|
-
readonly lineNumber: number;
|
|
16
|
-
/**
|
|
17
|
-
* column (the first character in a line is between column 1 and column 2)
|
|
18
|
-
*/
|
|
19
|
-
readonly column: number;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* A position in the editor.
|
|
24
|
-
*/
|
|
25
|
-
export class Position {
|
|
26
|
-
/**
|
|
27
|
-
* line number (starts at 1)
|
|
28
|
-
*/
|
|
29
|
-
public readonly lineNumber: number;
|
|
30
|
-
/**
|
|
31
|
-
* column (the first character in a line is between column 1 and column 2)
|
|
32
|
-
*/
|
|
33
|
-
public readonly column: number;
|
|
34
|
-
|
|
35
|
-
constructor(lineNumber: number, column: number) {
|
|
36
|
-
this.lineNumber = lineNumber;
|
|
37
|
-
this.column = column;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Create a new position from this position.
|
|
42
|
-
*
|
|
43
|
-
* @param newLineNumber new line number
|
|
44
|
-
* @param newColumn new column
|
|
45
|
-
*/
|
|
46
|
-
with(newLineNumber: number = this.lineNumber, newColumn: number = this.column): Position {
|
|
47
|
-
if (newLineNumber === this.lineNumber && newColumn === this.column) {
|
|
48
|
-
return this;
|
|
49
|
-
} else {
|
|
50
|
-
return new Position(newLineNumber, newColumn);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Derive a new position from this position.
|
|
56
|
-
*
|
|
57
|
-
* @param deltaLineNumber line number delta
|
|
58
|
-
* @param deltaColumn column delta
|
|
59
|
-
*/
|
|
60
|
-
delta(deltaLineNumber: number = 0, deltaColumn: number = 0): Position {
|
|
61
|
-
return this.with(Math.max(1, this.lineNumber + deltaLineNumber), Math.max(1, this.column + deltaColumn));
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Test if this position equals other position
|
|
66
|
-
*/
|
|
67
|
-
public equals(other: IPosition): boolean {
|
|
68
|
-
return Position.equals(this, other);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Test if position `a` equals position `b`
|
|
73
|
-
*/
|
|
74
|
-
public static equals(a: IPosition | null, b: IPosition | null): boolean {
|
|
75
|
-
if (!a && !b) {
|
|
76
|
-
return true;
|
|
77
|
-
}
|
|
78
|
-
return (
|
|
79
|
-
!!a &&
|
|
80
|
-
!!b &&
|
|
81
|
-
a.lineNumber === b.lineNumber &&
|
|
82
|
-
a.column === b.column
|
|
83
|
-
);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* Test if this position is before other position.
|
|
88
|
-
* If the two positions are equal, the result will be false.
|
|
89
|
-
*/
|
|
90
|
-
public isBefore(other: IPosition): boolean {
|
|
91
|
-
return Position.isBefore(this, other);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* Test if position `a` is before position `b`.
|
|
96
|
-
* If the two positions are equal, the result will be false.
|
|
97
|
-
*/
|
|
98
|
-
public static isBefore(a: IPosition, b: IPosition): boolean {
|
|
99
|
-
if (a.lineNumber < b.lineNumber) {
|
|
100
|
-
return true;
|
|
101
|
-
}
|
|
102
|
-
if (b.lineNumber < a.lineNumber) {
|
|
103
|
-
return false;
|
|
104
|
-
}
|
|
105
|
-
return a.column < b.column;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* Test if this position is before other position.
|
|
110
|
-
* If the two positions are equal, the result will be true.
|
|
111
|
-
*/
|
|
112
|
-
public isBeforeOrEqual(other: IPosition): boolean {
|
|
113
|
-
return Position.isBeforeOrEqual(this, other);
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
/**
|
|
117
|
-
* Test if position `a` is before position `b`.
|
|
118
|
-
* If the two positions are equal, the result will be true.
|
|
119
|
-
*/
|
|
120
|
-
public static isBeforeOrEqual(a: IPosition, b: IPosition): boolean {
|
|
121
|
-
if (a.lineNumber < b.lineNumber) {
|
|
122
|
-
return true;
|
|
123
|
-
}
|
|
124
|
-
if (b.lineNumber < a.lineNumber) {
|
|
125
|
-
return false;
|
|
126
|
-
}
|
|
127
|
-
return a.column <= b.column;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* A function that compares positions, useful for sorting
|
|
132
|
-
*/
|
|
133
|
-
public static compare(a: IPosition, b: IPosition): number {
|
|
134
|
-
const aLineNumber = a.lineNumber | 0;
|
|
135
|
-
const bLineNumber = b.lineNumber | 0;
|
|
136
|
-
|
|
137
|
-
if (aLineNumber === bLineNumber) {
|
|
138
|
-
const aColumn = a.column | 0;
|
|
139
|
-
const bColumn = b.column | 0;
|
|
140
|
-
return aColumn - bColumn;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
return aLineNumber - bLineNumber;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
/**
|
|
147
|
-
* Clone this position.
|
|
148
|
-
*/
|
|
149
|
-
public clone(): Position {
|
|
150
|
-
return new Position(this.lineNumber, this.column);
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
/**
|
|
154
|
-
* Convert to a human-readable representation.
|
|
155
|
-
*/
|
|
156
|
-
public toString(): string {
|
|
157
|
-
return '(' + this.lineNumber + ',' + this.column + ')';
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
// ---
|
|
161
|
-
|
|
162
|
-
/**
|
|
163
|
-
* Create a `Position` from an `IPosition`.
|
|
164
|
-
*/
|
|
165
|
-
public static lift(pos: IPosition): Position {
|
|
166
|
-
return new Position(pos.lineNumber, pos.column);
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
/**
|
|
170
|
-
* Test if `obj` is an `IPosition`.
|
|
171
|
-
*/
|
|
172
|
-
public static isIPosition(obj: any): obj is IPosition {
|
|
173
|
-
return (
|
|
174
|
-
obj
|
|
175
|
-
&& (typeof obj.lineNumber === 'number')
|
|
176
|
-
&& (typeof obj.column === 'number')
|
|
177
|
-
);
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
public toJSON(): IPosition {
|
|
181
|
-
return {
|
|
182
|
-
lineNumber: this.lineNumber,
|
|
183
|
-
column: this.column
|
|
184
|
-
};
|
|
185
|
-
}
|
|
186
|
-
}
|