@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,205 +0,0 @@
|
|
|
1
|
-
/*---------------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
4
|
-
*--------------------------------------------------------------------------------------------*/
|
|
5
|
-
import type { CancellationToken, NotebookCell, NotebookDocument, Uri } from 'vscode';
|
|
6
|
-
import { getLanguage } from '../../../util/common/languages';
|
|
7
|
-
import { isUri } from '../../../util/common/types';
|
|
8
|
-
import { EndOfLine, NotebookCellKind, Position } from '../../../util/common/test/shims/vscodeTypesShim';
|
|
9
|
-
import { BaseAlternativeNotebookContentProvider } from './alternativeContentProvider';
|
|
10
|
-
import { AlternativeNotebookDocument } from './alternativeNotebookDocument';
|
|
11
|
-
import { EOL, getCellIdMap, getDefaultLanguage, LineOfCellText, LineOfText, summarize, SummaryCell } from './helpers';
|
|
12
|
-
import { findLast } from '../../../util/vs/base/common/arraysFind';
|
|
13
|
-
|
|
14
|
-
const StartDelimter = `<VSCode.Cell `;
|
|
15
|
-
const StartEmptyCellDelimter = `<VSCode.Cell>`;
|
|
16
|
-
const EndDelimter = `</VSCode.Cell>`;
|
|
17
|
-
|
|
18
|
-
function generatePartialStartDelimiterWithId(id: string) {
|
|
19
|
-
return `${StartDelimter}id="${id}" `;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
function generateCellMarker(cell: SummaryCell) {
|
|
23
|
-
return `${generatePartialStartDelimiterWithId(cell.id)}language="${cell.language}">`;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export function isXmlContent(text: string): boolean {
|
|
27
|
-
return text.includes(StartDelimter) || text.includes(EndDelimter) || text.includes(StartEmptyCellDelimter);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
class AlternativeXmlDocument extends AlternativeNotebookDocument {
|
|
32
|
-
constructor(text: string, private readonly cellOffsetMap: { offset: number; cell: NotebookCell }[], notebook: NotebookDocument) {
|
|
33
|
-
super(text, notebook);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
override fromCellPosition(cell: NotebookCell, position: Position): Position {
|
|
37
|
-
const cellSummary = summarize(cell);
|
|
38
|
-
const cellMarker = generateCellMarker(cellSummary);
|
|
39
|
-
|
|
40
|
-
const eolLength = cell.document.eol === EndOfLine.LF ? 1 : 2;
|
|
41
|
-
|
|
42
|
-
const alternativeContentText = this.getText();
|
|
43
|
-
const offsetInCell = cell.document.offsetAt(position);
|
|
44
|
-
const offset = alternativeContentText.indexOf(cellMarker) + cellMarker.length + eolLength + offsetInCell;
|
|
45
|
-
return this.positionAt(offset);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
override toCellPosition(position: Position): { cell: NotebookCell; position: Position } | undefined {
|
|
49
|
-
const offset = this.offsetAt(position);
|
|
50
|
-
const cell = findLast(this.cellOffsetMap, (cell) => cell.offset <= offset);
|
|
51
|
-
if (!cell) {
|
|
52
|
-
return undefined;
|
|
53
|
-
}
|
|
54
|
-
const cellPosition = cell.cell.document.positionAt(offset - cell.offset);
|
|
55
|
-
return { cell: cell.cell, position: cellPosition };
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
export class AlternativeXmlNotebookContentProvider extends BaseAlternativeNotebookContentProvider {
|
|
60
|
-
constructor() {
|
|
61
|
-
super('xml');
|
|
62
|
-
}
|
|
63
|
-
public stripCellMarkers(text: string): string {
|
|
64
|
-
const lines = text.split(EOL);
|
|
65
|
-
if (lines.length && (lines[0].startsWith(StartDelimter) || lines[0].startsWith(StartEmptyCellDelimter))) {
|
|
66
|
-
lines.shift();
|
|
67
|
-
}
|
|
68
|
-
if (lines.length && lines[lines.length - 1].trim().endsWith(EndDelimter)) {
|
|
69
|
-
lines[lines.length - 1] = lines[lines.length - 1].substring(0, lines[lines.length - 1].lastIndexOf(EndDelimter));
|
|
70
|
-
}
|
|
71
|
-
return lines.join(EOL);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
public override getSummaryOfStructure(notebook: NotebookDocument, cellsToInclude: NotebookCell[], existingCodeMarker: string): string {
|
|
75
|
-
const lines: string[] = [];
|
|
76
|
-
const existingCodeMarkerWithComment = `// ${existingCodeMarker}`;
|
|
77
|
-
notebook.getCells().forEach((cell) => {
|
|
78
|
-
if (cellsToInclude.includes(cell)) {
|
|
79
|
-
const cellSummary = summarize(cell);
|
|
80
|
-
lines.push(generateCellMarker(cellSummary));
|
|
81
|
-
if (cellSummary.source.length && cellSummary.source[0].trim().length) {
|
|
82
|
-
lines.push(cellSummary.source[0]);
|
|
83
|
-
lines.push(existingCodeMarkerWithComment);
|
|
84
|
-
} else if (cellSummary.source.length && cellSummary.source.some(line => line.trim().length)) {
|
|
85
|
-
cellSummary.source = [existingCodeMarkerWithComment, cellSummary.source.filter(line => line.trim().length)[0], existingCodeMarkerWithComment];
|
|
86
|
-
} else {
|
|
87
|
-
lines.push(existingCodeMarkerWithComment);
|
|
88
|
-
}
|
|
89
|
-
lines.push(EndDelimter);
|
|
90
|
-
} else if (!lines.length || lines[lines.length - 1] !== existingCodeMarkerWithComment) {
|
|
91
|
-
lines.push(existingCodeMarkerWithComment);
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
|
-
return lines.join(EOL);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
public async *parseAlternateContent(notebookOrUri: NotebookDocument | Uri, inputStream: AsyncIterable<LineOfText>, token: CancellationToken): AsyncIterable<LineOfCellText> {
|
|
98
|
-
const isNotebook = !isUri(notebookOrUri);
|
|
99
|
-
const cellIdMap = isNotebook ? getCellIdMap(notebookOrUri) : new Map<string, NotebookCell>();
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
let index = -1;
|
|
103
|
-
let endDelimiterSeen = false;
|
|
104
|
-
const cellIdsSeen = new Set<string>();
|
|
105
|
-
let previousLineEndedWithEndCellMarker = false;
|
|
106
|
-
let previousLine: LineOfCellText | undefined = undefined;
|
|
107
|
-
const defaultLanguage = isNotebook ? getLanguage(getDefaultLanguage(notebookOrUri)).languageId : undefined;
|
|
108
|
-
for await (const lineOfText of inputStream) {
|
|
109
|
-
if (token.isCancellationRequested) {
|
|
110
|
-
break;
|
|
111
|
-
}
|
|
112
|
-
const line = lineOfText.value;
|
|
113
|
-
if ((line.startsWith(StartDelimter) || line.startsWith(StartEmptyCellDelimter)) && (index < 0 || (endDelimiterSeen || (previousLineEndedWithEndCellMarker && previousLine)))) {
|
|
114
|
-
if (!endDelimiterSeen && previousLineEndedWithEndCellMarker && previousLine) {
|
|
115
|
-
// Last line didn't finish, emit that, but strip the end delimiter.
|
|
116
|
-
previousLine.line = previousLine.line.substring(0, previousLine.line.lastIndexOf(EndDelimter));
|
|
117
|
-
yield previousLine;
|
|
118
|
-
yield { type: 'end', index: previousLine.index };
|
|
119
|
-
}
|
|
120
|
-
previousLineEndedWithEndCellMarker = false;
|
|
121
|
-
previousLine = undefined;
|
|
122
|
-
|
|
123
|
-
index += 1;
|
|
124
|
-
endDelimiterSeen = false;
|
|
125
|
-
const lineOfCellText: LineOfCellText = { type: 'start', index, uri: undefined, language: undefined, kind: NotebookCellKind.Code };
|
|
126
|
-
const cellParts = extractCellParts(line, defaultLanguage);
|
|
127
|
-
// LLM returns duplicate cell with the same id.
|
|
128
|
-
// We need tests for this.
|
|
129
|
-
// this is a work around to treat subsequent cells as new cells.
|
|
130
|
-
if (cellParts.id && cellIdMap.get(cellParts.id)?.document.languageId === cellParts.language) {
|
|
131
|
-
if (cellIdsSeen.has(cellParts.id)) {
|
|
132
|
-
cellParts.id = '';
|
|
133
|
-
} else {
|
|
134
|
-
cellIdsSeen.add(cellParts.id);
|
|
135
|
-
}
|
|
136
|
-
} else {
|
|
137
|
-
// Possible duplicate cell with the same id but different language.
|
|
138
|
-
// In such cases, treat them as new cells.
|
|
139
|
-
cellParts.id = '';
|
|
140
|
-
}
|
|
141
|
-
const cell = cellIdMap.get(cellParts.id)?.document.languageId === cellParts.language ? cellIdMap.get(cellParts.id) : undefined;
|
|
142
|
-
lineOfCellText.id = cellParts.id;
|
|
143
|
-
lineOfCellText.language = cellParts.language;
|
|
144
|
-
lineOfCellText.uri = cell?.document.uri;
|
|
145
|
-
lineOfCellText.kind = cell?.kind || (lineOfCellText.language === 'markdown' ? NotebookCellKind.Markup : NotebookCellKind.Code);
|
|
146
|
-
yield lineOfCellText;
|
|
147
|
-
} else if (line.startsWith(EndDelimter)) {
|
|
148
|
-
if (previousLineEndedWithEndCellMarker && previousLine) {
|
|
149
|
-
// The last line somehow ends with the cell marker (must have been added by the user),
|
|
150
|
-
// yield the previous line.
|
|
151
|
-
yield previousLine;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
endDelimiterSeen = true;
|
|
155
|
-
previousLineEndedWithEndCellMarker = false;
|
|
156
|
-
previousLine = undefined;
|
|
157
|
-
yield { type: 'end', index };
|
|
158
|
-
} else if (index >= 0) {
|
|
159
|
-
if (previousLineEndedWithEndCellMarker && previousLine) {
|
|
160
|
-
// Some how we have two subsequent lines that end with the cell marker,
|
|
161
|
-
// Weird, shoudl not happen, if it does, yield the previous line.
|
|
162
|
-
yield previousLine;
|
|
163
|
-
previousLine = undefined;
|
|
164
|
-
}
|
|
165
|
-
previousLineEndedWithEndCellMarker = line.endsWith(EndDelimter);
|
|
166
|
-
if (previousLineEndedWithEndCellMarker) {
|
|
167
|
-
previousLine = { type: 'line', index, line };
|
|
168
|
-
} else {
|
|
169
|
-
yield { type: 'line', index, line };
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
public override getAlternativeDocument(notebook: NotebookDocument, excludeMarkdownCells?: boolean): AlternativeNotebookDocument {
|
|
176
|
-
const cells = notebook.getCells().filter(cell => excludeMarkdownCells ? cell.kind !== NotebookCellKind.Markup : true).map(cell => summarize(cell));
|
|
177
|
-
|
|
178
|
-
const cellContent = cells.map(cell => {
|
|
179
|
-
const cellMarker = generateCellMarker(cell);
|
|
180
|
-
const prefix = `${cellMarker}${EOL}`;
|
|
181
|
-
return { content: `${prefix}${cell.source.join(EOL)}${EOL}${EndDelimter}`, prefix, cell: notebook.cellAt(cell.index) };
|
|
182
|
-
});
|
|
183
|
-
const content = cellContent.map(cell => cell.content).join(EOL);
|
|
184
|
-
const cellOffsetMap = cellContent.map(cellContent => ({ offset: content.indexOf(cellContent.content) + cellContent.prefix.length, cell: cellContent.cell }));
|
|
185
|
-
|
|
186
|
-
return new AlternativeXmlDocument(content, cellOffsetMap, notebook);
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
function extractCellParts(line: string, defaultLanguage: string | undefined): { id: string; language: string } {
|
|
193
|
-
const idMatch = line.match(/id="([^"]+)"/);
|
|
194
|
-
const languageMatch = line.match(/language="([^"]+)"/);
|
|
195
|
-
if (!languageMatch) {
|
|
196
|
-
if (isXmlContent(line) && typeof defaultLanguage === 'string') {
|
|
197
|
-
// If we have a cell marker but no language, we assume the default language.
|
|
198
|
-
return { id: idMatch ? idMatch[1].trim() : '', language: defaultLanguage };
|
|
199
|
-
}
|
|
200
|
-
throw new Error(`Invalid cell part in ${line}`);
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
// New cells will not have an id.
|
|
204
|
-
return { id: idMatch ? idMatch[1].trim() : '', language: languageMatch[1].trim() };
|
|
205
|
-
}
|
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
/*---------------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
4
|
-
*--------------------------------------------------------------------------------------------*/
|
|
5
|
-
|
|
6
|
-
import type { NotebookCell, NotebookDocument, TextLine } from 'vscode';
|
|
7
|
-
import { DEFAULT_WORD_REGEXP, getWordAtText } from '../../../util/vs/editor/common/core/wordHelper';
|
|
8
|
-
import { Position, Range } from '../../../util/common/test/shims/vscodeTypesShim';
|
|
9
|
-
import { PositionOffsetTransformer } from '../../editing/common/positionOffsetTransformer';
|
|
10
|
-
import { SnapshotDocumentLine } from '../../editing/common/textDocumentSnapshot';
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
export abstract class AlternativeNotebookDocument {
|
|
14
|
-
private _transformer: PositionOffsetTransformer | null = null;
|
|
15
|
-
private get transformer(): PositionOffsetTransformer {
|
|
16
|
-
if (!this._transformer) {
|
|
17
|
-
this._transformer = new PositionOffsetTransformer(this._text);
|
|
18
|
-
}
|
|
19
|
-
return this._transformer;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
getText(range?: Range): string {
|
|
23
|
-
return range ? this._getTextInRange(range) : this._text;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
private _getTextInRange(_range: Range): string {
|
|
27
|
-
const range = this.validateRange(_range);
|
|
28
|
-
|
|
29
|
-
if (range.isEmpty) {
|
|
30
|
-
return '';
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const offsetRange = this.transformer.toOffsetRange(range);
|
|
34
|
-
return this._text.substring(offsetRange.start, offsetRange.endExclusive);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
constructor(protected readonly _text: string, protected readonly notebook: NotebookDocument) {
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
protected positionToOffset(position: Position): number {
|
|
42
|
-
position = this.validatePosition(position);
|
|
43
|
-
return this.transformer.getOffset(position);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Translates a position in the notebook document to the corresponding alternative position.
|
|
48
|
-
*/
|
|
49
|
-
abstract fromCellPosition(cell: NotebookCell, position: Position): Position;
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Translates a position in the alternative document to the corresponding cell index and position in the notebook document.
|
|
53
|
-
*/
|
|
54
|
-
abstract toCellPosition(position: Position): { cell: NotebookCell; position: Position } | undefined;
|
|
55
|
-
|
|
56
|
-
getWordRangeAtPosition(_position: Position): Range | undefined {
|
|
57
|
-
const position = this.validatePosition(_position);
|
|
58
|
-
|
|
59
|
-
const wordAtText = getWordAtText(
|
|
60
|
-
position.character + 1,
|
|
61
|
-
DEFAULT_WORD_REGEXP,
|
|
62
|
-
this.lines[position.line],
|
|
63
|
-
0
|
|
64
|
-
);
|
|
65
|
-
|
|
66
|
-
if (wordAtText) {
|
|
67
|
-
return new Range(position.line, wordAtText.startColumn - 1, position.line, wordAtText.endColumn - 1);
|
|
68
|
-
}
|
|
69
|
-
return undefined;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
private _lines: string[] | null = null;
|
|
74
|
-
|
|
75
|
-
get lines(): string[] {
|
|
76
|
-
if (!this._lines) {
|
|
77
|
-
this._lines = this._text.split(/\r\n|\r|\n/g);
|
|
78
|
-
}
|
|
79
|
-
return this._lines;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
get lineCount(): number {
|
|
83
|
-
return this.lines.length;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
lineAt(line: number): TextLine;
|
|
87
|
-
lineAt(position: Position): TextLine;
|
|
88
|
-
lineAt(lineOrPosition: number | Position): TextLine {
|
|
89
|
-
let line: number | undefined;
|
|
90
|
-
if (lineOrPosition instanceof Position) {
|
|
91
|
-
line = lineOrPosition.line;
|
|
92
|
-
} else if (typeof lineOrPosition === 'number') {
|
|
93
|
-
line = lineOrPosition;
|
|
94
|
-
} else {
|
|
95
|
-
throw new Error(`Invalid argument`);
|
|
96
|
-
}
|
|
97
|
-
if (line < 0 || line >= this.lines.length) {
|
|
98
|
-
throw new Error('Illegal value for `line`');
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
return new SnapshotDocumentLine(line, this.lines[line], line === this.lines.length - 1);
|
|
102
|
-
}
|
|
103
|
-
offsetAt(position: Position): number {
|
|
104
|
-
return this.transformer.getOffset(position);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
positionAt(offset: number): Position {
|
|
108
|
-
offset = Math.floor(offset);
|
|
109
|
-
offset = Math.max(0, offset);
|
|
110
|
-
|
|
111
|
-
return this.transformer.getPosition(offset);
|
|
112
|
-
}
|
|
113
|
-
validateRange(range: Range): Range {
|
|
114
|
-
const start = this.validatePosition(range.start);
|
|
115
|
-
const end = this.validatePosition(range.end);
|
|
116
|
-
|
|
117
|
-
if (start === range.start && end === range.end) {
|
|
118
|
-
return range;
|
|
119
|
-
}
|
|
120
|
-
return new Range(start.line, start.character, end.line, end.character);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
validatePosition(position: Position): Position {
|
|
124
|
-
if (this._text.length === 0) {
|
|
125
|
-
return position.with(0, 0);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
let { line, character } = position;
|
|
129
|
-
let hasChanged = false;
|
|
130
|
-
|
|
131
|
-
if (line < 0) {
|
|
132
|
-
line = 0;
|
|
133
|
-
character = 0;
|
|
134
|
-
hasChanged = true;
|
|
135
|
-
} else if (line >= this.lines.length) {
|
|
136
|
-
line = this.lines.length - 1;
|
|
137
|
-
character = this.lines[line].length;
|
|
138
|
-
hasChanged = true;
|
|
139
|
-
} else {
|
|
140
|
-
const maxCharacter = this.lines[line].length;
|
|
141
|
-
if (character < 0) {
|
|
142
|
-
character = 0;
|
|
143
|
-
hasChanged = true;
|
|
144
|
-
} else if (character > maxCharacter) {
|
|
145
|
-
character = maxCharacter;
|
|
146
|
-
hasChanged = true;
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
if (!hasChanged) {
|
|
151
|
-
return position;
|
|
152
|
-
}
|
|
153
|
-
return new Position(line, character);
|
|
154
|
-
}
|
|
155
|
-
}
|
|
@@ -1,212 +0,0 @@
|
|
|
1
|
-
/*---------------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
4
|
-
*--------------------------------------------------------------------------------------------*/
|
|
5
|
-
|
|
6
|
-
import type { ChatRequest, NotebookCell, NotebookDocument, TextDocument, Uri } from 'vscode';
|
|
7
|
-
import { isLocation, isUri } from '../../../util/common/types';
|
|
8
|
-
import { StringSHA1 } from '../../../util/vs/base/common/hash';
|
|
9
|
-
import { removeAnsiEscapeCodes } from '../../../util/vs/base/common/strings';
|
|
10
|
-
import { isUriComponents, URI } from '../../../util/vs/base/common/uri';
|
|
11
|
-
import { NotebookCellData, NotebookCellKind } from '../../../util/common/test/shims/vscodeTypesShim';
|
|
12
|
-
import { INotebookService } from './notebookService';
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
export class LineOfText {
|
|
16
|
-
readonly __lineOfTextBrand: void = undefined;
|
|
17
|
-
public readonly value: string;
|
|
18
|
-
constructor(
|
|
19
|
-
value: string
|
|
20
|
-
) {
|
|
21
|
-
this.value = value.replace(/\r$/, '');
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/** End of Line for alternative Notebook contnt is always \n */
|
|
26
|
-
export const EOL = '\n';
|
|
27
|
-
export type LineOfCellText = {
|
|
28
|
-
type: 'start';
|
|
29
|
-
/**
|
|
30
|
-
* The cell index of the cell that this line belongs to.
|
|
31
|
-
*/
|
|
32
|
-
index: number;
|
|
33
|
-
id?: string;
|
|
34
|
-
/**
|
|
35
|
-
* The Uri of the cell that this line belongs to.
|
|
36
|
-
* Undefined if this is a cell that doesn't belong in the actual notebook.
|
|
37
|
-
*/
|
|
38
|
-
uri?: Uri;
|
|
39
|
-
/**
|
|
40
|
-
* Language of the cell.
|
|
41
|
-
*/
|
|
42
|
-
language?: string;
|
|
43
|
-
/**
|
|
44
|
-
* The type of cell.
|
|
45
|
-
*/
|
|
46
|
-
kind: NotebookCellKind;
|
|
47
|
-
} | {
|
|
48
|
-
type: 'line';
|
|
49
|
-
/**
|
|
50
|
-
* A line of text from a cell. Does not include the newline character.
|
|
51
|
-
*/
|
|
52
|
-
line: string;
|
|
53
|
-
/**
|
|
54
|
-
* The cell index of the cell that this line belongs to.
|
|
55
|
-
*/
|
|
56
|
-
index: number;
|
|
57
|
-
} | {
|
|
58
|
-
type: 'end';
|
|
59
|
-
/**
|
|
60
|
-
*
|
|
61
|
-
* The cell index of the cell that this line belongs to.
|
|
62
|
-
*/
|
|
63
|
-
index: number;
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
export type SummaryCell = {
|
|
67
|
-
cell_type: 'code' | 'markdown';
|
|
68
|
-
language: string;
|
|
69
|
-
id: string;
|
|
70
|
-
source: string[];
|
|
71
|
-
index: number;
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
export function summarize(cell: NotebookCell): SummaryCell {
|
|
75
|
-
const cellType = cell.kind === NotebookCellKind.Code ? 'code' : 'markdown';
|
|
76
|
-
const id = getCellId(cell);
|
|
77
|
-
const source = getCellCode(cell.document);
|
|
78
|
-
return { cell_type: cellType, id, language: cell.document.languageId, source, index: cell.index };
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
export function notebookCellToCellData(cell: NotebookCell): NotebookCellData {
|
|
82
|
-
const cellData = new NotebookCellData(cell.kind, cell.document.getText(), cell.document.languageId);
|
|
83
|
-
cellData.metadata = cell.metadata;
|
|
84
|
-
cellData.executionSummary = cell.executionSummary;
|
|
85
|
-
if (cell.outputs.length) {
|
|
86
|
-
cellData.outputs = [...cell.outputs];
|
|
87
|
-
}
|
|
88
|
-
return cellData;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
export function getCellIdMap(notebook: NotebookDocument): Map<string, NotebookCell> {
|
|
92
|
-
const cellIdMap = new Map<string, NotebookCell>();
|
|
93
|
-
notebook.getCells().forEach(cell => {
|
|
94
|
-
cellIdMap.set(getCellId(cell), cell);
|
|
95
|
-
});
|
|
96
|
-
return cellIdMap;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
const cellIdCache = new WeakMap<NotebookCell, string>();
|
|
100
|
-
|
|
101
|
-
/** The length of the hash portion of cell IDs */
|
|
102
|
-
const CELL_ID_HASH_LENGTH = 8;
|
|
103
|
-
|
|
104
|
-
/** Use a unique enough cell id prefix so that we can easily identify cell ids*/
|
|
105
|
-
const CELL_ID_PREFIX = '#VSC-';
|
|
106
|
-
|
|
107
|
-
/** RegExp to match all Cell Ids */
|
|
108
|
-
export const CellIdPatternRe = new RegExp(`(\\s+|^|\\b|\\W)(#VSC-[a-f0-9]{${CELL_ID_HASH_LENGTH}})\\b`, 'gi');
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* Sometimes the model may return a cellId that is not in the expected format.
|
|
112
|
-
* This function attempts to convert such cellIds to the expected format.
|
|
113
|
-
*/
|
|
114
|
-
export function normalizeCellId(cellId: string): string {
|
|
115
|
-
if (cellId.startsWith(CELL_ID_PREFIX)) {
|
|
116
|
-
return cellId;
|
|
117
|
-
}
|
|
118
|
-
if (cellId.startsWith('VSC-')) {
|
|
119
|
-
return `#${cellId}`;
|
|
120
|
-
}
|
|
121
|
-
if (cellId.startsWith('#V-') && cellId.length === (CELL_ID_HASH_LENGTH + 3)) {
|
|
122
|
-
return `${CELL_ID_PREFIX}${cellId.substring(3)}`;
|
|
123
|
-
}
|
|
124
|
-
if (cellId.toLowerCase().startsWith('vscode-') && cellId.length === (CELL_ID_HASH_LENGTH + 7)) {
|
|
125
|
-
return `${CELL_ID_PREFIX}${cellId.substring(7)}`;
|
|
126
|
-
}
|
|
127
|
-
if (cellId.startsWith('-')) {
|
|
128
|
-
return `#VSC${cellId}`;
|
|
129
|
-
}
|
|
130
|
-
// Possible case where the cellId is just a hash without the prefix
|
|
131
|
-
return cellId.length === CELL_ID_HASH_LENGTH ? `${CELL_ID_PREFIX}${cellId}` : cellId;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
const notebookIdCache = new WeakMap<NotebookDocument, string>();
|
|
135
|
-
export function getNotebookId(notebook: NotebookDocument): string {
|
|
136
|
-
let id = notebookIdCache.get(notebook);
|
|
137
|
-
if (id) {
|
|
138
|
-
return id;
|
|
139
|
-
}
|
|
140
|
-
const hash = new StringSHA1();
|
|
141
|
-
hash.update(notebook.uri.toString());
|
|
142
|
-
id = hash.digest();
|
|
143
|
-
notebookIdCache.set(notebook, id);
|
|
144
|
-
return id;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
/**
|
|
148
|
-
* Given a Notebook cell returns a unique identifier for the cell.
|
|
149
|
-
* The identifier is based on the cell's URI and is cached for performance.
|
|
150
|
-
* This is useful for tracking cells across sessions or for referencing cells in a consistent manner.
|
|
151
|
-
* The cell Id will have a specicial prefix as well do as to easily identify it as a cell Id.
|
|
152
|
-
*/
|
|
153
|
-
export function getCellId(cell: NotebookCell): string {
|
|
154
|
-
let oldId = cellIdCache.get(cell);
|
|
155
|
-
if (oldId) {
|
|
156
|
-
return oldId;
|
|
157
|
-
}
|
|
158
|
-
const hash = new StringSHA1();
|
|
159
|
-
hash.update(cell.document.uri.toString());
|
|
160
|
-
oldId = `${CELL_ID_PREFIX}${hash.digest().substring(0, CELL_ID_HASH_LENGTH)}`;
|
|
161
|
-
cellIdCache.set(cell, oldId);
|
|
162
|
-
return oldId;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
function getCellCode(document: TextDocument): string[] {
|
|
166
|
-
if (document.lineCount === 0) {
|
|
167
|
-
return [];
|
|
168
|
-
}
|
|
169
|
-
return new Array(document.lineCount).fill('').map((_, i) => document.lineAt(i).text);
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
export function getDefaultLanguage(notebook: NotebookDocument): string | undefined {
|
|
173
|
-
const codeCell = notebook.getCells().find(cell => cell.kind === NotebookCellKind.Code);
|
|
174
|
-
if (codeCell) {
|
|
175
|
-
return codeCell.document.languageId;
|
|
176
|
-
}
|
|
177
|
-
// Fallback for Jupyter Notebooks that do not have a code cell.
|
|
178
|
-
if (notebook.notebookType === 'jupyter-notebook') {
|
|
179
|
-
return notebook.metadata?.language_info?.name || notebook.metadata?.kernelspec?.language || 'python';
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
const notebookTermsToLookFor = ['jupyter', 'notebook', 'cell.', 'cells.', ' cell ', 'cells', 'notebook cell'];
|
|
185
|
-
export function requestHasNotebookRefs(request: ChatRequest, notebookService: INotebookService, options?: { checkPromptAsWell: boolean }): boolean {
|
|
186
|
-
const prompt = (request.prompt || '').toLowerCase();
|
|
187
|
-
if (options?.checkPromptAsWell && notebookTermsToLookFor.some(term => prompt.includes(term))) {
|
|
188
|
-
return true;
|
|
189
|
-
}
|
|
190
|
-
return request.references.some(ref => {
|
|
191
|
-
if (isLocation(ref.value)) {
|
|
192
|
-
return notebookService.hasSupportedNotebooks(ref.value.uri);
|
|
193
|
-
}
|
|
194
|
-
if (isUriComponents(ref.value)) {
|
|
195
|
-
return notebookService.hasSupportedNotebooks(URI.revive(ref.value));
|
|
196
|
-
}
|
|
197
|
-
if (isUri(ref.value)) {
|
|
198
|
-
return notebookService.hasSupportedNotebooks(ref.value);
|
|
199
|
-
}
|
|
200
|
-
return false;
|
|
201
|
-
});
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
export function parseAndCleanStack(jsonString: string): string {
|
|
205
|
-
try {
|
|
206
|
-
// Parse the JSON string
|
|
207
|
-
const parsed = JSON.parse(jsonString) as Partial<Error>;
|
|
208
|
-
return removeAnsiEscapeCodes(parsed?.stack || parsed.message || '') || parsed.message || parsed.name || jsonString;
|
|
209
|
-
} catch {
|
|
210
|
-
return jsonString; // Return the original string if parsing fails
|
|
211
|
-
}
|
|
212
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/*---------------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
4
|
-
*--------------------------------------------------------------------------------------------*/
|
|
5
|
-
|
|
6
|
-
import type { NotebookCell, Uri } from 'vscode';
|
|
7
|
-
import { createServiceIdentifier } from '../../../util/common/services';
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
export interface Variable {
|
|
11
|
-
name: string;
|
|
12
|
-
value: string;
|
|
13
|
-
type?: string;
|
|
14
|
-
summary?: string;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export interface VariablesResult {
|
|
18
|
-
variable: Variable;
|
|
19
|
-
hasNamedChildren: boolean;
|
|
20
|
-
indexedChildrenCount: number;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export interface PipPackage {
|
|
24
|
-
name: string;
|
|
25
|
-
version: string;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export const INotebookService = createServiceIdentifier<INotebookService>('INotebookService');
|
|
29
|
-
|
|
30
|
-
export interface INotebookService {
|
|
31
|
-
readonly _serviceBrand: undefined;
|
|
32
|
-
getVariables(notebook: Uri): Promise<VariablesResult[]>;
|
|
33
|
-
getPipPackages(notebook: Uri): Promise<PipPackage[]>;
|
|
34
|
-
getCellExecutions(notebook: Uri): NotebookCell[];
|
|
35
|
-
runCells(notebook: Uri, range: { start: number; end: number }, autoReveal: boolean): Promise<void>;
|
|
36
|
-
trackAgentUsage(): void;
|
|
37
|
-
setFollowState(state: boolean): void;
|
|
38
|
-
getFollowState(): boolean;
|
|
39
|
-
ensureKernelSelected(notebook: Uri): Promise<void>;
|
|
40
|
-
hasSupportedNotebooks(uri: Uri): boolean;
|
|
41
|
-
// testing utility
|
|
42
|
-
setVariables(notebook: Uri, variables: VariablesResult[]): void;
|
|
43
|
-
}
|