@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,416 +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 { BugIndicatingError } from '../../../../base/common/errors';
|
|
9
|
-
import { OffsetRange } from './offsetRange';
|
|
10
|
-
import { Range } from '../range';
|
|
11
|
-
import { findFirstIdxMonotonousOrArrLen, findLastIdxMonotonous, findLastMonotonous } from '../../../../base/common/arraysFind';
|
|
12
|
-
import { Comparator, compareBy, numberComparator } from '../../../../base/common/arrays';
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* A range of lines (1-based).
|
|
16
|
-
*/
|
|
17
|
-
export class LineRange {
|
|
18
|
-
public static ofLength(startLineNumber: number, length: number): LineRange {
|
|
19
|
-
return new LineRange(startLineNumber, startLineNumber + length);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
public static fromRange(range: Range): LineRange {
|
|
23
|
-
return new LineRange(range.startLineNumber, range.endLineNumber);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
public static fromRangeInclusive(range: Range): LineRange {
|
|
27
|
-
return new LineRange(range.startLineNumber, range.endLineNumber + 1);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
public static readonly compareByStart: Comparator<LineRange> = compareBy(l => l.startLineNumber, numberComparator);
|
|
31
|
-
|
|
32
|
-
public static subtract(a: LineRange, b: LineRange | undefined): LineRange[] {
|
|
33
|
-
if (!b) {
|
|
34
|
-
return [a];
|
|
35
|
-
}
|
|
36
|
-
if (a.startLineNumber < b.startLineNumber && b.endLineNumberExclusive < a.endLineNumberExclusive) {
|
|
37
|
-
return [
|
|
38
|
-
new LineRange(a.startLineNumber, b.startLineNumber),
|
|
39
|
-
new LineRange(b.endLineNumberExclusive, a.endLineNumberExclusive)
|
|
40
|
-
];
|
|
41
|
-
} else if (b.startLineNumber <= a.startLineNumber && a.endLineNumberExclusive <= b.endLineNumberExclusive) {
|
|
42
|
-
return [];
|
|
43
|
-
} else if (b.endLineNumberExclusive < a.endLineNumberExclusive) {
|
|
44
|
-
return [new LineRange(Math.max(b.endLineNumberExclusive, a.startLineNumber), a.endLineNumberExclusive)];
|
|
45
|
-
} else {
|
|
46
|
-
return [new LineRange(a.startLineNumber, Math.min(b.startLineNumber, a.endLineNumberExclusive))];
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* @param lineRanges An array of arrays of of sorted line ranges.
|
|
52
|
-
*/
|
|
53
|
-
public static joinMany(lineRanges: readonly (readonly LineRange[])[]): readonly LineRange[] {
|
|
54
|
-
if (lineRanges.length === 0) {
|
|
55
|
-
return [];
|
|
56
|
-
}
|
|
57
|
-
let result = new LineRangeSet(lineRanges[0].slice());
|
|
58
|
-
for (let i = 1; i < lineRanges.length; i++) {
|
|
59
|
-
result = result.getUnion(new LineRangeSet(lineRanges[i].slice()));
|
|
60
|
-
}
|
|
61
|
-
return result.ranges;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
public static join(lineRanges: LineRange[]): LineRange {
|
|
65
|
-
if (lineRanges.length === 0) {
|
|
66
|
-
throw new BugIndicatingError('lineRanges cannot be empty');
|
|
67
|
-
}
|
|
68
|
-
let startLineNumber = lineRanges[0].startLineNumber;
|
|
69
|
-
let endLineNumberExclusive = lineRanges[0].endLineNumberExclusive;
|
|
70
|
-
for (let i = 1; i < lineRanges.length; i++) {
|
|
71
|
-
startLineNumber = Math.min(startLineNumber, lineRanges[i].startLineNumber);
|
|
72
|
-
endLineNumberExclusive = Math.max(endLineNumberExclusive, lineRanges[i].endLineNumberExclusive);
|
|
73
|
-
}
|
|
74
|
-
return new LineRange(startLineNumber, endLineNumberExclusive);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* @internal
|
|
79
|
-
*/
|
|
80
|
-
public static deserialize(lineRange: ISerializedLineRange): LineRange {
|
|
81
|
-
return new LineRange(lineRange[0], lineRange[1]);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* The start line number.
|
|
86
|
-
*/
|
|
87
|
-
public readonly startLineNumber: number;
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* The end line number (exclusive).
|
|
91
|
-
*/
|
|
92
|
-
public readonly endLineNumberExclusive: number;
|
|
93
|
-
|
|
94
|
-
constructor(
|
|
95
|
-
startLineNumber: number,
|
|
96
|
-
endLineNumberExclusive: number,
|
|
97
|
-
) {
|
|
98
|
-
if (startLineNumber > endLineNumberExclusive) {
|
|
99
|
-
throw new BugIndicatingError(`startLineNumber ${startLineNumber} cannot be after endLineNumberExclusive ${endLineNumberExclusive}`);
|
|
100
|
-
}
|
|
101
|
-
this.startLineNumber = startLineNumber;
|
|
102
|
-
this.endLineNumberExclusive = endLineNumberExclusive;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* Indicates if this line range contains the given line number.
|
|
107
|
-
*/
|
|
108
|
-
public contains(lineNumber: number): boolean {
|
|
109
|
-
return this.startLineNumber <= lineNumber && lineNumber < this.endLineNumberExclusive;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
public containsRange(range: LineRange): boolean {
|
|
113
|
-
return this.startLineNumber <= range.startLineNumber && range.endLineNumberExclusive <= this.endLineNumberExclusive;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
/**
|
|
117
|
-
* Indicates if this line range is empty.
|
|
118
|
-
*/
|
|
119
|
-
get isEmpty(): boolean {
|
|
120
|
-
return this.startLineNumber === this.endLineNumberExclusive;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
/**
|
|
124
|
-
* Moves this line range by the given offset of line numbers.
|
|
125
|
-
*/
|
|
126
|
-
public delta(offset: number): LineRange {
|
|
127
|
-
return new LineRange(this.startLineNumber + offset, this.endLineNumberExclusive + offset);
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
public deltaLength(offset: number): LineRange {
|
|
131
|
-
return new LineRange(this.startLineNumber, this.endLineNumberExclusive + offset);
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
* The number of lines this line range spans.
|
|
136
|
-
*/
|
|
137
|
-
public get length(): number {
|
|
138
|
-
return this.endLineNumberExclusive - this.startLineNumber;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
/**
|
|
142
|
-
* Creates a line range that combines this and the given line range.
|
|
143
|
-
*/
|
|
144
|
-
public join(other: LineRange): LineRange {
|
|
145
|
-
return new LineRange(
|
|
146
|
-
Math.min(this.startLineNumber, other.startLineNumber),
|
|
147
|
-
Math.max(this.endLineNumberExclusive, other.endLineNumberExclusive)
|
|
148
|
-
);
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
public toString(): string {
|
|
152
|
-
return `[${this.startLineNumber},${this.endLineNumberExclusive})`;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
/**
|
|
156
|
-
* The resulting range is empty if the ranges do not intersect, but touch.
|
|
157
|
-
* If the ranges don't even touch, the result is undefined.
|
|
158
|
-
*/
|
|
159
|
-
public intersect(other: LineRange): LineRange | undefined {
|
|
160
|
-
const startLineNumber = Math.max(this.startLineNumber, other.startLineNumber);
|
|
161
|
-
const endLineNumberExclusive = Math.min(this.endLineNumberExclusive, other.endLineNumberExclusive);
|
|
162
|
-
if (startLineNumber <= endLineNumberExclusive) {
|
|
163
|
-
return new LineRange(startLineNumber, endLineNumberExclusive);
|
|
164
|
-
}
|
|
165
|
-
return undefined;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
public intersectsStrict(other: LineRange): boolean {
|
|
169
|
-
return this.startLineNumber < other.endLineNumberExclusive && other.startLineNumber < this.endLineNumberExclusive;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
public intersectsOrTouches(other: LineRange): boolean {
|
|
173
|
-
return this.startLineNumber <= other.endLineNumberExclusive && other.startLineNumber <= this.endLineNumberExclusive;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
public equals(b: LineRange): boolean {
|
|
177
|
-
return this.startLineNumber === b.startLineNumber && this.endLineNumberExclusive === b.endLineNumberExclusive;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
public toInclusiveRange(): Range | null {
|
|
181
|
-
if (this.isEmpty) {
|
|
182
|
-
return null;
|
|
183
|
-
}
|
|
184
|
-
return new Range(this.startLineNumber, 1, this.endLineNumberExclusive - 1, Number.MAX_SAFE_INTEGER);
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
/**
|
|
188
|
-
* @deprecated Using this function is discouraged because it might lead to bugs: The end position is not guaranteed to be a valid position!
|
|
189
|
-
*/
|
|
190
|
-
public toExclusiveRange(): Range {
|
|
191
|
-
return new Range(this.startLineNumber, 1, this.endLineNumberExclusive, 1);
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
public mapToLineArray<T>(f: (lineNumber: number) => T): T[] {
|
|
195
|
-
const result: T[] = [];
|
|
196
|
-
for (let lineNumber = this.startLineNumber; lineNumber < this.endLineNumberExclusive; lineNumber++) {
|
|
197
|
-
result.push(f(lineNumber));
|
|
198
|
-
}
|
|
199
|
-
return result;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
public forEach(f: (lineNumber: number) => void): void {
|
|
203
|
-
for (let lineNumber = this.startLineNumber; lineNumber < this.endLineNumberExclusive; lineNumber++) {
|
|
204
|
-
f(lineNumber);
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
/**
|
|
209
|
-
* @internal
|
|
210
|
-
*/
|
|
211
|
-
public serialize(): ISerializedLineRange {
|
|
212
|
-
return [this.startLineNumber, this.endLineNumberExclusive];
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
/**
|
|
216
|
-
* Converts this 1-based line range to a 0-based offset range (subtracts 1!).
|
|
217
|
-
* @internal
|
|
218
|
-
*/
|
|
219
|
-
public toOffsetRange(): OffsetRange {
|
|
220
|
-
return new OffsetRange(this.startLineNumber - 1, this.endLineNumberExclusive - 1);
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
public distanceToRange(other: LineRange): number {
|
|
224
|
-
if (this.endLineNumberExclusive <= other.startLineNumber) {
|
|
225
|
-
return other.startLineNumber - this.endLineNumberExclusive;
|
|
226
|
-
}
|
|
227
|
-
if (other.endLineNumberExclusive <= this.startLineNumber) {
|
|
228
|
-
return this.startLineNumber - other.endLineNumberExclusive;
|
|
229
|
-
}
|
|
230
|
-
return 0;
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
public distanceToLine(lineNumber: number): number {
|
|
234
|
-
if (this.contains(lineNumber)) {
|
|
235
|
-
return 0;
|
|
236
|
-
}
|
|
237
|
-
if (lineNumber < this.startLineNumber) {
|
|
238
|
-
return this.startLineNumber - lineNumber;
|
|
239
|
-
}
|
|
240
|
-
return lineNumber - this.endLineNumberExclusive;
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
public addMargin(marginTop: number, marginBottom: number): LineRange {
|
|
244
|
-
return new LineRange(
|
|
245
|
-
this.startLineNumber - marginTop,
|
|
246
|
-
this.endLineNumberExclusive + marginBottom
|
|
247
|
-
);
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
export type ISerializedLineRange = [startLineNumber: number, endLineNumberExclusive: number];
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
export class LineRangeSet {
|
|
255
|
-
constructor(
|
|
256
|
-
/**
|
|
257
|
-
* Sorted by start line number.
|
|
258
|
-
* No two line ranges are touching or intersecting.
|
|
259
|
-
*/
|
|
260
|
-
private readonly _normalizedRanges: LineRange[] = []
|
|
261
|
-
) {
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
get ranges(): readonly LineRange[] {
|
|
265
|
-
return this._normalizedRanges;
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
addRange(range: LineRange): void {
|
|
269
|
-
if (range.length === 0) {
|
|
270
|
-
return;
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
// Idea: Find joinRange such that:
|
|
274
|
-
// replaceRange = _normalizedRanges.replaceRange(joinRange, range.joinAll(joinRange.map(idx => this._normalizedRanges[idx])))
|
|
275
|
-
|
|
276
|
-
// idx of first element that touches range or that is after range
|
|
277
|
-
const joinRangeStartIdx = findFirstIdxMonotonousOrArrLen(this._normalizedRanges, r => r.endLineNumberExclusive >= range.startLineNumber);
|
|
278
|
-
// idx of element after { last element that touches range or that is before range }
|
|
279
|
-
const joinRangeEndIdxExclusive = findLastIdxMonotonous(this._normalizedRanges, r => r.startLineNumber <= range.endLineNumberExclusive) + 1;
|
|
280
|
-
|
|
281
|
-
if (joinRangeStartIdx === joinRangeEndIdxExclusive) {
|
|
282
|
-
// If there is no element that touches range, then joinRangeStartIdx === joinRangeEndIdxExclusive and that value is the index of the element after range
|
|
283
|
-
this._normalizedRanges.splice(joinRangeStartIdx, 0, range);
|
|
284
|
-
} else if (joinRangeStartIdx === joinRangeEndIdxExclusive - 1) {
|
|
285
|
-
// Else, there is an element that touches range and in this case it is both the first and last element. Thus we can replace it
|
|
286
|
-
const joinRange = this._normalizedRanges[joinRangeStartIdx];
|
|
287
|
-
this._normalizedRanges[joinRangeStartIdx] = joinRange.join(range);
|
|
288
|
-
} else {
|
|
289
|
-
// First and last element are different - we need to replace the entire range
|
|
290
|
-
const joinRange = this._normalizedRanges[joinRangeStartIdx].join(this._normalizedRanges[joinRangeEndIdxExclusive - 1]).join(range);
|
|
291
|
-
this._normalizedRanges.splice(joinRangeStartIdx, joinRangeEndIdxExclusive - joinRangeStartIdx, joinRange);
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
contains(lineNumber: number): boolean {
|
|
296
|
-
const rangeThatStartsBeforeEnd = findLastMonotonous(this._normalizedRanges, r => r.startLineNumber <= lineNumber);
|
|
297
|
-
return !!rangeThatStartsBeforeEnd && rangeThatStartsBeforeEnd.endLineNumberExclusive > lineNumber;
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
intersects(range: LineRange): boolean {
|
|
301
|
-
const rangeThatStartsBeforeEnd = findLastMonotonous(this._normalizedRanges, r => r.startLineNumber < range.endLineNumberExclusive);
|
|
302
|
-
return !!rangeThatStartsBeforeEnd && rangeThatStartsBeforeEnd.endLineNumberExclusive > range.startLineNumber;
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
getUnion(other: LineRangeSet): LineRangeSet {
|
|
306
|
-
if (this._normalizedRanges.length === 0) {
|
|
307
|
-
return other;
|
|
308
|
-
}
|
|
309
|
-
if (other._normalizedRanges.length === 0) {
|
|
310
|
-
return this;
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
const result: LineRange[] = [];
|
|
314
|
-
let i1 = 0;
|
|
315
|
-
let i2 = 0;
|
|
316
|
-
let current: LineRange | null = null;
|
|
317
|
-
while (i1 < this._normalizedRanges.length || i2 < other._normalizedRanges.length) {
|
|
318
|
-
let next: LineRange | null = null;
|
|
319
|
-
if (i1 < this._normalizedRanges.length && i2 < other._normalizedRanges.length) {
|
|
320
|
-
const lineRange1 = this._normalizedRanges[i1];
|
|
321
|
-
const lineRange2 = other._normalizedRanges[i2];
|
|
322
|
-
if (lineRange1.startLineNumber < lineRange2.startLineNumber) {
|
|
323
|
-
next = lineRange1;
|
|
324
|
-
i1++;
|
|
325
|
-
} else {
|
|
326
|
-
next = lineRange2;
|
|
327
|
-
i2++;
|
|
328
|
-
}
|
|
329
|
-
} else if (i1 < this._normalizedRanges.length) {
|
|
330
|
-
next = this._normalizedRanges[i1];
|
|
331
|
-
i1++;
|
|
332
|
-
} else {
|
|
333
|
-
next = other._normalizedRanges[i2];
|
|
334
|
-
i2++;
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
if (current === null) {
|
|
338
|
-
current = next;
|
|
339
|
-
} else {
|
|
340
|
-
if (current.endLineNumberExclusive >= next.startLineNumber) {
|
|
341
|
-
// merge
|
|
342
|
-
current = new LineRange(current.startLineNumber, Math.max(current.endLineNumberExclusive, next.endLineNumberExclusive));
|
|
343
|
-
} else {
|
|
344
|
-
// push
|
|
345
|
-
result.push(current);
|
|
346
|
-
current = next;
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
if (current !== null) {
|
|
351
|
-
result.push(current);
|
|
352
|
-
}
|
|
353
|
-
return new LineRangeSet(result);
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
/**
|
|
357
|
-
* Subtracts all ranges in this set from `range` and returns the result.
|
|
358
|
-
*/
|
|
359
|
-
subtractFrom(range: LineRange): LineRangeSet {
|
|
360
|
-
// idx of first element that touches range or that is after range
|
|
361
|
-
const joinRangeStartIdx = findFirstIdxMonotonousOrArrLen(this._normalizedRanges, r => r.endLineNumberExclusive >= range.startLineNumber);
|
|
362
|
-
// idx of element after { last element that touches range or that is before range }
|
|
363
|
-
const joinRangeEndIdxExclusive = findLastIdxMonotonous(this._normalizedRanges, r => r.startLineNumber <= range.endLineNumberExclusive) + 1;
|
|
364
|
-
|
|
365
|
-
if (joinRangeStartIdx === joinRangeEndIdxExclusive) {
|
|
366
|
-
return new LineRangeSet([range]);
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
const result: LineRange[] = [];
|
|
370
|
-
let startLineNumber = range.startLineNumber;
|
|
371
|
-
for (let i = joinRangeStartIdx; i < joinRangeEndIdxExclusive; i++) {
|
|
372
|
-
const r = this._normalizedRanges[i];
|
|
373
|
-
if (r.startLineNumber > startLineNumber) {
|
|
374
|
-
result.push(new LineRange(startLineNumber, r.startLineNumber));
|
|
375
|
-
}
|
|
376
|
-
startLineNumber = r.endLineNumberExclusive;
|
|
377
|
-
}
|
|
378
|
-
if (startLineNumber < range.endLineNumberExclusive) {
|
|
379
|
-
result.push(new LineRange(startLineNumber, range.endLineNumberExclusive));
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
return new LineRangeSet(result);
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
toString() {
|
|
386
|
-
return this._normalizedRanges.map(r => r.toString()).join(', ');
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
getIntersection(other: LineRangeSet): LineRangeSet {
|
|
390
|
-
const result: LineRange[] = [];
|
|
391
|
-
|
|
392
|
-
let i1 = 0;
|
|
393
|
-
let i2 = 0;
|
|
394
|
-
while (i1 < this._normalizedRanges.length && i2 < other._normalizedRanges.length) {
|
|
395
|
-
const r1 = this._normalizedRanges[i1];
|
|
396
|
-
const r2 = other._normalizedRanges[i2];
|
|
397
|
-
|
|
398
|
-
const i = r1.intersect(r2);
|
|
399
|
-
if (i && !i.isEmpty) {
|
|
400
|
-
result.push(i);
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
if (r1.endLineNumberExclusive < r2.endLineNumberExclusive) {
|
|
404
|
-
i1++;
|
|
405
|
-
} else {
|
|
406
|
-
i2++;
|
|
407
|
-
}
|
|
408
|
-
}
|
|
409
|
-
|
|
410
|
-
return new LineRangeSet(result);
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
getWithDelta(value: number): LineRangeSet {
|
|
414
|
-
return new LineRangeSet(this._normalizedRanges.map(r => r.delta(value)));
|
|
415
|
-
}
|
|
416
|
-
}
|
|
@@ -1,275 +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 { BugIndicatingError } from '../../../../base/common/errors';
|
|
9
|
-
|
|
10
|
-
export interface IOffsetRange {
|
|
11
|
-
readonly start: number;
|
|
12
|
-
readonly endExclusive: number;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* A range of offsets (0-based).
|
|
17
|
-
*/
|
|
18
|
-
export class OffsetRange implements IOffsetRange {
|
|
19
|
-
public static fromTo(start: number, endExclusive: number): OffsetRange {
|
|
20
|
-
return new OffsetRange(start, endExclusive);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
public static addRange(range: OffsetRange, sortedRanges: OffsetRange[]): void {
|
|
24
|
-
let i = 0;
|
|
25
|
-
while (i < sortedRanges.length && sortedRanges[i].endExclusive < range.start) {
|
|
26
|
-
i++;
|
|
27
|
-
}
|
|
28
|
-
let j = i;
|
|
29
|
-
while (j < sortedRanges.length && sortedRanges[j].start <= range.endExclusive) {
|
|
30
|
-
j++;
|
|
31
|
-
}
|
|
32
|
-
if (i === j) {
|
|
33
|
-
sortedRanges.splice(i, 0, range);
|
|
34
|
-
} else {
|
|
35
|
-
const start = Math.min(range.start, sortedRanges[i].start);
|
|
36
|
-
const end = Math.max(range.endExclusive, sortedRanges[j - 1].endExclusive);
|
|
37
|
-
sortedRanges.splice(i, j - i, new OffsetRange(start, end));
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
public static tryCreate(start: number, endExclusive: number): OffsetRange | undefined {
|
|
42
|
-
if (start > endExclusive) {
|
|
43
|
-
return undefined;
|
|
44
|
-
}
|
|
45
|
-
return new OffsetRange(start, endExclusive);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
public static ofLength(length: number): OffsetRange {
|
|
49
|
-
return new OffsetRange(0, length);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
public static ofStartAndLength(start: number, length: number): OffsetRange {
|
|
53
|
-
return new OffsetRange(start, start + length);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
public static emptyAt(offset: number): OffsetRange {
|
|
57
|
-
return new OffsetRange(offset, offset);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
constructor(public readonly start: number, public readonly endExclusive: number) {
|
|
61
|
-
if (start > endExclusive) {
|
|
62
|
-
throw new BugIndicatingError(`Invalid range: ${this.toString()}`);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
get isEmpty(): boolean {
|
|
67
|
-
return this.start === this.endExclusive;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
public delta(offset: number): OffsetRange {
|
|
71
|
-
return new OffsetRange(this.start + offset, this.endExclusive + offset);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
public deltaStart(offset: number): OffsetRange {
|
|
75
|
-
return new OffsetRange(this.start + offset, this.endExclusive);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
public deltaEnd(offset: number): OffsetRange {
|
|
79
|
-
return new OffsetRange(this.start, this.endExclusive + offset);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
public get length(): number {
|
|
83
|
-
return this.endExclusive - this.start;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
public toString() {
|
|
87
|
-
return `[${this.start}, ${this.endExclusive})`;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
public equals(other: OffsetRange): boolean {
|
|
91
|
-
return this.start === other.start && this.endExclusive === other.endExclusive;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
public containsRange(other: OffsetRange): boolean {
|
|
95
|
-
return this.start <= other.start && other.endExclusive <= this.endExclusive;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
public contains(offset: number): boolean {
|
|
99
|
-
return this.start <= offset && offset < this.endExclusive;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* for all numbers n: range1.contains(n) or range2.contains(n) => range1.join(range2).contains(n)
|
|
104
|
-
* The joined range is the smallest range that contains both ranges.
|
|
105
|
-
*/
|
|
106
|
-
public join(other: OffsetRange): OffsetRange {
|
|
107
|
-
return new OffsetRange(Math.min(this.start, other.start), Math.max(this.endExclusive, other.endExclusive));
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* for all numbers n: range1.contains(n) and range2.contains(n) <=> range1.intersect(range2).contains(n)
|
|
112
|
-
*
|
|
113
|
-
* The resulting range is empty if the ranges do not intersect, but touch.
|
|
114
|
-
* If the ranges don't even touch, the result is undefined.
|
|
115
|
-
*/
|
|
116
|
-
public intersect(other: OffsetRange): OffsetRange | undefined {
|
|
117
|
-
const start = Math.max(this.start, other.start);
|
|
118
|
-
const end = Math.min(this.endExclusive, other.endExclusive);
|
|
119
|
-
if (start <= end) {
|
|
120
|
-
return new OffsetRange(start, end);
|
|
121
|
-
}
|
|
122
|
-
return undefined;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
public intersectionLength(range: OffsetRange): number {
|
|
126
|
-
const start = Math.max(this.start, range.start);
|
|
127
|
-
const end = Math.min(this.endExclusive, range.endExclusive);
|
|
128
|
-
return Math.max(0, end - start);
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
public intersects(other: OffsetRange): boolean {
|
|
132
|
-
const start = Math.max(this.start, other.start);
|
|
133
|
-
const end = Math.min(this.endExclusive, other.endExclusive);
|
|
134
|
-
return start < end;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
public intersectsOrTouches(other: OffsetRange): boolean {
|
|
138
|
-
const start = Math.max(this.start, other.start);
|
|
139
|
-
const end = Math.min(this.endExclusive, other.endExclusive);
|
|
140
|
-
return start <= end;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
public isBefore(other: OffsetRange): boolean {
|
|
144
|
-
return this.endExclusive <= other.start;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
public isAfter(other: OffsetRange): boolean {
|
|
148
|
-
return this.start >= other.endExclusive;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
public slice<T>(arr: readonly T[]): T[] {
|
|
152
|
-
return arr.slice(this.start, this.endExclusive);
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
public substring(str: string): string {
|
|
156
|
-
return str.substring(this.start, this.endExclusive);
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
/**
|
|
160
|
-
* Returns the given value if it is contained in this instance, otherwise the closest value that is contained.
|
|
161
|
-
* The range must not be empty.
|
|
162
|
-
*/
|
|
163
|
-
public clip(value: number): number {
|
|
164
|
-
if (this.isEmpty) {
|
|
165
|
-
throw new BugIndicatingError(`Invalid clipping range: ${this.toString()}`);
|
|
166
|
-
}
|
|
167
|
-
return Math.max(this.start, Math.min(this.endExclusive - 1, value));
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
/**
|
|
171
|
-
* Returns `r := value + k * length` such that `r` is contained in this range.
|
|
172
|
-
* The range must not be empty.
|
|
173
|
-
*
|
|
174
|
-
* E.g. `[5, 10).clipCyclic(10) === 5`, `[5, 10).clipCyclic(11) === 6` and `[5, 10).clipCyclic(4) === 9`.
|
|
175
|
-
*/
|
|
176
|
-
public clipCyclic(value: number): number {
|
|
177
|
-
if (this.isEmpty) {
|
|
178
|
-
throw new BugIndicatingError(`Invalid clipping range: ${this.toString()}`);
|
|
179
|
-
}
|
|
180
|
-
if (value < this.start) {
|
|
181
|
-
return this.endExclusive - ((this.start - value) % this.length);
|
|
182
|
-
}
|
|
183
|
-
if (value >= this.endExclusive) {
|
|
184
|
-
return this.start + ((value - this.start) % this.length);
|
|
185
|
-
}
|
|
186
|
-
return value;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
public map<T>(f: (offset: number) => T): T[] {
|
|
190
|
-
const result: T[] = [];
|
|
191
|
-
for (let i = this.start; i < this.endExclusive; i++) {
|
|
192
|
-
result.push(f(i));
|
|
193
|
-
}
|
|
194
|
-
return result;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
public forEach(f: (offset: number) => void): void {
|
|
198
|
-
for (let i = this.start; i < this.endExclusive; i++) {
|
|
199
|
-
f(i);
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
/**
|
|
204
|
-
* this: [ 5, 10), range: [10, 15) => [5, 15)]
|
|
205
|
-
* Throws if the ranges are not touching.
|
|
206
|
-
*/
|
|
207
|
-
public joinRightTouching(range: OffsetRange): OffsetRange {
|
|
208
|
-
if (this.endExclusive !== range.start) {
|
|
209
|
-
throw new BugIndicatingError(`Invalid join: ${this.toString()} and ${range.toString()}`);
|
|
210
|
-
}
|
|
211
|
-
return new OffsetRange(this.start, range.endExclusive);
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
export class OffsetRangeSet {
|
|
216
|
-
private readonly _sortedRanges: OffsetRange[] = [];
|
|
217
|
-
|
|
218
|
-
public get ranges(): OffsetRange[] {
|
|
219
|
-
return [...this._sortedRanges];
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
public addRange(range: OffsetRange): void {
|
|
223
|
-
let i = 0;
|
|
224
|
-
while (i < this._sortedRanges.length && this._sortedRanges[i].endExclusive < range.start) {
|
|
225
|
-
i++;
|
|
226
|
-
}
|
|
227
|
-
let j = i;
|
|
228
|
-
while (j < this._sortedRanges.length && this._sortedRanges[j].start <= range.endExclusive) {
|
|
229
|
-
j++;
|
|
230
|
-
}
|
|
231
|
-
if (i === j) {
|
|
232
|
-
this._sortedRanges.splice(i, 0, range);
|
|
233
|
-
} else {
|
|
234
|
-
const start = Math.min(range.start, this._sortedRanges[i].start);
|
|
235
|
-
const end = Math.max(range.endExclusive, this._sortedRanges[j - 1].endExclusive);
|
|
236
|
-
this._sortedRanges.splice(i, j - i, new OffsetRange(start, end));
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
public toString(): string {
|
|
241
|
-
return this._sortedRanges.map(r => r.toString()).join(', ');
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
/**
|
|
245
|
-
* Returns of there is a value that is contained in this instance and the given range.
|
|
246
|
-
*/
|
|
247
|
-
public intersectsStrict(other: OffsetRange): boolean {
|
|
248
|
-
// TODO use binary search
|
|
249
|
-
let i = 0;
|
|
250
|
-
while (i < this._sortedRanges.length && this._sortedRanges[i].endExclusive <= other.start) {
|
|
251
|
-
i++;
|
|
252
|
-
}
|
|
253
|
-
return i < this._sortedRanges.length && this._sortedRanges[i].start < other.endExclusive;
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
public intersectWithRange(other: OffsetRange): OffsetRangeSet {
|
|
257
|
-
// TODO use binary search + slice
|
|
258
|
-
const result = new OffsetRangeSet();
|
|
259
|
-
for (const range of this._sortedRanges) {
|
|
260
|
-
const intersection = range.intersect(other);
|
|
261
|
-
if (intersection) {
|
|
262
|
-
result.addRange(intersection);
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
return result;
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
public intersectWithRangeLength(other: OffsetRange): number {
|
|
269
|
-
return this.intersectWithRange(other).length;
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
public get length(): number {
|
|
273
|
-
return this._sortedRanges.reduce((prev, cur) => prev + cur.length, 0);
|
|
274
|
-
}
|
|
275
|
-
}
|