From a810dbe160589ee767b4aebb7b66dfca0fb106e9 Mon Sep 17 00:00:00 2001 From: Nikola Hristov Date: Sun, 3 Nov 2024 21:05:57 +0200 Subject: [PATCH] --- Example/Input/Editor/typings/base-common.d.ts | 20 - Example/Input/Editor/typings/editContext.d.ts | 150 - Example/Input/Editor/typings/thenable.d.ts | 12 - .../Editor/typings/vscode-globals-nls.d.ts | 40 - .../typings/vscode-globals-product.d.ts | 31 - .../Editor/typings/vscode-globals-ttp.d.ts | 20 - .../vs/base/browser/dompurify/dompurify.d.ts | 146 - .../Editor/vs/base/common/marked/marked.d.ts | 704 - .../Editor/vs/base/common/semver/semver.d.ts | 310 - Example/Input/Editor/vs/monaco.d.ts | 8309 ------ .../contrib/debug/common/debugProtocol.d.ts | 2554 -- .../terminal/browser/xterm-private.d.ts | 36 - .../webview/browser/webviewMessages.d.ts | 125 - Example/Input/Editor/vscode-dts/vscode.d.ts | 21097 ---------------- .../vscode.proposed.activeComment.d.ts | 23 - .../vscode.proposed.aiRelatedInformation.d.ts | 68 - .../vscode.proposed.aiTextSearchProvider.d.ts | 49 - .../vscode.proposed.attributableCoverage.d.ts | 51 - .../vscode.proposed.authLearnMore.d.ts | 15 - .../vscode.proposed.authSession.d.ts | 16 - .../vscode.proposed.canonicalUriProvider.d.ts | 57 - ...ode.proposed.chatParticipantAdditions.d.ts | 527 - ...scode.proposed.chatParticipantPrivate.d.ts | 134 - .../vscode.proposed.chatProvider.d.ts | 112 - ...code.proposed.chatReferenceBinaryData.d.ts | 37 - .../vscode-dts/vscode.proposed.chatTab.d.ts | 26 - .../vscode.proposed.chatVariableResolver.d.ts | 110 - .../vscode.proposed.codeActionAI.d.ts | 16 - .../vscode.proposed.codeActionRanges.d.ts | 15 - .../vscode.proposed.codiconDecoration.d.ts | 48 - .../vscode.proposed.commentReactor.d.ts | 13 - .../vscode.proposed.commentReveal.d.ts | 45 - ...e.proposed.commentThreadApplicability.d.ts | 44 - .../vscode.proposed.commentingRangeHint.d.ts | 16 - .../vscode.proposed.commentsDraftState.d.ts | 18 - ...posed.contribAccessibilityHelpContent.d.ts | 15 - ...posed.contribCommentEditorActionsMenu.d.ts | 6 - ...de.proposed.contribCommentPeekContext.d.ts | 8 - ...ed.contribCommentThreadAdditionalMenu.d.ts | 8 - ...oposed.contribCommentsViewThreadMenus.d.ts | 6 - ...posed.contribDebugCreateConfiguration.d.ts | 6 - ...d.contribDiffEditorGutterToolBarMenus.d.ts | 6 - .../vscode.proposed.contribEditSessions.d.ts | 8 - ...ode.proposed.contribEditorContentMenu.d.ts | 6 - .../vscode.proposed.contribIssueReporter.d.ts | 7 - ...contribLabelFormatterWorkspaceTooltip.d.ts | 6 - .../vscode.proposed.contribMenuBarHome.d.ts | 6 - ...code.proposed.contribMergeEditorMenus.d.ts | 6 - ....proposed.contribMultiDiffEditorMenus.d.ts | 6 - ...roposed.contribNotebookStaticPreloads.d.ts | 6 - .../vscode.proposed.contribRemoteHelp.d.ts | 6 - .../vscode.proposed.contribShareMenu.d.ts | 7 - ...d.contribSourceControlHistoryItemMenu.d.ts | 7 - ....contribSourceControlHistoryTitleMenu.d.ts | 7 - ...osed.contribSourceControlInputBoxMenu.d.ts | 7 - ...roposed.contribSourceControlTitleMenu.d.ts | 7 - ...vscode.proposed.contribStatusBarItems.d.ts | 8 - ...de.proposed.contribViewContainerTitle.d.ts | 8 - .../vscode.proposed.contribViewsRemote.d.ts | 6 - .../vscode.proposed.contribViewsWelcome.d.ts | 6 - ...code.proposed.createFileSystemWatcher.d.ts | 51 - .../vscode.proposed.customEditorMove.d.ts | 31 - .../vscode.proposed.debugVisualization.d.ts | 177 - ...scode.proposed.defaultChatParticipant.d.ts | 70 - .../vscode.proposed.diffCommand.d.ts | 40 - .../vscode.proposed.diffContentOptions.d.ts | 16 - ...ode.proposed.documentFiltersExclusive.d.ts | 12 - .../vscode.proposed.documentPaste.d.ts | 332 - ....proposed.editSessionIdentityProvider.d.ts | 79 - ...de.proposed.editorHoverVerbosityLevel.d.ts | 85 - .../vscode.proposed.editorInsets.d.ts | 26 - .../vscode.proposed.embeddings.d.ts | 45 - .../vscode.proposed.extensionRuntime.d.ts | 23 - .../vscode.proposed.extensionsAny.d.ts | 43 - .../vscode.proposed.externalUriOpener.d.ts | 174 - .../vscode.proposed.fileComments.d.ts | 48 - .../vscode.proposed.fileSearchProvider.d.ts | 79 - .../vscode.proposed.fileSearchProvider2.d.ts | 107 - .../vscode.proposed.findFiles2.d.ts | 128 - .../vscode.proposed.findTextInFiles.d.ts | 112 - .../vscode.proposed.findTextInFiles2.d.ts | 149 - .../vscode-dts/vscode.proposed.fsChunks.d.ts | 30 - .../vscode-dts/vscode.proposed.idToken.d.ts | 16 - ...e.proposed.inlineCompletionsAdditions.d.ts | 112 - .../vscode.proposed.inlineEdit.d.ts | 91 - .../vscode.proposed.interactive.d.ts | 10 - .../vscode.proposed.interactiveWindow.d.ts | 34 - .../vscode-dts/vscode.proposed.ipc.d.ts | 34 - .../vscode.proposed.languageModelSystem.d.ts | 16 - .../vscode.proposed.languageStatusText.d.ts | 10 - .../vscode.proposed.mappedEditsProvider.d.ts | 99 - ...oposed.multiDocumentHighlightProvider.d.ts | 66 - ...scode.proposed.newSymbolNamesProvider.d.ts | 53 - ...vscode.proposed.notebookCellExecution.d.ts | 45 - ...e.proposed.notebookCellExecutionState.d.ts | 50 - ...osed.notebookControllerAffinityHidden.d.ts | 20 - .../vscode.proposed.notebookDeprecated.d.ts | 15 - .../vscode.proposed.notebookExecution.d.ts | 38 - .../vscode.proposed.notebookKernelSource.d.ts | 53 - .../vscode.proposed.notebookLiveShare.d.ts | 27 - .../vscode.proposed.notebookMessaging.d.ts | 77 - .../vscode.proposed.notebookMime.d.ts | 32 - .../vscode.proposed.notebookReplDocument.d.ts | 35 - ...ode.proposed.notebookVariableProvider.d.ts | 59 - .../vscode.proposed.portsAttributes.d.ts | 105 - ...scode.proposed.profileContentHandlers.d.ts | 27 - .../vscode.proposed.quickDiffProvider.d.ts | 21 - ...ode.proposed.quickInputButtonLocation.d.ts | 28 - .../vscode.proposed.quickPickItemTooltip.d.ts | 15 - .../vscode.proposed.quickPickSortByLabel.d.ts | 18 - .../vscode-dts/vscode.proposed.resolvers.d.ts | 524 - .../vscode.proposed.scmActionButton.d.ts | 18 - .../vscode.proposed.scmHistoryProvider.d.ts | 105 - .../vscode.proposed.scmMultiDiffEditor.d.ts | 38 - .../vscode.proposed.scmSelectedProvider.d.ts | 20 - .../vscode.proposed.scmTextDocument.d.ts | 18 - .../vscode.proposed.scmValidation.d.ts | 62 - .../vscode.proposed.shareProvider.d.ts | 76 - .../vscode-dts/vscode.proposed.showLocal.d.ts | 18 - .../vscode-dts/vscode.proposed.speech.d.ts | 83 - .../vscode.proposed.tabInputMultiDiff.d.ts | 27 - .../vscode.proposed.tabInputTextMerge.d.ts | 30 - ...vscode.proposed.taskPresentationGroup.d.ts | 15 - .../vscode-dts/vscode.proposed.telemetry.d.ts | 37 - ...scode.proposed.terminalDataWriteEvent.d.ts | 31 - .../vscode.proposed.terminalDimensions.d.ts | 38 - ....proposed.terminalExecuteCommandEvent.d.ts | 47 - ...ode.proposed.terminalQuickFixProvider.d.ts | 97 - .../vscode.proposed.terminalSelection.d.ts | 15 - .../vscode.proposed.testObserver.d.ts | 212 - .../vscode.proposed.testRelatedCode.d.ts | 43 - .../vscode.proposed.textSearchComplete2.d.ts | 38 - .../vscode.proposed.textSearchProvider.d.ts | 288 - .../vscode.proposed.textSearchProvider2.d.ts | 285 - .../vscode-dts/vscode.proposed.timeline.d.ts | 169 - .../vscode.proposed.tokenInformation.d.ts | 28 - .../vscode.proposed.treeViewActiveItem.d.ts | 29 - ...code.proposed.treeViewMarkdownMessage.d.ts | 34 - .../vscode.proposed.treeViewReveal.d.ts | 19 - .../vscode.proposed.tunnelFactory.d.ts | 54 - .../vscode-dts/vscode.proposed.tunnels.d.ts | 65 - .../vscode.proposed.workspaceTrust.d.ts | 31 - .../workbench/workbench.web.main.internal.ts | 29 +- Source/Function/Output.ts | 28 +- Source/Function/Output/Transformer/Visit.ts | 133 +- Source/Function/Output/Visit.ts | 2 +- Target/Function/Output.js | 2 +- Target/Function/Output/Transformer/Visit.js | 2 +- Target/Function/Output/Visit.js | 2 +- 149 files changed, 115 insertions(+), 40909 deletions(-) delete mode 100644 Example/Input/Editor/typings/base-common.d.ts delete mode 100644 Example/Input/Editor/typings/editContext.d.ts delete mode 100644 Example/Input/Editor/typings/thenable.d.ts delete mode 100644 Example/Input/Editor/typings/vscode-globals-nls.d.ts delete mode 100644 Example/Input/Editor/typings/vscode-globals-product.d.ts delete mode 100644 Example/Input/Editor/typings/vscode-globals-ttp.d.ts delete mode 100644 Example/Input/Editor/vs/base/browser/dompurify/dompurify.d.ts delete mode 100644 Example/Input/Editor/vs/base/common/marked/marked.d.ts delete mode 100644 Example/Input/Editor/vs/base/common/semver/semver.d.ts delete mode 100644 Example/Input/Editor/vs/monaco.d.ts delete mode 100644 Example/Input/Editor/vs/workbench/contrib/debug/common/debugProtocol.d.ts delete mode 100644 Example/Input/Editor/vs/workbench/contrib/terminal/browser/xterm-private.d.ts delete mode 100644 Example/Input/Editor/vs/workbench/contrib/webview/browser/webviewMessages.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.activeComment.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.aiRelatedInformation.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.aiTextSearchProvider.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.attributableCoverage.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.authLearnMore.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.authSession.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.canonicalUriProvider.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.chatParticipantAdditions.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.chatParticipantPrivate.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.chatProvider.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.chatReferenceBinaryData.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.chatTab.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.chatVariableResolver.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.codeActionAI.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.codeActionRanges.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.codiconDecoration.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.commentReactor.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.commentReveal.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.commentThreadApplicability.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.commentingRangeHint.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.commentsDraftState.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.contribAccessibilityHelpContent.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.contribCommentEditorActionsMenu.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.contribCommentPeekContext.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.contribCommentThreadAdditionalMenu.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.contribCommentsViewThreadMenus.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.contribDebugCreateConfiguration.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.contribDiffEditorGutterToolBarMenus.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.contribEditSessions.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.contribEditorContentMenu.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.contribIssueReporter.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.contribLabelFormatterWorkspaceTooltip.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.contribMenuBarHome.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.contribMergeEditorMenus.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.contribMultiDiffEditorMenus.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.contribNotebookStaticPreloads.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.contribRemoteHelp.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.contribShareMenu.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.contribSourceControlHistoryItemMenu.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.contribSourceControlHistoryTitleMenu.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.contribSourceControlInputBoxMenu.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.contribSourceControlTitleMenu.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.contribStatusBarItems.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.contribViewContainerTitle.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.contribViewsRemote.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.contribViewsWelcome.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.createFileSystemWatcher.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.customEditorMove.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.debugVisualization.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.defaultChatParticipant.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.diffCommand.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.diffContentOptions.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.documentFiltersExclusive.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.documentPaste.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.editSessionIdentityProvider.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.editorHoverVerbosityLevel.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.editorInsets.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.embeddings.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.extensionRuntime.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.extensionsAny.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.externalUriOpener.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.fileComments.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.fileSearchProvider.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.fileSearchProvider2.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.findFiles2.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.findTextInFiles.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.findTextInFiles2.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.fsChunks.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.idToken.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.inlineCompletionsAdditions.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.inlineEdit.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.interactive.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.interactiveWindow.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.ipc.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.languageModelSystem.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.languageStatusText.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.mappedEditsProvider.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.multiDocumentHighlightProvider.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.newSymbolNamesProvider.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.notebookCellExecution.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.notebookCellExecutionState.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.notebookControllerAffinityHidden.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.notebookDeprecated.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.notebookExecution.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.notebookKernelSource.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.notebookLiveShare.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.notebookMessaging.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.notebookMime.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.notebookReplDocument.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.notebookVariableProvider.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.portsAttributes.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.profileContentHandlers.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.quickDiffProvider.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.quickInputButtonLocation.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.quickPickItemTooltip.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.quickPickSortByLabel.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.resolvers.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.scmActionButton.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.scmHistoryProvider.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.scmMultiDiffEditor.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.scmSelectedProvider.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.scmTextDocument.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.scmValidation.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.shareProvider.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.showLocal.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.speech.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.tabInputMultiDiff.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.tabInputTextMerge.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.taskPresentationGroup.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.telemetry.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.terminalDataWriteEvent.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.terminalDimensions.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.terminalExecuteCommandEvent.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.terminalQuickFixProvider.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.terminalSelection.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.testObserver.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.testRelatedCode.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.textSearchComplete2.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.textSearchProvider.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.textSearchProvider2.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.timeline.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.tokenInformation.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.treeViewActiveItem.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.treeViewMarkdownMessage.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.treeViewReveal.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.tunnelFactory.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.tunnels.d.ts delete mode 100644 Example/Input/Editor/vscode-dts/vscode.proposed.workspaceTrust.d.ts diff --git a/Example/Input/Editor/typings/base-common.d.ts b/Example/Input/Editor/typings/base-common.d.ts deleted file mode 100644 index 4fc7b598..00000000 --- a/Example/Input/Editor/typings/base-common.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -// Declare types that we probe for to implement util and/or polyfill functions - -declare global { - - interface IdleDeadline { - readonly didTimeout: boolean; - timeRemaining(): number; - } - - function requestIdleCallback(callback: (args: IdleDeadline) => void, options?: { timeout: number }): number; - function cancelIdleCallback(handle: number): void; - -} - -export { } diff --git a/Example/Input/Editor/typings/editContext.d.ts b/Example/Input/Editor/typings/editContext.d.ts deleted file mode 100644 index da207db8..00000000 --- a/Example/Input/Editor/typings/editContext.d.ts +++ /dev/null @@ -1,150 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -type DOMString = string; - -interface EditContext extends EventTarget { - updateText(rangeStart: number, rangeEnd: number, text: DOMString): void; - updateSelection(start: number, end: number): void; - updateControlBounds(controlBounds: DOMRect): void; - updateSelectionBounds(selectionBounds: DOMRect): void; - updateCharacterBounds(rangeStart: number, characterBounds: DOMRect[]): void; - - attachedElements(): HTMLElement[]; - - get text(): DOMString; - get selectionStart(): number; - get selectionEnd(): number; - get characterBoundsRangeStart(): number; - characterBounds(): DOMRect[]; - - get ontextupdate(): EventHandler | null; - set ontextupdate(value: EventHandler | null); - - get ontextformatupdate(): EventHandler | null; - set ontextformatupdate(value: EventHandler | null); - - get oncharacterboundsupdate(): EventHandler | null; - set oncharacterboundsupdate(value: EventHandler | null); - - get oncompositionstart(): EventHandler | null; - set oncompositionstart(value: EventHandler | null); - - get oncompositionend(): EventHandler | null; - set oncompositionend(value: EventHandler | null); - - addEventListener( - type: K, - listener: ( - this: GlobalEventHandlers, - ev: EditContextEventHandlersEventMap[K], - ) => any, - options?: boolean | AddEventListenerOptions, - ): void; - addEventListener( - type: string, - listener: EventListenerOrEventListenerObject, - options?: boolean | AddEventListenerOptions, - ): void; - removeEventListener( - type: K, - listener: ( - this: GlobalEventHandlers, - ev: EditContextEventHandlersEventMap[K], - ) => any, - options?: boolean | EventListenerOptions, - ): void; - removeEventListener( - type: string, - listener: EventListenerOrEventListenerObject, - options?: boolean | EventListenerOptions, - ): void; -} - -interface EditContextInit { - text: DOMString; - selectionStart: number; - selectionEnd: number; -} - -interface EditContextEventHandlersEventMap { - textupdate: TextUpdateEvent; - textformatupdate: TextFormatUpdateEvent; - characterboundsupdate: CharacterBoundsUpdateEvent; - compositionstart: Event; - compositionend: Event; -} - -type EventHandler = (event: TEvent) => void; - -interface TextUpdateEvent extends Event { - new (type: DOMString, options?: TextUpdateEventInit): TextUpdateEvent; - - readonly updateRangeStart: number; - readonly updateRangeEnd: number; - readonly text: DOMString; - readonly selectionStart: number; - readonly selectionEnd: number; -} - -interface TextUpdateEventInit extends EventInit { - updateRangeStart: number; - updateRangeEnd: number; - text: DOMString; - selectionStart: number; - selectionEnd: number; - compositionStart: number; - compositionEnd: number; -} - -interface TextFormat { - new (options?: TextFormatInit): TextFormat; - - readonly rangeStart: number; - readonly rangeEnd: number; - readonly underlineStyle: UnderlineStyle; - readonly underlineThickness: UnderlineThickness; -} - -interface TextFormatInit { - rangeStart: number; - rangeEnd: number; - underlineStyle: UnderlineStyle; - underlineThickness: UnderlineThickness; -} - -type UnderlineStyle = "none" | "solid" | "dotted" | "dashed" | "wavy"; -type UnderlineThickness = "none" | "thin" | "thick"; - -interface TextFormatUpdateEvent extends Event { - new ( - type: DOMString, - options?: TextFormatUpdateEventInit, - ): TextFormatUpdateEvent; - getTextFormats(): TextFormat[]; -} - -interface TextFormatUpdateEventInit extends EventInit { - textFormats: TextFormat[]; -} - -interface CharacterBoundsUpdateEvent extends Event { - new ( - type: DOMString, - options?: CharacterBoundsUpdateEventInit, - ): CharacterBoundsUpdateEvent; - - readonly rangeStart: number; - readonly rangeEnd: number; -} - -interface CharacterBoundsUpdateEventInit extends EventInit { - rangeStart: number; - rangeEnd: number; -} - -interface HTMLElement { - editContext?: EditContext; -} diff --git a/Example/Input/Editor/typings/thenable.d.ts b/Example/Input/Editor/typings/thenable.d.ts deleted file mode 100644 index 73373ead..00000000 --- a/Example/Input/Editor/typings/thenable.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -/** - * Thenable is a common denominator between ES6 promises, Q, jquery.Deferred, WinJS.Promise, - * and others. This API makes no assumption about what promise library is being used which - * enables reusing existing code without migrating to a specific promise implementation. Still, - * we recommend the use of native promises which are available in VS Code. - */ -interface Thenable extends PromiseLike { } diff --git a/Example/Input/Editor/typings/vscode-globals-nls.d.ts b/Example/Input/Editor/typings/vscode-globals-nls.d.ts deleted file mode 100644 index 2b5d48e1..00000000 --- a/Example/Input/Editor/typings/vscode-globals-nls.d.ts +++ /dev/null @@ -1,40 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -// AMD2ESM migration relevant - -/** - * NLS Globals: these need to be defined in all contexts that make - * use of our `nls.localize` and `nls.localize2` functions. This includes: - * - Electron main process - * - Electron window (renderer) process - * - Utility Process - * - Node.js - * - Browser - * - Web worker - * - * That is because during build time we strip out all english strings from - * the resulting JS code and replace it with a that is then looked - * up from the `_VSCODE_NLS_MESSAGES` array. - */ -declare global { - /** - * All NLS messages produced by `localize` and `localize2` calls - * under `src/vs` translated to the language as indicated by - * `_VSCODE_NLS_LANGUAGE`. - * - * Instead of accessing this global variable directly, use function getNLSMessages. - */ - var _VSCODE_NLS_MESSAGES: string[]; - /** - * The actual language of the NLS messages (e.g. 'en', de' or 'pt-br'). - * - * Instead of accessing this global variable directly, use function getNLSLanguage. - */ - var _VSCODE_NLS_LANGUAGE: string | undefined; -} - -// fake export to make global work -export { } diff --git a/Example/Input/Editor/typings/vscode-globals-product.d.ts b/Example/Input/Editor/typings/vscode-globals-product.d.ts deleted file mode 100644 index f52cb73e..00000000 --- a/Example/Input/Editor/typings/vscode-globals-product.d.ts +++ /dev/null @@ -1,31 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -// AMD2ESM migration relevant - -declare global { - /** - * Holds the file root for resources. - */ - var _VSCODE_FILE_ROOT: string; - - /** - * CSS loader that's available during development time. - * DO NOT call directly, instead just import css modules, like `import 'some.css'` - */ - var _VSCODE_CSS_LOAD: (module: string) => void; - - /** - * @deprecated You MUST use `IProductService` whenever possible. - */ - var _VSCODE_PRODUCT_JSON: Record; - /** - * @deprecated You MUST use `IProductService` whenever possible. - */ - var _VSCODE_PACKAGE_JSON: Record; -} - -// fake export to make global work -export {}; diff --git a/Example/Input/Editor/typings/vscode-globals-ttp.d.ts b/Example/Input/Editor/typings/vscode-globals-ttp.d.ts deleted file mode 100644 index 0ab7acda..00000000 --- a/Example/Input/Editor/typings/vscode-globals-ttp.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -// AMD2ESM migration relevant - -declare global { - var _VSCODE_WEB_PACKAGE_TTP: - | Pick< - TrustedTypePolicy<{ - createScriptURL(value: string): string; - }>, - "name" | "createScriptURL" - > - | undefined; -} - -// fake export to make global work -export {}; diff --git a/Example/Input/Editor/vs/base/browser/dompurify/dompurify.d.ts b/Example/Input/Editor/vs/base/browser/dompurify/dompurify.d.ts deleted file mode 100644 index 2c5b6396..00000000 --- a/Example/Input/Editor/vs/base/browser/dompurify/dompurify.d.ts +++ /dev/null @@ -1,146 +0,0 @@ -// Type definitions for DOM Purify 3.0 -// Project: https://github.com/cure53/DOMPurify -// Definitions by: Dave Taylor https://github.com/davetayls -// Samira Bazuzi -// FlowCrypt -// Exigerr -// Piotr Błażejewicz -// Nicholas Ellul -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// Minimum TypeScript Version: 4.5 - -export default DOMPurify; - -declare const DOMPurify: createDOMPurifyI; - -type WindowLike = Pick< - typeof globalThis, - | 'NodeFilter' - | 'Node' - | 'Element' - | 'HTMLTemplateElement' - | 'DocumentFragment' - | 'HTMLFormElement' - | 'DOMParser' - | 'NamedNodeMap' ->; - -interface createDOMPurifyI extends DOMPurify.DOMPurifyI { - (window?: Window | WindowLike): DOMPurify.DOMPurifyI; -} - -declare namespace DOMPurify { - interface DOMPurifyI { - sanitize(source: string | Node): string; - sanitize(source: string | Node, config: Config & { RETURN_TRUSTED_TYPE: true }): TrustedHTML; - sanitize( - source: string | Node, - config: Config & { RETURN_DOM_FRAGMENT?: false | undefined; RETURN_DOM?: false | undefined }, - ): string; - sanitize(source: string | Node, config: Config & { RETURN_DOM_FRAGMENT: true }): DocumentFragment; - sanitize(source: string | Node, config: Config & { RETURN_DOM: true }): HTMLElement; - sanitize(source: string | Node, config: Config): string | HTMLElement | DocumentFragment; - - addHook( - hook: 'uponSanitizeElement', - cb: (currentNode: Element, data: SanitizeElementHookEvent, config: Config) => void, - ): void; - addHook( - hook: 'uponSanitizeAttribute', - cb: (currentNode: Element, data: SanitizeAttributeHookEvent, config: Config) => void, - ): void; - addHook(hook: HookName, cb: (currentNode: Element, data: HookEvent, config: Config) => void): void; - - setConfig(cfg: Config): void; - clearConfig(): void; - isValidAttribute(tag: string, attr: string, value: string): boolean; - - removeHook(entryPoint: HookName): void; - removeHooks(entryPoint: HookName): void; - removeAllHooks(): void; - - version: string; - removed: any[]; - isSupported: boolean; - } - - interface Config { - ADD_ATTR?: string[] | undefined; - ADD_DATA_URI_TAGS?: string[] | undefined; - ADD_TAGS?: string[] | undefined; - ADD_URI_SAFE_ATTR?: string[] | undefined; - ALLOW_ARIA_ATTR?: boolean | undefined; - ALLOW_DATA_ATTR?: boolean | undefined; - ALLOW_UNKNOWN_PROTOCOLS?: boolean | undefined; - ALLOW_SELF_CLOSE_IN_ATTR?: boolean | undefined; - ALLOWED_ATTR?: string[] | undefined; - ALLOWED_TAGS?: string[] | undefined; - ALLOWED_NAMESPACES?: string[] | undefined; - ALLOWED_URI_REGEXP?: RegExp | undefined; - FORBID_ATTR?: string[] | undefined; - FORBID_CONTENTS?: string[] | undefined; - FORBID_TAGS?: string[] | undefined; - FORCE_BODY?: boolean | undefined; - IN_PLACE?: boolean | undefined; - KEEP_CONTENT?: boolean | undefined; - /** - * change the default namespace from HTML to something different - */ - NAMESPACE?: string | undefined; - PARSER_MEDIA_TYPE?: string | undefined; - RETURN_DOM_FRAGMENT?: boolean | undefined; - /** - * This defaults to `true` starting DOMPurify 2.2.0. Note that setting it to `false` - * might cause XSS from attacks hidden in closed shadowroots in case the browser - * supports Declarative Shadow: DOM https://web.dev/declarative-shadow-dom/ - */ - RETURN_DOM_IMPORT?: boolean | undefined; - RETURN_DOM?: boolean | undefined; - RETURN_TRUSTED_TYPE?: boolean | undefined; - SAFE_FOR_TEMPLATES?: boolean | undefined; - SANITIZE_DOM?: boolean | undefined; - /** @default false */ - SANITIZE_NAMED_PROPS?: boolean | undefined; - USE_PROFILES?: - | false - | { - mathMl?: boolean | undefined; - svg?: boolean | undefined; - svgFilters?: boolean | undefined; - html?: boolean | undefined; - } - | undefined; - WHOLE_DOCUMENT?: boolean | undefined; - CUSTOM_ELEMENT_HANDLING?: { - tagNameCheck?: RegExp | ((tagName: string) => boolean) | null | undefined; - attributeNameCheck?: RegExp | ((lcName: string) => boolean) | null | undefined; - allowCustomizedBuiltInElements?: boolean | undefined; - }; - } - - type HookName = - | 'beforeSanitizeElements' - | 'uponSanitizeElement' - | 'afterSanitizeElements' - | 'beforeSanitizeAttributes' - | 'uponSanitizeAttribute' - | 'afterSanitizeAttributes' - | 'beforeSanitizeShadowDOM' - | 'uponSanitizeShadowNode' - | 'afterSanitizeShadowDOM'; - - type HookEvent = SanitizeElementHookEvent | SanitizeAttributeHookEvent | null; - - interface SanitizeElementHookEvent { - tagName: string; - allowedTags: { [key: string]: boolean }; - } - - interface SanitizeAttributeHookEvent { - attrName: string; - attrValue: string; - keepAttr: boolean; - allowedAttributes: { [key: string]: boolean }; - forceKeepAttr?: boolean | undefined; - } -} diff --git a/Example/Input/Editor/vs/base/common/marked/marked.d.ts b/Example/Input/Editor/vs/base/common/marked/marked.d.ts deleted file mode 100644 index bbd49c48..00000000 --- a/Example/Input/Editor/vs/base/common/marked/marked.d.ts +++ /dev/null @@ -1,704 +0,0 @@ -// Generated by dts-bundle-generator v9.5.1 - -export type MarkedToken = (Tokens.Space | Tokens.Code | Tokens.Heading | Tokens.Table | Tokens.Hr | Tokens.Blockquote | Tokens.List | Tokens.ListItem | Tokens.Paragraph | Tokens.HTML | Tokens.Text | Tokens.Def | Tokens.Escape | Tokens.Tag | Tokens.Image | Tokens.Link | Tokens.Strong | Tokens.Em | Tokens.Codespan | Tokens.Br | Tokens.Del); -export type Token = (MarkedToken | Tokens.Generic); -export declare namespace Tokens { - interface Space { - type: "space"; - raw: string; - } - interface Code { - type: "code"; - raw: string; - codeBlockStyle?: "indented" | undefined; - lang?: string | undefined; - text: string; - escaped?: boolean; - } - interface Heading { - type: "heading"; - raw: string; - depth: number; - text: string; - tokens: Token[]; - } - interface Table { - type: "table"; - raw: string; - align: Array<"center" | "left" | "right" | null>; - header: TableCell[]; - rows: TableCell[][]; - } - interface TableRow { - text: string; - } - interface TableCell { - text: string; - tokens: Token[]; - header: boolean; - align: "center" | "left" | "right" | null; - } - interface Hr { - type: "hr"; - raw: string; - } - interface Blockquote { - type: "blockquote"; - raw: string; - text: string; - tokens: Token[]; - } - interface List { - type: "list"; - raw: string; - ordered: boolean; - start: number | ""; - loose: boolean; - items: ListItem[]; - } - interface ListItem { - type: "list_item"; - raw: string; - task: boolean; - checked?: boolean | undefined; - loose: boolean; - text: string; - tokens: Token[]; - } - interface Checkbox { - checked: boolean; - } - interface Paragraph { - type: "paragraph"; - raw: string; - pre?: boolean | undefined; - text: string; - tokens: Token[]; - } - interface HTML { - type: "html"; - raw: string; - pre: boolean; - text: string; - block: boolean; - } - interface Text { - type: "text"; - raw: string; - text: string; - tokens?: Token[]; - } - interface Def { - type: "def"; - raw: string; - tag: string; - href: string; - title: string; - } - interface Escape { - type: "escape"; - raw: string; - text: string; - } - interface Tag { - type: "text" | "html"; - raw: string; - inLink: boolean; - inRawBlock: boolean; - text: string; - block: boolean; - } - interface Link { - type: "link"; - raw: string; - href: string; - title?: string | null; - text: string; - tokens: Token[]; - } - interface Image { - type: "image"; - raw: string; - href: string; - title: string | null; - text: string; - } - interface Strong { - type: "strong"; - raw: string; - text: string; - tokens: Token[]; - } - interface Em { - type: "em"; - raw: string; - text: string; - tokens: Token[]; - } - interface Codespan { - type: "codespan"; - raw: string; - text: string; - } - interface Br { - type: "br"; - raw: string; - } - interface Del { - type: "del"; - raw: string; - text: string; - tokens: Token[]; - } - interface Generic { - [index: string]: any; - type: string; - raw: string; - tokens?: Token[] | undefined; - } -} -export type Links = Record>; -export type TokensList = Token[] & { - links: Links; -}; -/** - * Renderer - */ -declare class _Renderer { - options: MarkedOptions; - parser: _Parser; - constructor(options?: MarkedOptions); - space(token: Tokens.Space): string; - code({ text, lang, escaped }: Tokens.Code): string; - blockquote({ tokens }: Tokens.Blockquote): string; - html({ text }: Tokens.HTML | Tokens.Tag): string; - heading({ tokens, depth }: Tokens.Heading): string; - hr(token: Tokens.Hr): string; - list(token: Tokens.List): string; - listitem(item: Tokens.ListItem): string; - checkbox({ checked }: Tokens.Checkbox): string; - paragraph({ tokens }: Tokens.Paragraph): string; - table(token: Tokens.Table): string; - tablerow({ text }: Tokens.TableRow): string; - tablecell(token: Tokens.TableCell): string; - /** - * span level renderer - */ - strong({ tokens }: Tokens.Strong): string; - em({ tokens }: Tokens.Em): string; - codespan({ text }: Tokens.Codespan): string; - br(token: Tokens.Br): string; - del({ tokens }: Tokens.Del): string; - link({ href, title, tokens }: Tokens.Link): string; - image({ href, title, text }: Tokens.Image): string; - text(token: Tokens.Text | Tokens.Escape | Tokens.Tag): string; -} -/** - * TextRenderer - * returns only the textual part of the token - */ -declare class _TextRenderer { - strong({ text }: Tokens.Strong): string; - em({ text }: Tokens.Em): string; - codespan({ text }: Tokens.Codespan): string; - del({ text }: Tokens.Del): string; - html({ text }: Tokens.HTML | Tokens.Tag): string; - text({ text }: Tokens.Text | Tokens.Escape | Tokens.Tag): string; - link({ text }: Tokens.Link): string; - image({ text }: Tokens.Image): string; - br(): string; -} -/** - * Parsing & Compiling - */ -declare class _Parser { - options: MarkedOptions; - renderer: _Renderer; - textRenderer: _TextRenderer; - constructor(options?: MarkedOptions); - /** - * Static Parse Method - */ - static parse(tokens: Token[], options?: MarkedOptions): string; - /** - * Static Parse Inline Method - */ - static parseInline(tokens: Token[], options?: MarkedOptions): string; - /** - * Parse Loop - */ - parse(tokens: Token[], top?: boolean): string; - /** - * Parse Inline Tokens - */ - parseInline(tokens: Token[], renderer?: _Renderer | _TextRenderer): string; -} -declare const blockNormal: { - blockquote: RegExp; - code: RegExp; - def: RegExp; - fences: RegExp; - heading: RegExp; - hr: RegExp; - html: RegExp; - lheading: RegExp; - list: RegExp; - newline: RegExp; - paragraph: RegExp; - table: RegExp; - text: RegExp; -}; -export type BlockKeys = keyof typeof blockNormal; -declare const inlineNormal: { - _backpedal: RegExp; - anyPunctuation: RegExp; - autolink: RegExp; - blockSkip: RegExp; - br: RegExp; - code: RegExp; - del: RegExp; - emStrongLDelim: RegExp; - emStrongRDelimAst: RegExp; - emStrongRDelimUnd: RegExp; - escape: RegExp; - link: RegExp; - nolink: RegExp; - punctuation: RegExp; - reflink: RegExp; - reflinkSearch: RegExp; - tag: RegExp; - text: RegExp; - url: RegExp; -}; -export type InlineKeys = keyof typeof inlineNormal; -/** - * exports - */ -export declare const block: { - normal: { - blockquote: RegExp; - code: RegExp; - def: RegExp; - fences: RegExp; - heading: RegExp; - hr: RegExp; - html: RegExp; - lheading: RegExp; - list: RegExp; - newline: RegExp; - paragraph: RegExp; - table: RegExp; - text: RegExp; - }; - gfm: Record<"code" | "blockquote" | "hr" | "html" | "table" | "text" | "heading" | "list" | "paragraph" | "def" | "fences" | "lheading" | "newline", RegExp>; - pedantic: Record<"code" | "blockquote" | "hr" | "html" | "table" | "text" | "heading" | "list" | "paragraph" | "def" | "fences" | "lheading" | "newline", RegExp>; -}; -export declare const inline: { - normal: { - _backpedal: RegExp; - anyPunctuation: RegExp; - autolink: RegExp; - blockSkip: RegExp; - br: RegExp; - code: RegExp; - del: RegExp; - emStrongLDelim: RegExp; - emStrongRDelimAst: RegExp; - emStrongRDelimUnd: RegExp; - escape: RegExp; - link: RegExp; - nolink: RegExp; - punctuation: RegExp; - reflink: RegExp; - reflinkSearch: RegExp; - tag: RegExp; - text: RegExp; - url: RegExp; - }; - gfm: Record<"link" | "code" | "url" | "br" | "del" | "text" | "escape" | "tag" | "reflink" | "autolink" | "nolink" | "_backpedal" | "anyPunctuation" | "blockSkip" | "emStrongLDelim" | "emStrongRDelimAst" | "emStrongRDelimUnd" | "punctuation" | "reflinkSearch", RegExp>; - breaks: Record<"link" | "code" | "url" | "br" | "del" | "text" | "escape" | "tag" | "reflink" | "autolink" | "nolink" | "_backpedal" | "anyPunctuation" | "blockSkip" | "emStrongLDelim" | "emStrongRDelimAst" | "emStrongRDelimUnd" | "punctuation" | "reflinkSearch", RegExp>; - pedantic: Record<"link" | "code" | "url" | "br" | "del" | "text" | "escape" | "tag" | "reflink" | "autolink" | "nolink" | "_backpedal" | "anyPunctuation" | "blockSkip" | "emStrongLDelim" | "emStrongRDelimAst" | "emStrongRDelimUnd" | "punctuation" | "reflinkSearch", RegExp>; -}; -export interface Rules { - block: Record; - inline: Record; -} -/** - * Tokenizer - */ -declare class _Tokenizer { - options: MarkedOptions; - rules: Rules; - lexer: _Lexer; - constructor(options?: MarkedOptions); - space(src: string): Tokens.Space | undefined; - code(src: string): Tokens.Code | undefined; - fences(src: string): Tokens.Code | undefined; - heading(src: string): Tokens.Heading | undefined; - hr(src: string): Tokens.Hr | undefined; - blockquote(src: string): Tokens.Blockquote | undefined; - list(src: string): Tokens.List | undefined; - html(src: string): Tokens.HTML | undefined; - def(src: string): Tokens.Def | undefined; - table(src: string): Tokens.Table | undefined; - lheading(src: string): Tokens.Heading | undefined; - paragraph(src: string): Tokens.Paragraph | undefined; - text(src: string): Tokens.Text | undefined; - escape(src: string): Tokens.Escape | undefined; - tag(src: string): Tokens.Tag | undefined; - link(src: string): Tokens.Link | Tokens.Image | undefined; - reflink(src: string, links: Links): Tokens.Link | Tokens.Image | Tokens.Text | undefined; - emStrong(src: string, maskedSrc: string, prevChar?: string): Tokens.Em | Tokens.Strong | undefined; - codespan(src: string): Tokens.Codespan | undefined; - br(src: string): Tokens.Br | undefined; - del(src: string): Tokens.Del | undefined; - autolink(src: string): Tokens.Link | undefined; - url(src: string): Tokens.Link | undefined; - inlineText(src: string): Tokens.Text | undefined; -} -declare class _Hooks { - options: MarkedOptions; - constructor(options?: MarkedOptions); - static passThroughHooks: Set; - /** - * Process markdown before marked - */ - preprocess(markdown: string): string; - /** - * Process HTML after marked is finished - */ - postprocess(html: string): string; - /** - * Process all tokens before walk tokens - */ - processAllTokens(tokens: Token[] | TokensList): Token[] | TokensList; -} -export interface TokenizerThis { - lexer: _Lexer; -} -export type TokenizerExtensionFunction = (this: TokenizerThis, src: string, tokens: Token[] | TokensList) => Tokens.Generic | undefined; -export type TokenizerStartFunction = (this: TokenizerThis, src: string) => number | void; -export interface TokenizerExtension { - name: string; - level: "block" | "inline"; - start?: TokenizerStartFunction | undefined; - tokenizer: TokenizerExtensionFunction; - childTokens?: string[] | undefined; -} -export interface RendererThis { - parser: _Parser; -} -export type RendererExtensionFunction = (this: RendererThis, token: Tokens.Generic) => string | false | undefined; -export interface RendererExtension { - name: string; - renderer: RendererExtensionFunction; -} -export type TokenizerAndRendererExtension = TokenizerExtension | RendererExtension | (TokenizerExtension & RendererExtension); -export type HooksApi = Omit<_Hooks, "constructor" | "options">; -export type HooksObject = { - [K in keyof HooksApi]?: (this: _Hooks, ...args: Parameters) => ReturnType | Promise>; -}; -export type RendererApi = Omit<_Renderer, "constructor" | "options" | "parser">; -export type RendererObject = { - [K in keyof RendererApi]?: (this: _Renderer, ...args: Parameters) => ReturnType | false; -}; -export type TokenizerApi = Omit<_Tokenizer, "constructor" | "options" | "rules" | "lexer">; -export type TokenizerObject = { - [K in keyof TokenizerApi]?: (this: _Tokenizer, ...args: Parameters) => ReturnType | false; -}; -export interface MarkedExtension { - /** - * True will tell marked to await any walkTokens functions before parsing the tokens and returning an HTML string. - */ - async?: boolean; - /** - * Enable GFM line breaks. This option requires the gfm option to be true. - */ - breaks?: boolean | undefined; - /** - * Add tokenizers and renderers to marked - */ - extensions?: TokenizerAndRendererExtension[] | undefined | null; - /** - * Enable GitHub flavored markdown. - */ - gfm?: boolean | undefined; - /** - * Hooks are methods that hook into some part of marked. - * preprocess is called to process markdown before sending it to marked. - * processAllTokens is called with the TokensList before walkTokens. - * postprocess is called to process html after marked has finished parsing. - */ - hooks?: HooksObject | undefined | null; - /** - * Conform to obscure parts of markdown.pl as much as possible. Don't fix any of the original markdown bugs or poor behavior. - */ - pedantic?: boolean | undefined; - /** - * Type: object Default: new Renderer() - * - * An object containing functions to render tokens to HTML. - */ - renderer?: RendererObject | undefined | null; - /** - * Shows an HTML error message when rendering fails. - */ - silent?: boolean | undefined; - /** - * The tokenizer defines how to turn markdown text into tokens. - */ - tokenizer?: TokenizerObject | undefined | null; - /** - * The walkTokens function gets called with every token. - * Child tokens are called before moving on to sibling tokens. - * Each token is passed by reference so updates are persisted when passed to the parser. - * The return value of the function is ignored. - */ - walkTokens?: ((token: Token) => void | Promise) | undefined | null; -} -export interface MarkedOptions extends Omit { - /** - * Hooks are methods that hook into some part of marked. - */ - hooks?: _Hooks | undefined | null; - /** - * Type: object Default: new Renderer() - * - * An object containing functions to render tokens to HTML. - */ - renderer?: _Renderer | undefined | null; - /** - * The tokenizer defines how to turn markdown text into tokens. - */ - tokenizer?: _Tokenizer | undefined | null; - /** - * Custom extensions - */ - extensions?: null | { - renderers: { - [name: string]: RendererExtensionFunction; - }; - childTokens: { - [name: string]: string[]; - }; - inline?: TokenizerExtensionFunction[]; - block?: TokenizerExtensionFunction[]; - startInline?: TokenizerStartFunction[]; - startBlock?: TokenizerStartFunction[]; - }; - /** - * walkTokens function returns array of values for Promise.all - */ - walkTokens?: null | ((token: Token) => void | Promise | (void | Promise)[]); -} -/** - * Block Lexer - */ -declare class _Lexer { - tokens: TokensList; - options: MarkedOptions; - state: { - inLink: boolean; - inRawBlock: boolean; - top: boolean; - }; - private tokenizer; - private inlineQueue; - constructor(options?: MarkedOptions); - /** - * Expose Rules - */ - static get rules(): { - block: { - normal: { - blockquote: RegExp; - code: RegExp; - def: RegExp; - fences: RegExp; - heading: RegExp; - hr: RegExp; - html: RegExp; - lheading: RegExp; - list: RegExp; - newline: RegExp; - paragraph: RegExp; - table: RegExp; - text: RegExp; - }; - gfm: Record<"code" | "blockquote" | "hr" | "html" | "table" | "text" | "heading" | "list" | "paragraph" | "def" | "fences" | "lheading" | "newline", RegExp>; - pedantic: Record<"code" | "blockquote" | "hr" | "html" | "table" | "text" | "heading" | "list" | "paragraph" | "def" | "fences" | "lheading" | "newline", RegExp>; - }; - inline: { - normal: { - _backpedal: RegExp; - anyPunctuation: RegExp; - autolink: RegExp; - blockSkip: RegExp; - br: RegExp; - code: RegExp; - del: RegExp; - emStrongLDelim: RegExp; - emStrongRDelimAst: RegExp; - emStrongRDelimUnd: RegExp; - escape: RegExp; - link: RegExp; - nolink: RegExp; - punctuation: RegExp; - reflink: RegExp; - reflinkSearch: RegExp; - tag: RegExp; - text: RegExp; - url: RegExp; - }; - gfm: Record<"link" | "code" | "url" | "br" | "del" | "text" | "escape" | "tag" | "reflink" | "autolink" | "nolink" | "_backpedal" | "anyPunctuation" | "blockSkip" | "emStrongLDelim" | "emStrongRDelimAst" | "emStrongRDelimUnd" | "punctuation" | "reflinkSearch", RegExp>; - breaks: Record<"link" | "code" | "url" | "br" | "del" | "text" | "escape" | "tag" | "reflink" | "autolink" | "nolink" | "_backpedal" | "anyPunctuation" | "blockSkip" | "emStrongLDelim" | "emStrongRDelimAst" | "emStrongRDelimUnd" | "punctuation" | "reflinkSearch", RegExp>; - pedantic: Record<"link" | "code" | "url" | "br" | "del" | "text" | "escape" | "tag" | "reflink" | "autolink" | "nolink" | "_backpedal" | "anyPunctuation" | "blockSkip" | "emStrongLDelim" | "emStrongRDelimAst" | "emStrongRDelimUnd" | "punctuation" | "reflinkSearch", RegExp>; - }; - }; - /** - * Static Lex Method - */ - static lex(src: string, options?: MarkedOptions): TokensList; - /** - * Static Lex Inline Method - */ - static lexInline(src: string, options?: MarkedOptions): Token[]; - /** - * Preprocessing - */ - lex(src: string): TokensList; - /** - * Lexing - */ - blockTokens(src: string, tokens?: Token[], lastParagraphClipped?: boolean): Token[]; - blockTokens(src: string, tokens?: TokensList, lastParagraphClipped?: boolean): TokensList; - inline(src: string, tokens?: Token[]): Token[]; - /** - * Lexing/Compiling - */ - inlineTokens(src: string, tokens?: Token[]): Token[]; -} -/** - * Gets the original marked default options. - */ -declare function _getDefaults(): MarkedOptions; -declare let _defaults: MarkedOptions; -export type MaybePromise = void | Promise; -export declare class Marked { - defaults: MarkedOptions; - options: (opt: MarkedOptions) => this; - parse: { - (src: string, options: MarkedOptions & { - async: true; - }): Promise; - (src: string, options: MarkedOptions & { - async: false; - }): string; - (src: string, options?: MarkedOptions | undefined | null): string | Promise; - }; - parseInline: { - (src: string, options: MarkedOptions & { - async: true; - }): Promise; - (src: string, options: MarkedOptions & { - async: false; - }): string; - (src: string, options?: MarkedOptions | undefined | null): string | Promise; - }; - Parser: typeof _Parser; - Renderer: typeof _Renderer; - TextRenderer: typeof _TextRenderer; - Lexer: typeof _Lexer; - Tokenizer: typeof _Tokenizer; - Hooks: typeof _Hooks; - constructor(...args: MarkedExtension[]); - /** - * Run callback for every token - */ - walkTokens(tokens: Token[] | TokensList, callback: (token: Token) => MaybePromise | MaybePromise[]): MaybePromise[]; - use(...args: MarkedExtension[]): this; - setOptions(opt: MarkedOptions): this; - lexer(src: string, options?: MarkedOptions): TokensList; - parser(tokens: Token[], options?: MarkedOptions): string; - private parseMarkdown; - private onError; -} -/** - * Compiles markdown to HTML asynchronously. - * - * @param src String of markdown source to be compiled - * @param options Hash of options, having async: true - * @return Promise of string of compiled HTML - */ -export declare function marked(src: string, options: MarkedOptions & { - async: true; -}): Promise; -/** - * Compiles markdown to HTML. - * - * @param src String of markdown source to be compiled - * @param options Optional hash of options - * @return String of compiled HTML. Will be a Promise of string if async is set to true by any extensions. - */ -export declare function marked(src: string, options: MarkedOptions & { - async: false; -}): string; -export declare function marked(src: string, options: MarkedOptions & { - async: true; -}): Promise; -export declare function marked(src: string, options?: MarkedOptions | undefined | null): string | Promise; -export declare namespace marked { - var options: (options: MarkedOptions) => typeof marked; - var setOptions: (options: MarkedOptions) => typeof marked; - var getDefaults: typeof _getDefaults; - var defaults: MarkedOptions; - var use: (...args: MarkedExtension[]) => typeof marked; - var walkTokens: (tokens: Token[] | TokensList, callback: (token: Token) => MaybePromise | MaybePromise[]) => MaybePromise[]; - var parseInline: { - (src: string, options: MarkedOptions & { - async: true; - }): Promise; - (src: string, options: MarkedOptions & { - async: false; - }): string; - (src: string, options?: MarkedOptions | undefined | null): string | Promise; - }; - var Parser: typeof _Parser; - var parser: typeof _Parser.parse; - var Renderer: typeof _Renderer; - var TextRenderer: typeof _TextRenderer; - var Lexer: typeof _Lexer; - var lexer: typeof _Lexer.lex; - var Tokenizer: typeof _Tokenizer; - var Hooks: typeof _Hooks; - var parse: typeof marked; -} -export declare const options: (options: MarkedOptions) => typeof marked; -export declare const setOptions: (options: MarkedOptions) => typeof marked; -export declare const use: (...args: MarkedExtension[]) => typeof marked; -export declare const walkTokens: (tokens: Token[] | TokensList, callback: (token: Token) => MaybePromise | MaybePromise[]) => MaybePromise[]; -export declare const parseInline: { - (src: string, options: MarkedOptions & { - async: true; - }): Promise; - (src: string, options: MarkedOptions & { - async: false; - }): string; - (src: string, options?: MarkedOptions | undefined | null): string | Promise; -}; -export declare const parse: typeof marked; -export declare const parser: typeof _Parser.parse; -export declare const lexer: typeof _Lexer.lex; - -export { - _Hooks as Hooks, - _Lexer as Lexer, - _Parser as Parser, - _Renderer as Renderer, - _TextRenderer as TextRenderer, - _Tokenizer as Tokenizer, - _defaults as defaults, - _getDefaults as getDefaults, -}; - -export { }; diff --git a/Example/Input/Editor/vs/base/common/semver/semver.d.ts b/Example/Input/Editor/vs/base/common/semver/semver.d.ts deleted file mode 100644 index 93f47f94..00000000 --- a/Example/Input/Editor/vs/base/common/semver/semver.d.ts +++ /dev/null @@ -1,310 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -export * from 'semver' - -declare namespace semver { - - // Type definitions for semver 6.2 - // Project: https://github.com/npm/node-semver - // Definitions by: Bart van der Schoor - // BendingBender - // Lucian Buzzo - // Klaus Meinhardt - // ExE Boss - // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/semver - - export const SEMVER_SPEC_VERSION: "2.0.0"; - - export type ReleaseType = "major" | "premajor" | "minor" | "preminor" | "patch" | "prepatch" | "prerelease"; - - export interface Options { - loose?: boolean; - includePrerelease?: boolean; - } - - export interface CoerceOptions extends Options { - /** - * Used by `coerce()` to coerce from right to left. - * - * @default false - * - * @example - * coerce('1.2.3.4', { rtl: true }); - * // => SemVer { version: '2.3.4', ... } - * - * @since 6.2.0 - */ - rtl?: boolean; - } - - /** - * Return the parsed version as a SemVer object, or null if it's not valid. - */ - export function parse(version: string | SemVer | null | undefined, optionsOrLoose?: boolean | Options): SemVer | null; - - /** - * Return the parsed version as a string, or null if it's not valid. - */ - export function valid(version: string | SemVer | null | undefined, optionsOrLoose?: boolean | Options): string | null; - - /** - * Coerces a string to SemVer if possible - */ - export function coerce(version: string | number | SemVer | null | undefined, options?: CoerceOptions): SemVer | null; - - /** - * Returns cleaned (removed leading/trailing whitespace, remove '=v' prefix) and parsed version, or null if version is invalid. - */ - export function clean(version: string, optionsOrLoose?: boolean | Options): string | null; - - /** - * Return the version incremented by the release type (major, minor, patch, or prerelease), or null if it's not valid. - */ - export function inc(version: string | SemVer, release: ReleaseType, optionsOrLoose?: boolean | Options, identifier?: string): string | null; - export function inc(version: string | SemVer, release: ReleaseType, identifier?: string): string | null; - - /** - * Return the major version number. - */ - export function major(version: string | SemVer, optionsOrLoose?: boolean | Options): number; - - /** - * Return the minor version number. - */ - export function minor(version: string | SemVer, optionsOrLoose?: boolean | Options): number; - - /** - * Return the patch version number. - */ - export function patch(version: string | SemVer, optionsOrLoose?: boolean | Options): number; - - /** - * Returns an array of prerelease components, or null if none exist. - */ - export function prerelease(version: string | SemVer, optionsOrLoose?: boolean | Options): ReadonlyArray | null; - - // Comparison - /** - * v1 > v2 - */ - export function gt(v1: string | SemVer, v2: string | SemVer, optionsOrLoose?: boolean | Options): boolean; - /** - * v1 >= v2 - */ - export function gte(v1: string | SemVer, v2: string | SemVer, optionsOrLoose?: boolean | Options): boolean; - /** - * v1 < v2 - */ - export function lt(v1: string | SemVer, v2: string | SemVer, optionsOrLoose?: boolean | Options): boolean; - /** - * v1 <= v2 - */ - export function lte(v1: string | SemVer, v2: string | SemVer, optionsOrLoose?: boolean | Options): boolean; - /** - * v1 == v2 This is true if they're logically equivalent, even if they're not the exact same string. You already know how to compare strings. - */ - export function eq(v1: string | SemVer, v2: string | SemVer, optionsOrLoose?: boolean | Options): boolean; - /** - * v1 != v2 The opposite of eq. - */ - export function neq(v1: string | SemVer, v2: string | SemVer, optionsOrLoose?: boolean | Options): boolean; - - /** - * Pass in a comparison string, and it'll call the corresponding semver comparison function. - * "===" and "!==" do simple string comparison, but are included for completeness. - * Throws if an invalid comparison string is provided. - */ - export function cmp(v1: string | SemVer, operator: Operator, v2: string | SemVer, optionsOrLoose?: boolean | Options): boolean; - export type Operator = '===' | '!==' | '' | '=' | '==' | '!=' | '>' | '>=' | '<' | '<='; - - /** - * Compares two versions excluding build identifiers (the bit after `+` in the semantic version string). - * - * Sorts in ascending order when passed to `Array.sort()`. - * - * @return - * - `0` if `v1` == `v2` - * - `1` if `v1` is greater - * - `-1` if `v2` is greater. - */ - export function compare(v1: string | SemVer, v2: string | SemVer, optionsOrLoose?: boolean | Options): 1 | 0 | -1; - /** - * The reverse of compare. - * - * Sorts in descending order when passed to `Array.sort()`. - */ - export function rcompare(v1: string | SemVer, v2: string | SemVer, optionsOrLoose?: boolean | Options): 1 | 0 | -1; - - /** - * Compares two identifiers, must be numeric strings or truthy/falsy values. - * - * Sorts in ascending order when passed to `Array.sort()`. - */ - export function compareIdentifiers(a: string | null | undefined, b: string | null | undefined): 1 | 0 | -1; - /** - * The reverse of compareIdentifiers. - * - * Sorts in descending order when passed to `Array.sort()`. - */ - export function rcompareIdentifiers(a: string | null | undefined, b: string | null | undefined): 1 | 0 | -1; - - /** - * Compares two versions including build identifiers (the bit after `+` in the semantic version string). - * - * Sorts in ascending order when passed to `Array.sort()`. - * - * @return - * - `0` if `v1` == `v2` - * - `1` if `v1` is greater - * - `-1` if `v2` is greater. - * - * @since 6.1.0 - */ - export function compareBuild(a: string | SemVer, b: string | SemVer): 1 | 0 | -1; - - /** - * Sorts an array of semver entries in ascending order using `compareBuild()`. - */ - export function sort(list: T[], optionsOrLoose?: boolean | Options): T[]; - /** - * Sorts an array of semver entries in descending order using `compareBuild()`. - */ - export function rsort(list: T[], optionsOrLoose?: boolean | Options): T[]; - - /** - * Returns difference between two versions by the release type (major, premajor, minor, preminor, patch, prepatch, or prerelease), or null if the versions are the same. - */ - export function diff(v1: string | SemVer, v2: string | SemVer, optionsOrLoose?: boolean | Options): ReleaseType | null; - - // Ranges - /** - * Return the valid range or null if it's not valid - */ - export function validRange(range: string | Range | null | undefined, optionsOrLoose?: boolean | Options): string; - /** - * Return true if the version satisfies the range. - */ - export function satisfies(version: string | SemVer, range: string | Range, optionsOrLoose?: boolean | Options): boolean; - /** - * Return the highest version in the list that satisfies the range, or null if none of them do. - */ - export function maxSatisfying(versions: ReadonlyArray, range: string | Range, optionsOrLoose?: boolean | Options): T | null; - /** - * Return the lowest version in the list that satisfies the range, or null if none of them do. - */ - export function minSatisfying(versions: ReadonlyArray, range: string | Range, optionsOrLoose?: boolean | Options): T | null; - /** - * Return the lowest version that can possibly match the given range. - */ - export function minVersion(range: string | Range, optionsOrLoose?: boolean | Options): SemVer | null; - /** - * Return true if version is greater than all the versions possible in the range. - */ - export function gtr(version: string | SemVer, range: string | Range, optionsOrLoose?: boolean | Options): boolean; - /** - * Return true if version is less than all the versions possible in the range. - */ - export function ltr(version: string | SemVer, range: string | Range, optionsOrLoose?: boolean | Options): boolean; - /** - * Return true if the version is outside the bounds of the range in either the high or low direction. - * The hilo argument must be either the string '>' or '<'. (This is the function called by gtr and ltr.) - */ - export function outside(version: string | SemVer, range: string | Range, hilo: '>' | '<', optionsOrLoose?: boolean | Options): boolean; - /** - * Return true if any of the ranges comparators intersect - */ - export function intersects(range1: string | Range, range2: string | Range, optionsOrLoose?: boolean | Options): boolean; - - export class SemVer { - constructor(version: string | SemVer, optionsOrLoose?: boolean | Options); - - raw: string; - loose: boolean; - options: Options; - format(): string; - inspect(): string; - - major: number; - minor: number; - patch: number; - version: string; - build: ReadonlyArray; - prerelease: ReadonlyArray; - - /** - * Compares two versions excluding build identifiers (the bit after `+` in the semantic version string). - * - * @return - * - `0` if `this` == `other` - * - `1` if `this` is greater - * - `-1` if `other` is greater. - */ - compare(other: string | SemVer): 1 | 0 | -1; - - /** - * Compares the release portion of two versions. - * - * @return - * - `0` if `this` == `other` - * - `1` if `this` is greater - * - `-1` if `other` is greater. - */ - compareMain(other: string | SemVer): 1 | 0 | -1; - - /** - * Compares the prerelease portion of two versions. - * - * @return - * - `0` if `this` == `other` - * - `1` if `this` is greater - * - `-1` if `other` is greater. - */ - comparePre(other: string | SemVer): 1 | 0 | -1; - - /** - * Compares the build identifier of two versions. - * - * @return - * - `0` if `this` == `other` - * - `1` if `this` is greater - * - `-1` if `other` is greater. - */ - compareBuild(other: string | SemVer): 1 | 0 | -1; - - inc(release: ReleaseType, identifier?: string): SemVer; - } - - export class Comparator { - constructor(comp: string | Comparator, optionsOrLoose?: boolean | Options); - - semver: SemVer; - operator: '' | '=' | '<' | '>' | '<=' | '>='; - value: string; - loose: boolean; - options: Options; - parse(comp: string): void; - test(version: string | SemVer): boolean; - intersects(comp: Comparator, optionsOrLoose?: boolean | Options): boolean; - } - - export class Range { - constructor(range: string | Range, optionsOrLoose?: boolean | Options); - - range: string; - raw: string; - loose: boolean; - options: Options; - includePrerelease: boolean; - format(): string; - inspect(): string; - - set: ReadonlyArray>; - parseRange(range: string): ReadonlyArray; - test(version: string | SemVer): boolean; - intersects(range: Range, optionsOrLoose?: boolean | Options): boolean; - } - -} diff --git a/Example/Input/Editor/vs/monaco.d.ts b/Example/Input/Editor/vs/monaco.d.ts deleted file mode 100644 index caeac063..00000000 --- a/Example/Input/Editor/vs/monaco.d.ts +++ /dev/null @@ -1,8309 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare let MonacoEnvironment: monaco.Environment | undefined; - -interface Window { - MonacoEnvironment?: monaco.Environment | undefined; -} - -declare namespace monaco { - - export type Thenable = PromiseLike; - - export interface Environment { - /** - * Define a global `monaco` symbol. - * This is true by default in AMD and false by default in ESM. - */ - globalAPI?: boolean; - /** - * The base url where the editor sources are found (which contains the vs folder) - */ - baseUrl?: string; - /** - * A web worker factory. - * NOTE: If `getWorker` is defined, `getWorkerUrl` is not invoked. - */ - getWorker?(workerId: string, label: string): Promise | Worker; - /** - * Return the location for web worker scripts. - * NOTE: If `getWorker` is defined, `getWorkerUrl` is not invoked. - */ - getWorkerUrl?(workerId: string, label: string): string; - /** - * Create a trusted types policy (same API as window.trustedTypes.createPolicy) - */ - createTrustedTypesPolicy?( - policyName: string, - policyOptions?: ITrustedTypePolicyOptions, - ): undefined | ITrustedTypePolicy; - } - - export interface ITrustedTypePolicyOptions { - createHTML?: (input: string, ...arguments: any[]) => string; - createScript?: (input: string, ...arguments: any[]) => string; - createScriptURL?: (input: string, ...arguments: any[]) => string; - } - - export interface ITrustedTypePolicy { - readonly name: string; - createHTML?(input: string): any; - createScript?(input: string): any; - createScriptURL?(input: string): any; - } - - export interface IDisposable { - dispose(): void; - } - - export interface IEvent { - (listener: (e: T) => any, thisArg?: any): IDisposable; - } - - /** - * A helper that allows to emit and listen to typed events - */ - export class Emitter { - constructor(); - readonly event: IEvent; - fire(event: T): void; - dispose(): void; - } - - - export enum MarkerTag { - Unnecessary = 1, - Deprecated = 2 - } - - export enum MarkerSeverity { - Hint = 1, - Info = 2, - Warning = 4, - Error = 8 - } - - export class CancellationTokenSource { - constructor(parent?: CancellationToken); - get token(): CancellationToken; - cancel(): void; - dispose(cancel?: boolean): void; - } - - export interface CancellationToken { - /** - * A flag signalling is cancellation has been requested. - */ - readonly isCancellationRequested: boolean; - /** - * An event which fires when cancellation is requested. This event - * only ever fires `once` as cancellation can only happen once. Listeners - * that are registered after cancellation will be called (next event loop run), - * but also only once. - * - * @event - */ - readonly onCancellationRequested: (listener: (e: any) => any, thisArgs?: any, disposables?: IDisposable[]) => IDisposable; - } - /** - * Uniform Resource Identifier (Uri) http://tools.ietf.org/html/rfc3986. - * This class is a simple parser which creates the basic component parts - * (http://tools.ietf.org/html/rfc3986#section-3) with minimal validation - * and encoding. - * - * ```txt - * foo://example.com:8042/over/there?name=ferret#nose - * \_/ \______________/\_________/ \_________/ \__/ - * | | | | | - * scheme authority path query fragment - * | _____________________|__ - * / \ / \ - * urn:example:animal:ferret:nose - * ``` - */ - export class Uri implements UriComponents { - static isUri(thing: any): thing is Uri; - /** - * scheme is the 'http' part of 'http://www.example.com/some/path?query#fragment'. - * The part before the first colon. - */ - readonly scheme: string; - /** - * authority is the 'www.example.com' part of 'http://www.example.com/some/path?query#fragment'. - * The part between the first double slashes and the next slash. - */ - readonly authority: string; - /** - * path is the '/some/path' part of 'http://www.example.com/some/path?query#fragment'. - */ - readonly path: string; - /** - * query is the 'query' part of 'http://www.example.com/some/path?query#fragment'. - */ - readonly query: string; - /** - * fragment is the 'fragment' part of 'http://www.example.com/some/path?query#fragment'. - */ - readonly fragment: string; - /** - * Returns a string representing the corresponding file system path of this Uri. - * Will handle UNC paths, normalizes windows drive letters to lower-case, and uses the - * platform specific path separator. - * - * * Will *not* validate the path for invalid characters and semantics. - * * Will *not* look at the scheme of this Uri. - * * The result shall *not* be used for display purposes but for accessing a file on disk. - * - * - * The *difference* to `Uri#path` is the use of the platform specific separator and the handling - * of UNC paths. See the below sample of a file-uri with an authority (UNC path). - * - * ```ts - const u = Uri.parse('file://server/c$/folder/file.txt') - u.authority === 'server' - u.path === '/shares/c$/file.txt' - u.fsPath === '\\server\c$\folder\file.txt' - ``` - * - * Using `Uri#path` to read a file (using fs-apis) would not be enough because parts of the path, - * namely the server name, would be missing. Therefore `Uri#fsPath` exists - it's sugar to ease working - * with URIs that represent files on disk (`file` scheme). - */ - get fsPath(): string; - with(change: { - scheme?: string; - authority?: string | null; - path?: string | null; - query?: string | null; - fragment?: string | null; - }): Uri; - /** - * Creates a new Uri from a string, e.g. `http://www.example.com/some/path`, - * `file:///usr/home`, or `scheme:with/path`. - * - * @param value A string which represents an Uri (see `Uri#toString`). - */ - static parse(value: string, _strict?: boolean): Uri; - /** - * Creates a new Uri from a file system path, e.g. `c:\my\files`, - * `/usr/home`, or `\\server\share\some\path`. - * - * The *difference* between `Uri#parse` and `Uri#file` is that the latter treats the argument - * as path, not as stringified-uri. E.g. `Uri.file(path)` is **not the same as** - * `Uri.parse('file://' + path)` because the path might contain characters that are - * interpreted (# and ?). See the following sample: - * ```ts - const good = Uri.file('/coding/c#/project1'); - good.scheme === 'file'; - good.path === '/coding/c#/project1'; - good.fragment === ''; - const bad = Uri.parse('file://' + '/coding/c#/project1'); - bad.scheme === 'file'; - bad.path === '/coding/c'; // path is now broken - bad.fragment === '/project1'; - ``` - * - * @param path A file system path (see `Uri#fsPath`) - */ - static file(path: string): Uri; - /** - * Creates new Uri from uri components. - * - * Unless `strict` is `true` the scheme is defaults to be `file`. This function performs - * validation and should be used for untrusted uri components retrieved from storage, - * user input, command arguments etc - */ - static from(components: UriComponents, strict?: boolean): Uri; - /** - * Join a Uri path with path fragments and normalizes the resulting path. - * - * @param uri The input Uri. - * @param pathFragment The path fragment to add to the Uri path. - * @returns The resulting Uri. - */ - static joinPath(uri: Uri, ...pathFragment: string[]): Uri; - /** - * Creates a string representation for this Uri. It's guaranteed that calling - * `Uri.parse` with the result of this function creates an Uri which is equal - * to this Uri. - * - * * The result shall *not* be used for display purposes but for externalization or transport. - * * The result will be encoded using the percentage encoding and encoding happens mostly - * ignore the scheme-specific encoding rules. - * - * @param skipEncoding Do not encode the result, default is `false` - */ - toString(skipEncoding?: boolean): string; - toJSON(): UriComponents; - /** - * A helper function to revive URIs. - * - * **Note** that this function should only be used when receiving Uri#toJSON generated data - * and that it doesn't do any validation. Use {@link Uri.from} when received "untrusted" - * uri components such as command arguments or data from storage. - * - * @param data The Uri components or Uri to revive. - * @returns The revived Uri or undefined or null. - */ - static revive(data: UriComponents | Uri): Uri; - static revive(data: UriComponents | Uri | undefined): Uri | undefined; - static revive(data: UriComponents | Uri | null): Uri | null; - static revive(data: UriComponents | Uri | undefined | null): Uri | undefined | null; - } - - export interface UriComponents { - scheme: string; - authority?: string; - path?: string; - query?: string; - fragment?: string; - } - /** - * Virtual Key Codes, the value does not hold any inherent meaning. - * Inspired somewhat from https://msdn.microsoft.com/en-us/library/windows/desktop/dd375731(v=vs.85).aspx - * But these are "more general", as they should work across browsers & OS`s. - */ - export enum KeyCode { - DependsOnKbLayout = -1, - /** - * Placed first to cover the 0 value of the enum. - */ - Unknown = 0, - Backspace = 1, - Tab = 2, - Enter = 3, - Shift = 4, - Ctrl = 5, - Alt = 6, - PauseBreak = 7, - CapsLock = 8, - Escape = 9, - Space = 10, - PageUp = 11, - PageDown = 12, - End = 13, - Home = 14, - LeftArrow = 15, - UpArrow = 16, - RightArrow = 17, - DownArrow = 18, - Insert = 19, - Delete = 20, - Digit0 = 21, - Digit1 = 22, - Digit2 = 23, - Digit3 = 24, - Digit4 = 25, - Digit5 = 26, - Digit6 = 27, - Digit7 = 28, - Digit8 = 29, - Digit9 = 30, - KeyA = 31, - KeyB = 32, - KeyC = 33, - KeyD = 34, - KeyE = 35, - KeyF = 36, - KeyG = 37, - KeyH = 38, - KeyI = 39, - KeyJ = 40, - KeyK = 41, - KeyL = 42, - KeyM = 43, - KeyN = 44, - KeyO = 45, - KeyP = 46, - KeyQ = 47, - KeyR = 48, - KeyS = 49, - KeyT = 50, - KeyU = 51, - KeyV = 52, - KeyW = 53, - KeyX = 54, - KeyY = 55, - KeyZ = 56, - Meta = 57, - ContextMenu = 58, - F1 = 59, - F2 = 60, - F3 = 61, - F4 = 62, - F5 = 63, - F6 = 64, - F7 = 65, - F8 = 66, - F9 = 67, - F10 = 68, - F11 = 69, - F12 = 70, - F13 = 71, - F14 = 72, - F15 = 73, - F16 = 74, - F17 = 75, - F18 = 76, - F19 = 77, - F20 = 78, - F21 = 79, - F22 = 80, - F23 = 81, - F24 = 82, - NumLock = 83, - ScrollLock = 84, - /** - * Used for miscellaneous characters; it can vary by keyboard. - * For the US standard keyboard, the ';:' key - */ - Semicolon = 85, - /** - * For any country/region, the '+' key - * For the US standard keyboard, the '=+' key - */ - Equal = 86, - /** - * For any country/region, the ',' key - * For the US standard keyboard, the ',<' key - */ - Comma = 87, - /** - * For any country/region, the '-' key - * For the US standard keyboard, the '-_' key - */ - Minus = 88, - /** - * For any country/region, the '.' key - * For the US standard keyboard, the '.>' key - */ - Period = 89, - /** - * Used for miscellaneous characters; it can vary by keyboard. - * For the US standard keyboard, the '/?' key - */ - Slash = 90, - /** - * Used for miscellaneous characters; it can vary by keyboard. - * For the US standard keyboard, the '`~' key - */ - Backquote = 91, - /** - * Used for miscellaneous characters; it can vary by keyboard. - * For the US standard keyboard, the '[{' key - */ - BracketLeft = 92, - /** - * Used for miscellaneous characters; it can vary by keyboard. - * For the US standard keyboard, the '\|' key - */ - Backslash = 93, - /** - * Used for miscellaneous characters; it can vary by keyboard. - * For the US standard keyboard, the ']}' key - */ - BracketRight = 94, - /** - * Used for miscellaneous characters; it can vary by keyboard. - * For the US standard keyboard, the ''"' key - */ - Quote = 95, - /** - * Used for miscellaneous characters; it can vary by keyboard. - */ - OEM_8 = 96, - /** - * Either the angle bracket key or the backslash key on the RT 102-key keyboard. - */ - IntlBackslash = 97, - Numpad0 = 98,// VK_NUMPAD0, 0x60, Numeric keypad 0 key - Numpad1 = 99,// VK_NUMPAD1, 0x61, Numeric keypad 1 key - Numpad2 = 100,// VK_NUMPAD2, 0x62, Numeric keypad 2 key - Numpad3 = 101,// VK_NUMPAD3, 0x63, Numeric keypad 3 key - Numpad4 = 102,// VK_NUMPAD4, 0x64, Numeric keypad 4 key - Numpad5 = 103,// VK_NUMPAD5, 0x65, Numeric keypad 5 key - Numpad6 = 104,// VK_NUMPAD6, 0x66, Numeric keypad 6 key - Numpad7 = 105,// VK_NUMPAD7, 0x67, Numeric keypad 7 key - Numpad8 = 106,// VK_NUMPAD8, 0x68, Numeric keypad 8 key - Numpad9 = 107,// VK_NUMPAD9, 0x69, Numeric keypad 9 key - NumpadMultiply = 108,// VK_MULTIPLY, 0x6A, Multiply key - NumpadAdd = 109,// VK_ADD, 0x6B, Add key - NUMPAD_SEPARATOR = 110,// VK_SEPARATOR, 0x6C, Separator key - NumpadSubtract = 111,// VK_SUBTRACT, 0x6D, Subtract key - NumpadDecimal = 112,// VK_DECIMAL, 0x6E, Decimal key - NumpadDivide = 113,// VK_DIVIDE, 0x6F, - /** - * Cover all key codes when IME is processing input. - */ - KEY_IN_COMPOSITION = 114, - ABNT_C1 = 115,// Brazilian (ABNT) Keyboard - ABNT_C2 = 116,// Brazilian (ABNT) Keyboard - AudioVolumeMute = 117, - AudioVolumeUp = 118, - AudioVolumeDown = 119, - BrowserSearch = 120, - BrowserHome = 121, - BrowserBack = 122, - BrowserForward = 123, - MediaTrackNext = 124, - MediaTrackPrevious = 125, - MediaStop = 126, - MediaPlayPause = 127, - LaunchMediaPlayer = 128, - LaunchMail = 129, - LaunchApp2 = 130, - /** - * VK_CLEAR, 0x0C, CLEAR key - */ - Clear = 131, - /** - * Placed last to cover the length of the enum. - * Please do not depend on this value! - */ - MAX_VALUE = 132 - } - export class KeyMod { - static readonly CtrlCmd: number; - static readonly Shift: number; - static readonly Alt: number; - static readonly WinCtrl: number; - static chord(firstPart: number, secondPart: number): number; - } - - export interface IMarkdownString { - readonly value: string; - readonly isTrusted?: boolean | MarkdownStringTrustedOptions; - readonly supportThemeIcons?: boolean; - readonly supportHtml?: boolean; - readonly baseUri?: UriComponents; - uris?: { - [href: string]: UriComponents; - }; - } - - export interface MarkdownStringTrustedOptions { - readonly enabledCommands: readonly string[]; - } - - export interface IKeyboardEvent { - readonly _standardKeyboardEventBrand: true; - readonly browserEvent: KeyboardEvent; - readonly target: HTMLElement; - readonly ctrlKey: boolean; - readonly shiftKey: boolean; - readonly altKey: boolean; - readonly metaKey: boolean; - readonly altGraphKey: boolean; - readonly keyCode: KeyCode; - readonly code: string; - equals(keybinding: number): boolean; - preventDefault(): void; - stopPropagation(): void; - } - export interface IMouseEvent { - readonly browserEvent: MouseEvent; - readonly leftButton: boolean; - readonly middleButton: boolean; - readonly rightButton: boolean; - readonly buttons: number; - readonly target: HTMLElement; - readonly detail: number; - readonly posx: number; - readonly posy: number; - readonly ctrlKey: boolean; - readonly shiftKey: boolean; - readonly altKey: boolean; - readonly metaKey: boolean; - readonly timestamp: number; - preventDefault(): void; - stopPropagation(): void; - } - - export interface IScrollEvent { - readonly scrollTop: number; - readonly scrollLeft: number; - readonly scrollWidth: number; - readonly scrollHeight: number; - readonly scrollTopChanged: boolean; - readonly scrollLeftChanged: boolean; - readonly scrollWidthChanged: boolean; - readonly scrollHeightChanged: boolean; - } - /** - * A position in the editor. This interface is suitable for serialization. - */ - export interface IPosition { - /** - * line number (starts at 1) - */ - readonly lineNumber: number; - /** - * column (the first character in a line is between column 1 and column 2) - */ - readonly column: number; - } - - /** - * A position in the editor. - */ - export class Position { - /** - * line number (starts at 1) - */ - readonly lineNumber: number; - /** - * column (the first character in a line is between column 1 and column 2) - */ - readonly column: number; - constructor(lineNumber: number, column: number); - /** - * Create a new position from this position. - * - * @param newLineNumber new line number - * @param newColumn new column - */ - with(newLineNumber?: number, newColumn?: number): Position; - /** - * Derive a new position from this position. - * - * @param deltaLineNumber line number delta - * @param deltaColumn column delta - */ - delta(deltaLineNumber?: number, deltaColumn?: number): Position; - /** - * Test if this position equals other position - */ - equals(other: IPosition): boolean; - /** - * Test if position `a` equals position `b` - */ - static equals(a: IPosition | null, b: IPosition | null): boolean; - /** - * Test if this position is before other position. - * If the two positions are equal, the result will be false. - */ - isBefore(other: IPosition): boolean; - /** - * Test if position `a` is before position `b`. - * If the two positions are equal, the result will be false. - */ - static isBefore(a: IPosition, b: IPosition): boolean; - /** - * Test if this position is before other position. - * If the two positions are equal, the result will be true. - */ - isBeforeOrEqual(other: IPosition): boolean; - /** - * Test if position `a` is before position `b`. - * If the two positions are equal, the result will be true. - */ - static isBeforeOrEqual(a: IPosition, b: IPosition): boolean; - /** - * A function that compares positions, useful for sorting - */ - static compare(a: IPosition, b: IPosition): number; - /** - * Clone this position. - */ - clone(): Position; - /** - * Convert to a human-readable representation. - */ - toString(): string; - /** - * Create a `Position` from an `IPosition`. - */ - static lift(pos: IPosition): Position; - /** - * Test if `obj` is an `IPosition`. - */ - static isIPosition(obj: any): obj is IPosition; - toJSON(): IPosition; - } - - /** - * A range in the editor. This interface is suitable for serialization. - */ - export interface IRange { - /** - * Line number on which the range starts (starts at 1). - */ - readonly startLineNumber: number; - /** - * Column on which the range starts in line `startLineNumber` (starts at 1). - */ - readonly startColumn: number; - /** - * Line number on which the range ends. - */ - readonly endLineNumber: number; - /** - * Column on which the range ends in line `endLineNumber`. - */ - readonly endColumn: number; - } - - /** - * A range in the editor. (startLineNumber,startColumn) is <= (endLineNumber,endColumn) - */ - export class Range { - /** - * Line number on which the range starts (starts at 1). - */ - readonly startLineNumber: number; - /** - * Column on which the range starts in line `startLineNumber` (starts at 1). - */ - readonly startColumn: number; - /** - * Line number on which the range ends. - */ - readonly endLineNumber: number; - /** - * Column on which the range ends in line `endLineNumber`. - */ - readonly endColumn: number; - constructor(startLineNumber: number, startColumn: number, endLineNumber: number, endColumn: number); - /** - * Test if this range is empty. - */ - isEmpty(): boolean; - /** - * Test if `range` is empty. - */ - static isEmpty(range: IRange): boolean; - /** - * Test if position is in this range. If the position is at the edges, will return true. - */ - containsPosition(position: IPosition): boolean; - /** - * Test if `position` is in `range`. If the position is at the edges, will return true. - */ - static containsPosition(range: IRange, position: IPosition): boolean; - /** - * Test if range is in this range. If the range is equal to this range, will return true. - */ - containsRange(range: IRange): boolean; - /** - * Test if `otherRange` is in `range`. If the ranges are equal, will return true. - */ - static containsRange(range: IRange, otherRange: IRange): boolean; - /** - * Test if `range` is strictly in this range. `range` must start after and end before this range for the result to be true. - */ - strictContainsRange(range: IRange): boolean; - /** - * Test if `otherRange` is strictly in `range` (must start after, and end before). If the ranges are equal, will return false. - */ - static strictContainsRange(range: IRange, otherRange: IRange): boolean; - /** - * A reunion of the two ranges. - * The smallest position will be used as the start point, and the largest one as the end point. - */ - plusRange(range: IRange): Range; - /** - * A reunion of the two ranges. - * The smallest position will be used as the start point, and the largest one as the end point. - */ - static plusRange(a: IRange, b: IRange): Range; - /** - * A intersection of the two ranges. - */ - intersectRanges(range: IRange): Range | null; - /** - * A intersection of the two ranges. - */ - static intersectRanges(a: IRange, b: IRange): Range | null; - /** - * Test if this range equals other. - */ - equalsRange(other: IRange | null | undefined): boolean; - /** - * Test if range `a` equals `b`. - */ - static equalsRange(a: IRange | null | undefined, b: IRange | null | undefined): boolean; - /** - * Return the end position (which will be after or equal to the start position) - */ - getEndPosition(): Position; - /** - * Return the end position (which will be after or equal to the start position) - */ - static getEndPosition(range: IRange): Position; - /** - * Return the start position (which will be before or equal to the end position) - */ - getStartPosition(): Position; - /** - * Return the start position (which will be before or equal to the end position) - */ - static getStartPosition(range: IRange): Position; - /** - * Transform to a user presentable string representation. - */ - toString(): string; - /** - * Create a new range using this range's start position, and using endLineNumber and endColumn as the end position. - */ - setEndPosition(endLineNumber: number, endColumn: number): Range; - /** - * Create a new range using this range's end position, and using startLineNumber and startColumn as the start position. - */ - setStartPosition(startLineNumber: number, startColumn: number): Range; - /** - * Create a new empty range using this range's start position. - */ - collapseToStart(): Range; - /** - * Create a new empty range using this range's start position. - */ - static collapseToStart(range: IRange): Range; - /** - * Create a new empty range using this range's end position. - */ - collapseToEnd(): Range; - /** - * Create a new empty range using this range's end position. - */ - static collapseToEnd(range: IRange): Range; - /** - * Moves the range by the given amount of lines. - */ - delta(lineCount: number): Range; - static fromPositions(start: IPosition, end?: IPosition): Range; - /** - * Create a `Range` from an `IRange`. - */ - static lift(range: undefined | null): null; - static lift(range: IRange): Range; - static lift(range: IRange | undefined | null): Range | null; - /** - * Test if `obj` is an `IRange`. - */ - static isIRange(obj: any): obj is IRange; - /** - * Test if the two ranges are touching in any way. - */ - static areIntersectingOrTouching(a: IRange, b: IRange): boolean; - /** - * Test if the two ranges are intersecting. If the ranges are touching it returns true. - */ - static areIntersecting(a: IRange, b: IRange): boolean; - /** - * A function that compares ranges, useful for sorting ranges - * It will first compare ranges on the startPosition and then on the endPosition - */ - static compareRangesUsingStarts(a: IRange | null | undefined, b: IRange | null | undefined): number; - /** - * A function that compares ranges, useful for sorting ranges - * It will first compare ranges on the endPosition and then on the startPosition - */ - static compareRangesUsingEnds(a: IRange, b: IRange): number; - /** - * Test if the range spans multiple lines. - */ - static spansMultipleLines(range: IRange): boolean; - toJSON(): IRange; - } - - /** - * A selection in the editor. - * The selection is a range that has an orientation. - */ - export interface ISelection { - /** - * The line number on which the selection has started. - */ - readonly selectionStartLineNumber: number; - /** - * The column on `selectionStartLineNumber` where the selection has started. - */ - readonly selectionStartColumn: number; - /** - * The line number on which the selection has ended. - */ - readonly positionLineNumber: number; - /** - * The column on `positionLineNumber` where the selection has ended. - */ - readonly positionColumn: number; - } - - /** - * A selection in the editor. - * The selection is a range that has an orientation. - */ - export class Selection extends Range { - /** - * The line number on which the selection has started. - */ - readonly selectionStartLineNumber: number; - /** - * The column on `selectionStartLineNumber` where the selection has started. - */ - readonly selectionStartColumn: number; - /** - * The line number on which the selection has ended. - */ - readonly positionLineNumber: number; - /** - * The column on `positionLineNumber` where the selection has ended. - */ - readonly positionColumn: number; - constructor(selectionStartLineNumber: number, selectionStartColumn: number, positionLineNumber: number, positionColumn: number); - /** - * Transform to a human-readable representation. - */ - toString(): string; - /** - * Test if equals other selection. - */ - equalsSelection(other: ISelection): boolean; - /** - * Test if the two selections are equal. - */ - static selectionsEqual(a: ISelection, b: ISelection): boolean; - /** - * Get directions (LTR or RTL). - */ - getDirection(): SelectionDirection; - /** - * Create a new selection with a different `positionLineNumber` and `positionColumn`. - */ - setEndPosition(endLineNumber: number, endColumn: number): Selection; - /** - * Get the position at `positionLineNumber` and `positionColumn`. - */ - getPosition(): Position; - /** - * Get the position at the start of the selection. - */ - getSelectionStart(): Position; - /** - * Create a new selection with a different `selectionStartLineNumber` and `selectionStartColumn`. - */ - setStartPosition(startLineNumber: number, startColumn: number): Selection; - /** - * Create a `Selection` from one or two positions - */ - static fromPositions(start: IPosition, end?: IPosition): Selection; - /** - * Creates a `Selection` from a range, given a direction. - */ - static fromRange(range: Range, direction: SelectionDirection): Selection; - /** - * Create a `Selection` from an `ISelection`. - */ - static liftSelection(sel: ISelection): Selection; - /** - * `a` equals `b`. - */ - static selectionsArrEqual(a: ISelection[], b: ISelection[]): boolean; - /** - * Test if `obj` is an `ISelection`. - */ - static isISelection(obj: any): obj is ISelection; - /** - * Create with a direction. - */ - static createWithDirection(startLineNumber: number, startColumn: number, endLineNumber: number, endColumn: number, direction: SelectionDirection): Selection; - } - - /** - * The direction of a selection. - */ - export enum SelectionDirection { - /** - * The selection starts above where it ends. - */ - LTR = 0, - /** - * The selection starts below where it ends. - */ - RTL = 1 - } - - export class Token { - readonly offset: number; - readonly type: string; - readonly language: string; - _tokenBrand: void; - constructor(offset: number, type: string, language: string); - toString(): string; - } -} - -declare namespace monaco.editor { - - /** - * Create a new editor under `domElement`. - * `domElement` should be empty (not contain other dom nodes). - * The editor will read the size of `domElement`. - */ - export function create(domElement: HTMLElement, options?: IStandaloneEditorConstructionOptions, override?: IEditorOverrideServices): IStandaloneCodeEditor; - - /** - * Emitted when an editor is created. - * Creating a diff editor might cause this listener to be invoked with the two editors. - * @event - */ - export function onDidCreateEditor(listener: (codeEditor: ICodeEditor) => void): IDisposable; - - /** - * Emitted when an diff editor is created. - * @event - */ - export function onDidCreateDiffEditor(listener: (diffEditor: IDiffEditor) => void): IDisposable; - - /** - * Get all the created editors. - */ - export function getEditors(): readonly ICodeEditor[]; - - /** - * Get all the created diff editors. - */ - export function getDiffEditors(): readonly IDiffEditor[]; - - /** - * Create a new diff editor under `domElement`. - * `domElement` should be empty (not contain other dom nodes). - * The editor will read the size of `domElement`. - */ - export function createDiffEditor(domElement: HTMLElement, options?: IStandaloneDiffEditorConstructionOptions, override?: IEditorOverrideServices): IStandaloneDiffEditor; - - export function createMultiFileDiffEditor(domElement: HTMLElement, override?: IEditorOverrideServices): any; - - /** - * Description of a command contribution - */ - export interface ICommandDescriptor { - /** - * An unique identifier of the contributed command. - */ - id: string; - /** - * Callback that will be executed when the command is triggered. - */ - run: ICommandHandler; - } - - /** - * Add a command. - */ - export function addCommand(descriptor: ICommandDescriptor): IDisposable; - - /** - * Add an action to all editors. - */ - export function addEditorAction(descriptor: IActionDescriptor): IDisposable; - - /** - * A keybinding rule. - */ - export interface IKeybindingRule { - keybinding: number; - command?: string | null; - commandArgs?: any; - when?: string | null; - } - - /** - * Add a keybinding rule. - */ - export function addKeybindingRule(rule: IKeybindingRule): IDisposable; - - /** - * Add keybinding rules. - */ - export function addKeybindingRules(rules: IKeybindingRule[]): IDisposable; - - /** - * Create a new editor model. - * You can specify the language that should be set for this model or let the language be inferred from the `uri`. - */ - export function createModel(value: string, language?: string, uri?: Uri): ITextModel; - - /** - * Change the language for a model. - */ - export function setModelLanguage(model: ITextModel, mimeTypeOrLanguageId: string): void; - - /** - * Set the markers for a model. - */ - export function setModelMarkers(model: ITextModel, owner: string, markers: IMarkerData[]): void; - - /** - * Remove all markers of an owner. - */ - export function removeAllMarkers(owner: string): void; - - /** - * Get markers for owner and/or resource - * - * @returns list of markers - */ - export function getModelMarkers(filter: { - owner?: string; - resource?: Uri; - take?: number; - }): IMarker[]; - - /** - * Emitted when markers change for a model. - * @event - */ - export function onDidChangeMarkers(listener: (e: readonly Uri[]) => void): IDisposable; - - /** - * Get the model that has `uri` if it exists. - */ - export function getModel(uri: Uri): ITextModel | null; - - /** - * Get all the created models. - */ - export function getModels(): ITextModel[]; - - /** - * Emitted when a model is created. - * @event - */ - export function onDidCreateModel(listener: (model: ITextModel) => void): IDisposable; - - /** - * Emitted right before a model is disposed. - * @event - */ - export function onWillDisposeModel(listener: (model: ITextModel) => void): IDisposable; - - /** - * Emitted when a different language is set to a model. - * @event - */ - export function onDidChangeModelLanguage(listener: (e: { - readonly model: ITextModel; - readonly oldLanguage: string; - }) => void): IDisposable; - - /** - * Create a new web worker that has model syncing capabilities built in. - * Specify an AMD module to load that will `create` an object that will be proxied. - */ - export function createWebWorker(opts: IWebWorkerOptions): MonacoWebWorker; - - /** - * Colorize the contents of `domNode` using attribute `data-lang`. - */ - export function colorizeElement(domNode: HTMLElement, options: IColorizerElementOptions): Promise; - - /** - * Colorize `text` using language `languageId`. - */ - export function colorize(text: string, languageId: string, options: IColorizerOptions): Promise; - - /** - * Colorize a line in a model. - */ - export function colorizeModelLine(model: ITextModel, lineNumber: number, tabSize?: number): string; - - /** - * Tokenize `text` using language `languageId` - */ - export function tokenize(text: string, languageId: string): Token[][]; - - /** - * Define a new theme or update an existing theme. - */ - export function defineTheme(themeName: string, themeData: IStandaloneThemeData): void; - - /** - * Switches to a theme. - */ - export function setTheme(themeName: string): void; - - /** - * Clears all cached font measurements and triggers re-measurement. - */ - export function remeasureFonts(): void; - - /** - * Register a command. - */ - export function registerCommand(id: string, handler: (accessor: any, ...args: any[]) => void): IDisposable; - - export interface ILinkOpener { - open(resource: Uri): boolean | Promise; - } - - /** - * Registers a handler that is called when a link is opened in any editor. The handler callback should return `true` if the link was handled and `false` otherwise. - * The handler that was registered last will be called first when a link is opened. - * - * Returns a disposable that can unregister the opener again. - */ - export function registerLinkOpener(opener: ILinkOpener): IDisposable; - - /** - * Represents an object that can handle editor open operations (e.g. when "go to definition" is called - * with a resource other than the current model). - */ - export interface ICodeEditorOpener { - /** - * Callback that is invoked when a resource other than the current model should be opened (e.g. when "go to definition" is called). - * The callback should return `true` if the request was handled and `false` otherwise. - * @param source The code editor instance that initiated the request. - * @param resource The Uri of the resource that should be opened. - * @param selectionOrPosition An optional position or selection inside the model corresponding to `resource` that can be used to set the cursor. - */ - openCodeEditor(source: ICodeEditor, resource: Uri, selectionOrPosition?: IRange | IPosition): boolean | Promise; - } - - /** - * Registers a handler that is called when a resource other than the current model should be opened in the editor (e.g. "go to definition"). - * The handler callback should return `true` if the request was handled and `false` otherwise. - * - * Returns a disposable that can unregister the opener again. - * - * If no handler is registered the default behavior is to do nothing for models other than the currently attached one. - */ - export function registerEditorOpener(opener: ICodeEditorOpener): IDisposable; - - export type BuiltinTheme = 'vs' | 'vs-dark' | 'hc-black' | 'hc-light'; - - export interface IStandaloneThemeData { - base: BuiltinTheme; - inherit: boolean; - rules: ITokenThemeRule[]; - encodedTokensColors?: string[]; - colors: IColors; - } - - export type IColors = { - [colorId: string]: string; - }; - - export interface ITokenThemeRule { - token: string; - foreground?: string; - background?: string; - fontStyle?: string; - } - - /** - * A web worker that can provide a proxy to an arbitrary file. - */ - export interface MonacoWebWorker { - /** - * Terminate the web worker, thus invalidating the returned proxy. - */ - dispose(): void; - /** - * Get a proxy to the arbitrary loaded code. - */ - getProxy(): Promise; - /** - * Synchronize (send) the models at `resources` to the web worker, - * making them available in the monaco.worker.getMirrorModels(). - */ - withSyncedResources(resources: Uri[]): Promise; - } - - export interface IWebWorkerOptions { - /** - * The AMD moduleId to load. - * It should export a function `create` that should return the exported proxy. - */ - moduleId: string; - /** - * The data to send over when calling create on the module. - */ - createData?: any; - /** - * A label to be used to identify the web worker for debugging purposes. - */ - label?: string; - /** - * An object that can be used by the web worker to make calls back to the main thread. - */ - host?: any; - /** - * Keep idle models. - * Defaults to false, which means that idle models will stop syncing after a while. - */ - keepIdleModels?: boolean; - } - - /** - * Description of an action contribution - */ - export interface IActionDescriptor { - /** - * An unique identifier of the contributed action. - */ - id: string; - /** - * A label of the action that will be presented to the user. - */ - label: string; - /** - * Precondition rule. The value should be a [context key expression](https://code.visualstudio.com/docs/getstarted/keybindings#_when-clause-contexts). - */ - precondition?: string; - /** - * An array of keybindings for the action. - */ - keybindings?: number[]; - /** - * The keybinding rule (condition on top of precondition). - */ - keybindingContext?: string; - /** - * Control if the action should show up in the context menu and where. - * The context menu of the editor has these default: - * navigation - The navigation group comes first in all cases. - * 1_modification - This group comes next and contains commands that modify your code. - * 9_cutcopypaste - The last default group with the basic editing commands. - * You can also create your own group. - * Defaults to null (don't show in context menu). - */ - contextMenuGroupId?: string; - /** - * Control the order in the context menu group. - */ - contextMenuOrder?: number; - /** - * Method that will be executed when the action is triggered. - * @param editor The editor instance is passed in as a convenience - */ - run(editor: ICodeEditor, ...args: any[]): void | Promise; - } - - /** - * Options which apply for all editors. - */ - export interface IGlobalEditorOptions { - /** - * The number of spaces a tab is equal to. - * This setting is overridden based on the file contents when `detectIndentation` is on. - * Defaults to 4. - */ - tabSize?: number; - /** - * Insert spaces when pressing `Tab`. - * This setting is overridden based on the file contents when `detectIndentation` is on. - * Defaults to true. - */ - insertSpaces?: boolean; - /** - * Controls whether `tabSize` and `insertSpaces` will be automatically detected when a file is opened based on the file contents. - * Defaults to true. - */ - detectIndentation?: boolean; - /** - * Remove trailing auto inserted whitespace. - * Defaults to true. - */ - trimAutoWhitespace?: boolean; - /** - * Special handling for large files to disable certain memory intensive features. - * Defaults to true. - */ - largeFileOptimizations?: boolean; - /** - * Controls whether completions should be computed based on words in the document. - * Defaults to true. - */ - wordBasedSuggestions?: 'off' | 'currentDocument' | 'matchingDocuments' | 'allDocuments'; - /** - * Controls whether word based completions should be included from opened documents of the same language or any language. - */ - wordBasedSuggestionsOnlySameLanguage?: boolean; - /** - * Controls whether the semanticHighlighting is shown for the languages that support it. - * true: semanticHighlighting is enabled for all themes - * false: semanticHighlighting is disabled for all themes - * 'configuredByTheme': semanticHighlighting is controlled by the current color theme's semanticHighlighting setting. - * Defaults to 'byTheme'. - */ - 'semanticHighlighting.enabled'?: true | false | 'configuredByTheme'; - /** - * Keep peek editors open even when double-clicking their content or when hitting `Escape`. - * Defaults to false. - */ - stablePeek?: boolean; - /** - * Lines above this length will not be tokenized for performance reasons. - * Defaults to 20000. - */ - maxTokenizationLineLength?: number; - /** - * Theme to be used for rendering. - * The current out-of-the-box available themes are: 'vs' (default), 'vs-dark', 'hc-black', 'hc-light'. - * You can create custom themes via `monaco.editor.defineTheme`. - * To switch a theme, use `monaco.editor.setTheme`. - * **NOTE**: The theme might be overwritten if the OS is in high contrast mode, unless `autoDetectHighContrast` is set to false. - */ - theme?: string; - /** - * If enabled, will automatically change to high contrast theme if the OS is using a high contrast theme. - * Defaults to true. - */ - autoDetectHighContrast?: boolean; - } - - /** - * The options to create an editor. - */ - export interface IStandaloneEditorConstructionOptions extends IEditorConstructionOptions, IGlobalEditorOptions { - /** - * The initial model associated with this code editor. - */ - model?: ITextModel | null; - /** - * The initial value of the auto created model in the editor. - * To not automatically create a model, use `model: null`. - */ - value?: string; - /** - * The initial language of the auto created model in the editor. - * To not automatically create a model, use `model: null`. - */ - language?: string; - /** - * Initial theme to be used for rendering. - * The current out-of-the-box available themes are: 'vs' (default), 'vs-dark', 'hc-black', 'hc-light. - * You can create custom themes via `monaco.editor.defineTheme`. - * To switch a theme, use `monaco.editor.setTheme`. - * **NOTE**: The theme might be overwritten if the OS is in high contrast mode, unless `autoDetectHighContrast` is set to false. - */ - theme?: string; - /** - * If enabled, will automatically change to high contrast theme if the OS is using a high contrast theme. - * Defaults to true. - */ - autoDetectHighContrast?: boolean; - /** - * An URL to open when Ctrl+H (Windows and Linux) or Cmd+H (OSX) is pressed in - * the accessibility help dialog in the editor. - * - * Defaults to "https://go.microsoft.com/fwlink/?linkid=852450" - */ - accessibilityHelpUrl?: string; - /** - * Container element to use for ARIA messages. - * Defaults to document.body. - */ - ariaContainerElement?: HTMLElement; - } - - /** - * The options to create a diff editor. - */ - export interface IStandaloneDiffEditorConstructionOptions extends IDiffEditorConstructionOptions { - /** - * Initial theme to be used for rendering. - * The current out-of-the-box available themes are: 'vs' (default), 'vs-dark', 'hc-black', 'hc-light. - * You can create custom themes via `monaco.editor.defineTheme`. - * To switch a theme, use `monaco.editor.setTheme`. - * **NOTE**: The theme might be overwritten if the OS is in high contrast mode, unless `autoDetectHighContrast` is set to false. - */ - theme?: string; - /** - * If enabled, will automatically change to high contrast theme if the OS is using a high contrast theme. - * Defaults to true. - */ - autoDetectHighContrast?: boolean; - } - - export interface IStandaloneCodeEditor extends ICodeEditor { - updateOptions(newOptions: IEditorOptions & IGlobalEditorOptions): void; - addCommand(keybinding: number, handler: ICommandHandler, context?: string): string | null; - createContextKey(key: string, defaultValue: T): IContextKey; - addAction(descriptor: IActionDescriptor): IDisposable; - } - - export interface IStandaloneDiffEditor extends IDiffEditor { - addCommand(keybinding: number, handler: ICommandHandler, context?: string): string | null; - createContextKey(key: string, defaultValue: T): IContextKey; - addAction(descriptor: IActionDescriptor): IDisposable; - getOriginalEditor(): IStandaloneCodeEditor; - getModifiedEditor(): IStandaloneCodeEditor; - } - export interface ICommandHandler { - (...args: any[]): void; - } - export interface ILocalizedString { - original: string; - value: string; - } - export interface ICommandMetadata { - readonly description: ILocalizedString | string; - } - - export interface IContextKey { - set(value: T): void; - reset(): void; - get(): T | undefined; - } - - export type ContextKeyValue = null | undefined | boolean | number | string | Array | Record; - - export interface IEditorOverrideServices { - [index: string]: any; - } - - export interface IMarker { - owner: string; - resource: Uri; - severity: MarkerSeverity; - code?: string | { - value: string; - target: Uri; - }; - message: string; - source?: string; - startLineNumber: number; - startColumn: number; - endLineNumber: number; - endColumn: number; - modelVersionId?: number; - relatedInformation?: IRelatedInformation[]; - tags?: MarkerTag[]; - } - - /** - * A structure defining a problem/warning/etc. - */ - export interface IMarkerData { - code?: string | { - value: string; - target: Uri; - }; - severity: MarkerSeverity; - message: string; - source?: string; - startLineNumber: number; - startColumn: number; - endLineNumber: number; - endColumn: number; - modelVersionId?: number; - relatedInformation?: IRelatedInformation[]; - tags?: MarkerTag[]; - } - - /** - * - */ - export interface IRelatedInformation { - resource: Uri; - message: string; - startLineNumber: number; - startColumn: number; - endLineNumber: number; - endColumn: number; - } - - export interface IColorizerOptions { - tabSize?: number; - } - - export interface IColorizerElementOptions extends IColorizerOptions { - theme?: string; - mimeType?: string; - } - - export enum ScrollbarVisibility { - Auto = 1, - Hidden = 2, - Visible = 3 - } - - export interface ThemeColor { - id: string; - } - - /** - * A single edit operation, that acts as a simple replace. - * i.e. Replace text at `range` with `text` in model. - */ - export interface ISingleEditOperation { - /** - * The range to replace. This can be empty to emulate a simple insert. - */ - range: IRange; - /** - * The text to replace with. This can be null to emulate a simple delete. - */ - text: string | null; - /** - * This indicates that this operation has "insert" semantics. - * i.e. forceMoveMarkers = true => if `range` is collapsed, all markers at the position will be moved. - */ - forceMoveMarkers?: boolean; - } - - /** - * Word inside a model. - */ - export interface IWordAtPosition { - /** - * The word. - */ - readonly word: string; - /** - * The column where the word starts. - */ - readonly startColumn: number; - /** - * The column where the word ends. - */ - readonly endColumn: number; - } - - /** - * Vertical Lane in the overview ruler of the editor. - */ - export enum OverviewRulerLane { - Left = 1, - Center = 2, - Right = 4, - Full = 7 - } - - /** - * Vertical Lane in the glyph margin of the editor. - */ - export enum GlyphMarginLane { - Left = 1, - Center = 2, - Right = 3 - } - - export interface IGlyphMarginLanesModel { - /** - * The number of lanes that should be rendered in the editor. - */ - readonly requiredLanes: number; - /** - * Gets the lanes that should be rendered starting at a given line number. - */ - getLanesAtLine(lineNumber: number): GlyphMarginLane[]; - /** - * Resets the model and ensures it can contain at least `maxLine` lines. - */ - reset(maxLine: number): void; - /** - * Registers that a lane should be visible at the Range in the model. - * @param persist - if true, notes that the lane should always be visible, - * even on lines where there's no specific request for that lane. - */ - push(lane: GlyphMarginLane, range: Range, persist?: boolean): void; - } - - /** - * Position in the minimap to render the decoration. - */ - export enum MinimapPosition { - Inline = 1, - Gutter = 2 - } - - /** - * Section header style. - */ - export enum MinimapSectionHeaderStyle { - Normal = 1, - Underlined = 2 - } - - export interface IDecorationOptions { - /** - * CSS color to render. - * e.g.: rgba(100, 100, 100, 0.5) or a color from the color registry - */ - color: string | ThemeColor | undefined; - /** - * CSS color to render. - * e.g.: rgba(100, 100, 100, 0.5) or a color from the color registry - */ - darkColor?: string | ThemeColor; - } - - export interface IModelDecorationGlyphMarginOptions { - /** - * The position in the glyph margin. - */ - position: GlyphMarginLane; - /** - * Whether the glyph margin lane in {@link position} should be rendered even - * outside of this decoration's range. - */ - persistLane?: boolean; - } - - /** - * Options for rendering a model decoration in the overview ruler. - */ - export interface IModelDecorationOverviewRulerOptions extends IDecorationOptions { - /** - * The position in the overview ruler. - */ - position: OverviewRulerLane; - } - - /** - * Options for rendering a model decoration in the minimap. - */ - export interface IModelDecorationMinimapOptions extends IDecorationOptions { - /** - * The position in the minimap. - */ - position: MinimapPosition; - /** - * If the decoration is for a section header, which header style. - */ - sectionHeaderStyle?: MinimapSectionHeaderStyle | null; - /** - * If the decoration is for a section header, the header text. - */ - sectionHeaderText?: string | null; - } - - /** - * Options for a model decoration. - */ - export interface IModelDecorationOptions { - /** - * Customize the growing behavior of the decoration when typing at the edges of the decoration. - * Defaults to TrackedRangeStickiness.AlwaysGrowsWhenTypingAtEdges - */ - stickiness?: TrackedRangeStickiness; - /** - * CSS class name describing the decoration. - */ - className?: string | null; - /** - * Indicates whether the decoration should span across the entire line when it continues onto the next line. - */ - shouldFillLineOnLineBreak?: boolean | null; - blockClassName?: string | null; - /** - * Indicates if this block should be rendered after the last line. - * In this case, the range must be empty and set to the last line. - */ - blockIsAfterEnd?: boolean | null; - blockDoesNotCollapse?: boolean | null; - blockPadding?: [top: number, right: number, bottom: number, left: number] | null; - /** - * Message to be rendered when hovering over the glyph margin decoration. - */ - glyphMarginHoverMessage?: IMarkdownString | IMarkdownString[] | null; - /** - * Array of MarkdownString to render as the decoration message. - */ - hoverMessage?: IMarkdownString | IMarkdownString[] | null; - /** - * Array of MarkdownString to render as the line number message. - */ - lineNumberHoverMessage?: IMarkdownString | IMarkdownString[] | null; - /** - * Should the decoration expand to encompass a whole line. - */ - isWholeLine?: boolean; - /** - * Always render the decoration (even when the range it encompasses is collapsed). - */ - showIfCollapsed?: boolean; - /** - * Specifies the stack order of a decoration. - * A decoration with greater stack order is always in front of a decoration with - * a lower stack order when the decorations are on the same line. - */ - zIndex?: number; - /** - * If set, render this decoration in the overview ruler. - */ - overviewRuler?: IModelDecorationOverviewRulerOptions | null; - /** - * If set, render this decoration in the minimap. - */ - minimap?: IModelDecorationMinimapOptions | null; - /** - * If set, the decoration will be rendered in the glyph margin with this CSS class name. - */ - glyphMarginClassName?: string | null; - /** - * If set and the decoration has {@link glyphMarginClassName} set, render this decoration - * with the specified {@link IModelDecorationGlyphMarginOptions} in the glyph margin. - */ - glyphMargin?: IModelDecorationGlyphMarginOptions | null; - /** - * If set, the decoration will be rendered in the lines decorations with this CSS class name. - */ - linesDecorationsClassName?: string | null; - /** - * Controls the tooltip text of the line decoration. - */ - linesDecorationsTooltip?: string | null; - /** - * If set, the decoration will be rendered on the line number. - */ - lineNumberClassName?: string | null; - /** - * If set, the decoration will be rendered in the lines decorations with this CSS class name, but only for the first line in case of line wrapping. - */ - firstLineDecorationClassName?: string | null; - /** - * If set, the decoration will be rendered in the margin (covering its full width) with this CSS class name. - */ - marginClassName?: string | null; - /** - * If set, the decoration will be rendered inline with the text with this CSS class name. - * Please use this only for CSS rules that must impact the text. For example, use `className` - * to have a background color decoration. - */ - inlineClassName?: string | null; - /** - * If there is an `inlineClassName` which affects letter spacing. - */ - inlineClassNameAffectsLetterSpacing?: boolean; - /** - * If set, the decoration will be rendered before the text with this CSS class name. - */ - beforeContentClassName?: string | null; - /** - * If set, the decoration will be rendered after the text with this CSS class name. - */ - afterContentClassName?: string | null; - /** - * If set, text will be injected in the view after the range. - */ - after?: InjectedTextOptions | null; - /** - * If set, text will be injected in the view before the range. - */ - before?: InjectedTextOptions | null; - } - - /** - * Configures text that is injected into the view without changing the underlying document. - */ - export interface InjectedTextOptions { - /** - * Sets the text to inject. Must be a single line. - */ - readonly content: string; - /** - * If set, the decoration will be rendered inline with the text with this CSS class name. - */ - readonly inlineClassName?: string | null; - /** - * If there is an `inlineClassName` which affects letter spacing. - */ - readonly inlineClassNameAffectsLetterSpacing?: boolean; - /** - * This field allows to attach data to this injected text. - * The data can be read when injected texts at a given position are queried. - */ - readonly attachedData?: unknown; - /** - * Configures cursor stops around injected text. - * Defaults to {@link InjectedTextCursorStops.Both}. - */ - readonly cursorStops?: InjectedTextCursorStops | null; - } - - export enum InjectedTextCursorStops { - Both = 0, - Right = 1, - Left = 2, - None = 3 - } - - /** - * New model decorations. - */ - export interface IModelDeltaDecoration { - /** - * Range that this decoration covers. - */ - range: IRange; - /** - * Options associated with this decoration. - */ - options: IModelDecorationOptions; - } - - /** - * A decoration in the model. - */ - export interface IModelDecoration { - /** - * Identifier for a decoration. - */ - readonly id: string; - /** - * Identifier for a decoration's owner. - */ - readonly ownerId: number; - /** - * Range that this decoration covers. - */ - readonly range: Range; - /** - * Options associated with this decoration. - */ - readonly options: IModelDecorationOptions; - } - - /** - * End of line character preference. - */ - export enum EndOfLinePreference { - /** - * Use the end of line character identified in the text buffer. - */ - TextDefined = 0, - /** - * Use line feed (\n) as the end of line character. - */ - LF = 1, - /** - * Use carriage return and line feed (\r\n) as the end of line character. - */ - CRLF = 2 - } - - /** - * The default end of line to use when instantiating models. - */ - export enum DefaultEndOfLine { - /** - * Use line feed (\n) as the end of line character. - */ - LF = 1, - /** - * Use carriage return and line feed (\r\n) as the end of line character. - */ - CRLF = 2 - } - - /** - * End of line character preference. - */ - export enum EndOfLineSequence { - /** - * Use line feed (\n) as the end of line character. - */ - LF = 0, - /** - * Use carriage return and line feed (\r\n) as the end of line character. - */ - CRLF = 1 - } - - /** - * A single edit operation, that has an identifier. - */ - export interface IIdentifiedSingleEditOperation extends ISingleEditOperation { - } - - export interface IValidEditOperation { - /** - * The range to replace. This can be empty to emulate a simple insert. - */ - range: Range; - /** - * The text to replace with. This can be empty to emulate a simple delete. - */ - text: string; - } - - /** - * A callback that can compute the cursor state after applying a series of edit operations. - */ - export interface ICursorStateComputer { - /** - * A callback that can compute the resulting cursors state after some edit operations have been executed. - */ - (inverseEditOperations: IValidEditOperation[]): Selection[] | null; - } - - export class TextModelResolvedOptions { - _textModelResolvedOptionsBrand: void; - readonly tabSize: number; - readonly indentSize: number; - readonly insertSpaces: boolean; - readonly defaultEOL: DefaultEndOfLine; - readonly trimAutoWhitespace: boolean; - readonly bracketPairColorizationOptions: BracketPairColorizationOptions; - get originalIndentSize(): number | 'tabSize'; - } - - export interface BracketPairColorizationOptions { - enabled: boolean; - independentColorPoolPerBracketType: boolean; - } - - export interface ITextModelUpdateOptions { - tabSize?: number; - indentSize?: number | 'tabSize'; - insertSpaces?: boolean; - trimAutoWhitespace?: boolean; - bracketColorizationOptions?: BracketPairColorizationOptions; - } - - export class FindMatch { - _findMatchBrand: void; - readonly range: Range; - readonly matches: string[] | null; - } - - /** - * Describes the behavior of decorations when typing/editing near their edges. - * Note: Please do not edit the values, as they very carefully match `DecorationRangeBehavior` - */ - export enum TrackedRangeStickiness { - AlwaysGrowsWhenTypingAtEdges = 0, - NeverGrowsWhenTypingAtEdges = 1, - GrowsOnlyWhenTypingBefore = 2, - GrowsOnlyWhenTypingAfter = 3 - } - - /** - * Text snapshot that works like an iterator. - * Will try to return chunks of roughly ~64KB size. - * Will return null when finished. - */ - export interface ITextSnapshot { - read(): string | null; - } - - /** - * A model. - */ - export interface ITextModel { - /** - * Gets the resource associated with this editor model. - */ - readonly uri: Uri; - /** - * A unique identifier associated with this model. - */ - readonly id: string; - /** - * Get the resolved options for this model. - */ - getOptions(): TextModelResolvedOptions; - /** - * Get the current version id of the model. - * Anytime a change happens to the model (even undo/redo), - * the version id is incremented. - */ - getVersionId(): number; - /** - * Get the alternative version id of the model. - * This alternative version id is not always incremented, - * it will return the same values in the case of undo-redo. - */ - getAlternativeVersionId(): number; - /** - * Replace the entire text buffer value contained in this model. - */ - setValue(newValue: string | ITextSnapshot): void; - /** - * Get the text stored in this model. - * @param eol The end of line character preference. Defaults to `EndOfLinePreference.TextDefined`. - * @param preserverBOM Preserve a BOM character if it was detected when the model was constructed. - * @return The text. - */ - getValue(eol?: EndOfLinePreference, preserveBOM?: boolean): string; - /** - * Get the text stored in this model. - * @param preserverBOM Preserve a BOM character if it was detected when the model was constructed. - * @return The text snapshot (it is safe to consume it asynchronously). - */ - createSnapshot(preserveBOM?: boolean): ITextSnapshot; - /** - * Get the length of the text stored in this model. - */ - getValueLength(eol?: EndOfLinePreference, preserveBOM?: boolean): number; - /** - * Get the text in a certain range. - * @param range The range describing what text to get. - * @param eol The end of line character preference. This will only be used for multiline ranges. Defaults to `EndOfLinePreference.TextDefined`. - * @return The text. - */ - getValueInRange(range: IRange, eol?: EndOfLinePreference): string; - /** - * Get the length of text in a certain range. - * @param range The range describing what text length to get. - * @return The text length. - */ - getValueLengthInRange(range: IRange, eol?: EndOfLinePreference): number; - /** - * Get the character count of text in a certain range. - * @param range The range describing what text length to get. - */ - getCharacterCountInRange(range: IRange, eol?: EndOfLinePreference): number; - /** - * Get the number of lines in the model. - */ - getLineCount(): number; - /** - * Get the text for a certain line. - */ - getLineContent(lineNumber: number): string; - /** - * Get the text length for a certain line. - */ - getLineLength(lineNumber: number): number; - /** - * Get the text for all lines. - */ - getLinesContent(): string[]; - /** - * Get the end of line sequence predominantly used in the text buffer. - * @return EOL char sequence (e.g.: '\n' or '\r\n'). - */ - getEOL(): string; - /** - * Get the end of line sequence predominantly used in the text buffer. - */ - getEndOfLineSequence(): EndOfLineSequence; - /** - * Get the minimum legal column for line at `lineNumber` - */ - getLineMinColumn(lineNumber: number): number; - /** - * Get the maximum legal column for line at `lineNumber` - */ - getLineMaxColumn(lineNumber: number): number; - /** - * Returns the column before the first non whitespace character for line at `lineNumber`. - * Returns 0 if line is empty or contains only whitespace. - */ - getLineFirstNonWhitespaceColumn(lineNumber: number): number; - /** - * Returns the column after the last non whitespace character for line at `lineNumber`. - * Returns 0 if line is empty or contains only whitespace. - */ - getLineLastNonWhitespaceColumn(lineNumber: number): number; - /** - * Create a valid position. - */ - validatePosition(position: IPosition): Position; - /** - * Advances the given position by the given offset (negative offsets are also accepted) - * and returns it as a new valid position. - * - * If the offset and position are such that their combination goes beyond the beginning or - * end of the model, throws an exception. - * - * If the offset is such that the new position would be in the middle of a multi-byte - * line terminator, throws an exception. - */ - modifyPosition(position: IPosition, offset: number): Position; - /** - * Create a valid range. - */ - validateRange(range: IRange): Range; - /** - * Converts the position to a zero-based offset. - * - * The position will be [adjusted](#TextDocument.validatePosition). - * - * @param position A position. - * @return A valid zero-based offset. - */ - getOffsetAt(position: IPosition): number; - /** - * Converts a zero-based offset to a position. - * - * @param offset A zero-based offset. - * @return A valid [position](#Position). - */ - getPositionAt(offset: number): Position; - /** - * Get a range covering the entire model. - */ - getFullModelRange(): Range; - /** - * Returns if the model was disposed or not. - */ - isDisposed(): boolean; - /** - * Search the model. - * @param searchString The string used to search. If it is a regular expression, set `isRegex` to true. - * @param searchOnlyEditableRange Limit the searching to only search inside the editable range of the model. - * @param isRegex Used to indicate that `searchString` is a regular expression. - * @param matchCase Force the matching to match lower/upper case exactly. - * @param wordSeparators Force the matching to match entire words only. Pass null otherwise. - * @param captureMatches The result will contain the captured groups. - * @param limitResultCount Limit the number of results - * @return The ranges where the matches are. It is empty if not matches have been found. - */ - findMatches(searchString: string, searchOnlyEditableRange: boolean, isRegex: boolean, matchCase: boolean, wordSeparators: string | null, captureMatches: boolean, limitResultCount?: number): FindMatch[]; - /** - * Search the model. - * @param searchString The string used to search. If it is a regular expression, set `isRegex` to true. - * @param searchScope Limit the searching to only search inside these ranges. - * @param isRegex Used to indicate that `searchString` is a regular expression. - * @param matchCase Force the matching to match lower/upper case exactly. - * @param wordSeparators Force the matching to match entire words only. Pass null otherwise. - * @param captureMatches The result will contain the captured groups. - * @param limitResultCount Limit the number of results - * @return The ranges where the matches are. It is empty if no matches have been found. - */ - findMatches(searchString: string, searchScope: IRange | IRange[], isRegex: boolean, matchCase: boolean, wordSeparators: string | null, captureMatches: boolean, limitResultCount?: number): FindMatch[]; - /** - * Search the model for the next match. Loops to the beginning of the model if needed. - * @param searchString The string used to search. If it is a regular expression, set `isRegex` to true. - * @param searchStart Start the searching at the specified position. - * @param isRegex Used to indicate that `searchString` is a regular expression. - * @param matchCase Force the matching to match lower/upper case exactly. - * @param wordSeparators Force the matching to match entire words only. Pass null otherwise. - * @param captureMatches The result will contain the captured groups. - * @return The range where the next match is. It is null if no next match has been found. - */ - findNextMatch(searchString: string, searchStart: IPosition, isRegex: boolean, matchCase: boolean, wordSeparators: string | null, captureMatches: boolean): FindMatch | null; - /** - * Search the model for the previous match. Loops to the end of the model if needed. - * @param searchString The string used to search. If it is a regular expression, set `isRegex` to true. - * @param searchStart Start the searching at the specified position. - * @param isRegex Used to indicate that `searchString` is a regular expression. - * @param matchCase Force the matching to match lower/upper case exactly. - * @param wordSeparators Force the matching to match entire words only. Pass null otherwise. - * @param captureMatches The result will contain the captured groups. - * @return The range where the previous match is. It is null if no previous match has been found. - */ - findPreviousMatch(searchString: string, searchStart: IPosition, isRegex: boolean, matchCase: boolean, wordSeparators: string | null, captureMatches: boolean): FindMatch | null; - /** - * Get the language associated with this model. - */ - getLanguageId(): string; - /** - * Get the word under or besides `position`. - * @param position The position to look for a word. - * @return The word under or besides `position`. Might be null. - */ - getWordAtPosition(position: IPosition): IWordAtPosition | null; - /** - * Get the word under or besides `position` trimmed to `position`.column - * @param position The position to look for a word. - * @return The word under or besides `position`. Will never be null. - */ - getWordUntilPosition(position: IPosition): IWordAtPosition; - /** - * Perform a minimum amount of operations, in order to transform the decorations - * identified by `oldDecorations` to the decorations described by `newDecorations` - * and returns the new identifiers associated with the resulting decorations. - * - * @param oldDecorations Array containing previous decorations identifiers. - * @param newDecorations Array describing what decorations should result after the call. - * @param ownerId Identifies the editor id in which these decorations should appear. If no `ownerId` is provided, the decorations will appear in all editors that attach this model. - * @return An array containing the new decorations identifiers. - */ - deltaDecorations(oldDecorations: string[], newDecorations: IModelDeltaDecoration[], ownerId?: number): string[]; - /** - * Get the options associated with a decoration. - * @param id The decoration id. - * @return The decoration options or null if the decoration was not found. - */ - getDecorationOptions(id: string): IModelDecorationOptions | null; - /** - * Get the range associated with a decoration. - * @param id The decoration id. - * @return The decoration range or null if the decoration was not found. - */ - getDecorationRange(id: string): Range | null; - /** - * Gets all the decorations for the line `lineNumber` as an array. - * @param lineNumber The line number - * @param ownerId If set, it will ignore decorations belonging to other owners. - * @param filterOutValidation If set, it will ignore decorations specific to validation (i.e. warnings, errors). - * @return An array with the decorations - */ - getLineDecorations(lineNumber: number, ownerId?: number, filterOutValidation?: boolean): IModelDecoration[]; - /** - * Gets all the decorations for the lines between `startLineNumber` and `endLineNumber` as an array. - * @param startLineNumber The start line number - * @param endLineNumber The end line number - * @param ownerId If set, it will ignore decorations belonging to other owners. - * @param filterOutValidation If set, it will ignore decorations specific to validation (i.e. warnings, errors). - * @return An array with the decorations - */ - getLinesDecorations(startLineNumber: number, endLineNumber: number, ownerId?: number, filterOutValidation?: boolean): IModelDecoration[]; - /** - * Gets all the decorations in a range as an array. Only `startLineNumber` and `endLineNumber` from `range` are used for filtering. - * So for now it returns all the decorations on the same line as `range`. - * @param range The range to search in - * @param ownerId If set, it will ignore decorations belonging to other owners. - * @param filterOutValidation If set, it will ignore decorations specific to validation (i.e. warnings, errors). - * @param onlyMinimapDecorations If set, it will return only decorations that render in the minimap. - * @param onlyMarginDecorations If set, it will return only decorations that render in the glyph margin. - * @return An array with the decorations - */ - getDecorationsInRange(range: IRange, ownerId?: number, filterOutValidation?: boolean, onlyMinimapDecorations?: boolean, onlyMarginDecorations?: boolean): IModelDecoration[]; - /** - * Gets all the decorations as an array. - * @param ownerId If set, it will ignore decorations belonging to other owners. - * @param filterOutValidation If set, it will ignore decorations specific to validation (i.e. warnings, errors). - */ - getAllDecorations(ownerId?: number, filterOutValidation?: boolean): IModelDecoration[]; - /** - * Gets all decorations that render in the glyph margin as an array. - * @param ownerId If set, it will ignore decorations belonging to other owners. - */ - getAllMarginDecorations(ownerId?: number): IModelDecoration[]; - /** - * Gets all the decorations that should be rendered in the overview ruler as an array. - * @param ownerId If set, it will ignore decorations belonging to other owners. - * @param filterOutValidation If set, it will ignore decorations specific to validation (i.e. warnings, errors). - */ - getOverviewRulerDecorations(ownerId?: number, filterOutValidation?: boolean): IModelDecoration[]; - /** - * Gets all the decorations that contain injected text. - * @param ownerId If set, it will ignore decorations belonging to other owners. - */ - getInjectedTextDecorations(ownerId?: number): IModelDecoration[]; - /** - * Normalize a string containing whitespace according to indentation rules (converts to spaces or to tabs). - */ - normalizeIndentation(str: string): string; - /** - * Change the options of this model. - */ - updateOptions(newOpts: ITextModelUpdateOptions): void; - /** - * Detect the indentation options for this model from its content. - */ - detectIndentation(defaultInsertSpaces: boolean, defaultTabSize: number): void; - /** - * Close the current undo-redo element. - * This offers a way to create an undo/redo stop point. - */ - pushStackElement(): void; - /** - * Open the current undo-redo element. - * This offers a way to remove the current undo/redo stop point. - */ - popStackElement(): void; - /** - * Push edit operations, basically editing the model. This is the preferred way - * of editing the model. The edit operations will land on the undo stack. - * @param beforeCursorState The cursor state before the edit operations. This cursor state will be returned when `undo` or `redo` are invoked. - * @param editOperations The edit operations. - * @param cursorStateComputer A callback that can compute the resulting cursors state after the edit operations have been executed. - * @return The cursor state returned by the `cursorStateComputer`. - */ - pushEditOperations(beforeCursorState: Selection[] | null, editOperations: IIdentifiedSingleEditOperation[], cursorStateComputer: ICursorStateComputer): Selection[] | null; - /** - * Change the end of line sequence. This is the preferred way of - * changing the eol sequence. This will land on the undo stack. - */ - pushEOL(eol: EndOfLineSequence): void; - /** - * Edit the model without adding the edits to the undo stack. - * This can have dire consequences on the undo stack! See @pushEditOperations for the preferred way. - * @param operations The edit operations. - * @return If desired, the inverse edit operations, that, when applied, will bring the model back to the previous state. - */ - applyEdits(operations: IIdentifiedSingleEditOperation[]): void; - applyEdits(operations: IIdentifiedSingleEditOperation[], computeUndoEdits: false): void; - applyEdits(operations: IIdentifiedSingleEditOperation[], computeUndoEdits: true): IValidEditOperation[]; - /** - * Change the end of line sequence without recording in the undo stack. - * This can have dire consequences on the undo stack! See @pushEOL for the preferred way. - */ - setEOL(eol: EndOfLineSequence): void; - /** - * An event emitted when the contents of the model have changed. - * @event - */ - onDidChangeContent(listener: (e: IModelContentChangedEvent) => void): IDisposable; - /** - * An event emitted when decorations of the model have changed. - * @event - */ - readonly onDidChangeDecorations: IEvent; - /** - * An event emitted when the model options have changed. - * @event - */ - readonly onDidChangeOptions: IEvent; - /** - * An event emitted when the language associated with the model has changed. - * @event - */ - readonly onDidChangeLanguage: IEvent; - /** - * An event emitted when the language configuration associated with the model has changed. - * @event - */ - readonly onDidChangeLanguageConfiguration: IEvent; - /** - * An event emitted when the model has been attached to the first editor or detached from the last editor. - * @event - */ - readonly onDidChangeAttached: IEvent; - /** - * An event emitted right before disposing the model. - * @event - */ - readonly onWillDispose: IEvent; - /** - * Destroy this model. - */ - dispose(): void; - /** - * Returns if this model is attached to an editor or not. - */ - isAttachedToEditor(): boolean; - } - - export enum PositionAffinity { - /** - * Prefers the left most position. - */ - Left = 0, - /** - * Prefers the right most position. - */ - Right = 1, - /** - * No preference. - */ - None = 2, - /** - * If the given position is on injected text, prefers the position left of it. - */ - LeftOfInjectedText = 3, - /** - * If the given position is on injected text, prefers the position right of it. - */ - RightOfInjectedText = 4 - } - - /** - * A change - */ - export interface IChange { - readonly originalStartLineNumber: number; - readonly originalEndLineNumber: number; - readonly modifiedStartLineNumber: number; - readonly modifiedEndLineNumber: number; - } - - /** - * A character level change. - */ - export interface ICharChange extends IChange { - readonly originalStartColumn: number; - readonly originalEndColumn: number; - readonly modifiedStartColumn: number; - readonly modifiedEndColumn: number; - } - - /** - * A line change - */ - export interface ILineChange extends IChange { - readonly charChanges: ICharChange[] | undefined; - } - export interface IDimension { - width: number; - height: number; - } - - /** - * A builder and helper for edit operations for a command. - */ - export interface IEditOperationBuilder { - /** - * Add a new edit operation (a replace operation). - * @param range The range to replace (delete). May be empty to represent a simple insert. - * @param text The text to replace with. May be null to represent a simple delete. - */ - addEditOperation(range: IRange, text: string | null, forceMoveMarkers?: boolean): void; - /** - * Add a new edit operation (a replace operation). - * The inverse edits will be accessible in `ICursorStateComputerData.getInverseEditOperations()` - * @param range The range to replace (delete). May be empty to represent a simple insert. - * @param text The text to replace with. May be null to represent a simple delete. - */ - addTrackedEditOperation(range: IRange, text: string | null, forceMoveMarkers?: boolean): void; - /** - * Track `selection` when applying edit operations. - * A best effort will be made to not grow/expand the selection. - * An empty selection will clamp to a nearby character. - * @param selection The selection to track. - * @param trackPreviousOnEmpty If set, and the selection is empty, indicates whether the selection - * should clamp to the previous or the next character. - * @return A unique identifier. - */ - trackSelection(selection: Selection, trackPreviousOnEmpty?: boolean): string; - } - - /** - * A helper for computing cursor state after a command. - */ - export interface ICursorStateComputerData { - /** - * Get the inverse edit operations of the added edit operations. - */ - getInverseEditOperations(): IValidEditOperation[]; - /** - * Get a previously tracked selection. - * @param id The unique identifier returned by `trackSelection`. - * @return The selection. - */ - getTrackedSelection(id: string): Selection; - } - - /** - * A command that modifies text / cursor state on a model. - */ - export interface ICommand { - /** - * Get the edit operations needed to execute this command. - * @param model The model the command will execute on. - * @param builder A helper to collect the needed edit operations and to track selections. - */ - getEditOperations(model: ITextModel, builder: IEditOperationBuilder): void; - /** - * Compute the cursor state after the edit operations were applied. - * @param model The model the command has executed on. - * @param helper A helper to get inverse edit operations and to get previously tracked selections. - * @return The cursor state after the command executed. - */ - computeCursorState(model: ITextModel, helper: ICursorStateComputerData): Selection; - } - - /** - * A model for the diff editor. - */ - export interface IDiffEditorModel { - /** - * Original model. - */ - original: ITextModel; - /** - * Modified model. - */ - modified: ITextModel; - } - - export interface IDiffEditorViewModel extends IDisposable { - readonly model: IDiffEditorModel; - waitForDiff(): Promise; - } - - /** - * An event describing that an editor has had its model reset (i.e. `editor.setModel()`). - */ - export interface IModelChangedEvent { - /** - * The `uri` of the previous model or null. - */ - readonly oldModelUrl: Uri | null; - /** - * The `uri` of the new model or null. - */ - readonly newModelUrl: Uri | null; - } - - export interface IContentSizeChangedEvent { - readonly contentWidth: number; - readonly contentHeight: number; - readonly contentWidthChanged: boolean; - readonly contentHeightChanged: boolean; - } - - export interface INewScrollPosition { - scrollLeft?: number; - scrollTop?: number; - } - - export interface IEditorAction { - readonly id: string; - readonly label: string; - readonly alias: string; - readonly metadata: ICommandMetadata | undefined; - isSupported(): boolean; - run(args?: unknown): Promise; - } - - export type IEditorModel = ITextModel | IDiffEditorModel | IDiffEditorViewModel; - - /** - * A (serializable) state of the cursors. - */ - export interface ICursorState { - inSelectionMode: boolean; - selectionStart: IPosition; - position: IPosition; - } - - /** - * A (serializable) state of the view. - */ - export interface IViewState { - /** written by previous versions */ - scrollTop?: number; - /** written by previous versions */ - scrollTopWithoutViewZones?: number; - scrollLeft: number; - firstPosition: IPosition; - firstPositionDeltaTop: number; - } - - /** - * A (serializable) state of the code editor. - */ - export interface ICodeEditorViewState { - cursorState: ICursorState[]; - viewState: IViewState; - contributionsState: { - [id: string]: any; - }; - } - - /** - * (Serializable) View state for the diff editor. - */ - export interface IDiffEditorViewState { - original: ICodeEditorViewState | null; - modified: ICodeEditorViewState | null; - modelState?: unknown; - } - - /** - * An editor view state. - */ - export type IEditorViewState = ICodeEditorViewState | IDiffEditorViewState; - - export enum ScrollType { - Smooth = 0, - Immediate = 1 - } - - /** - * An editor. - */ - export interface IEditor { - /** - * An event emitted when the editor has been disposed. - * @event - */ - onDidDispose(listener: () => void): IDisposable; - /** - * Dispose the editor. - */ - dispose(): void; - /** - * Get a unique id for this editor instance. - */ - getId(): string; - /** - * Get the editor type. Please see `EditorType`. - * This is to avoid an instanceof check - */ - getEditorType(): string; - /** - * Update the editor's options after the editor has been created. - */ - updateOptions(newOptions: IEditorOptions): void; - /** - * Instructs the editor to remeasure its container. This method should - * be called when the container of the editor gets resized. - * - * If a dimension is passed in, the passed in value will be used. - * - * By default, this will also render the editor immediately. - * If you prefer to delay rendering to the next animation frame, use postponeRendering == true. - */ - layout(dimension?: IDimension, postponeRendering?: boolean): void; - /** - * Brings browser focus to the editor text - */ - focus(): void; - /** - * Returns true if the text inside this editor is focused (i.e. cursor is blinking). - */ - hasTextFocus(): boolean; - /** - * Returns all actions associated with this editor. - */ - getSupportedActions(): IEditorAction[]; - /** - * Saves current view state of the editor in a serializable object. - */ - saveViewState(): IEditorViewState | null; - /** - * Restores the view state of the editor from a serializable object generated by `saveViewState`. - */ - restoreViewState(state: IEditorViewState | null): void; - /** - * Given a position, returns a column number that takes tab-widths into account. - */ - getVisibleColumnFromPosition(position: IPosition): number; - /** - * Returns the primary position of the cursor. - */ - getPosition(): Position | null; - /** - * Set the primary position of the cursor. This will remove any secondary cursors. - * @param position New primary cursor's position - * @param source Source of the call that caused the position - */ - setPosition(position: IPosition, source?: string): void; - /** - * Scroll vertically as necessary and reveal a line. - */ - revealLine(lineNumber: number, scrollType?: ScrollType): void; - /** - * Scroll vertically as necessary and reveal a line centered vertically. - */ - revealLineInCenter(lineNumber: number, scrollType?: ScrollType): void; - /** - * Scroll vertically as necessary and reveal a line centered vertically only if it lies outside the viewport. - */ - revealLineInCenterIfOutsideViewport(lineNumber: number, scrollType?: ScrollType): void; - /** - * Scroll vertically as necessary and reveal a line close to the top of the viewport, - * optimized for viewing a code definition. - */ - revealLineNearTop(lineNumber: number, scrollType?: ScrollType): void; - /** - * Scroll vertically or horizontally as necessary and reveal a position. - */ - revealPosition(position: IPosition, scrollType?: ScrollType): void; - /** - * Scroll vertically or horizontally as necessary and reveal a position centered vertically. - */ - revealPositionInCenter(position: IPosition, scrollType?: ScrollType): void; - /** - * Scroll vertically or horizontally as necessary and reveal a position centered vertically only if it lies outside the viewport. - */ - revealPositionInCenterIfOutsideViewport(position: IPosition, scrollType?: ScrollType): void; - /** - * Scroll vertically or horizontally as necessary and reveal a position close to the top of the viewport, - * optimized for viewing a code definition. - */ - revealPositionNearTop(position: IPosition, scrollType?: ScrollType): void; - /** - * Returns the primary selection of the editor. - */ - getSelection(): Selection | null; - /** - * Returns all the selections of the editor. - */ - getSelections(): Selection[] | null; - /** - * Set the primary selection of the editor. This will remove any secondary cursors. - * @param selection The new selection - * @param source Source of the call that caused the selection - */ - setSelection(selection: IRange, source?: string): void; - /** - * Set the primary selection of the editor. This will remove any secondary cursors. - * @param selection The new selection - * @param source Source of the call that caused the selection - */ - setSelection(selection: Range, source?: string): void; - /** - * Set the primary selection of the editor. This will remove any secondary cursors. - * @param selection The new selection - * @param source Source of the call that caused the selection - */ - setSelection(selection: ISelection, source?: string): void; - /** - * Set the primary selection of the editor. This will remove any secondary cursors. - * @param selection The new selection - * @param source Source of the call that caused the selection - */ - setSelection(selection: Selection, source?: string): void; - /** - * Set the selections for all the cursors of the editor. - * Cursors will be removed or added, as necessary. - * @param selections The new selection - * @param source Source of the call that caused the selection - */ - setSelections(selections: readonly ISelection[], source?: string): void; - /** - * Scroll vertically as necessary and reveal lines. - */ - revealLines(startLineNumber: number, endLineNumber: number, scrollType?: ScrollType): void; - /** - * Scroll vertically as necessary and reveal lines centered vertically. - */ - revealLinesInCenter(lineNumber: number, endLineNumber: number, scrollType?: ScrollType): void; - /** - * Scroll vertically as necessary and reveal lines centered vertically only if it lies outside the viewport. - */ - revealLinesInCenterIfOutsideViewport(lineNumber: number, endLineNumber: number, scrollType?: ScrollType): void; - /** - * Scroll vertically as necessary and reveal lines close to the top of the viewport, - * optimized for viewing a code definition. - */ - revealLinesNearTop(lineNumber: number, endLineNumber: number, scrollType?: ScrollType): void; - /** - * Scroll vertically or horizontally as necessary and reveal a range. - */ - revealRange(range: IRange, scrollType?: ScrollType): void; - /** - * Scroll vertically or horizontally as necessary and reveal a range centered vertically. - */ - revealRangeInCenter(range: IRange, scrollType?: ScrollType): void; - /** - * Scroll vertically or horizontally as necessary and reveal a range at the top of the viewport. - */ - revealRangeAtTop(range: IRange, scrollType?: ScrollType): void; - /** - * Scroll vertically or horizontally as necessary and reveal a range centered vertically only if it lies outside the viewport. - */ - revealRangeInCenterIfOutsideViewport(range: IRange, scrollType?: ScrollType): void; - /** - * Scroll vertically or horizontally as necessary and reveal a range close to the top of the viewport, - * optimized for viewing a code definition. - */ - revealRangeNearTop(range: IRange, scrollType?: ScrollType): void; - /** - * Scroll vertically or horizontally as necessary and reveal a range close to the top of the viewport, - * optimized for viewing a code definition. Only if it lies outside the viewport. - */ - revealRangeNearTopIfOutsideViewport(range: IRange, scrollType?: ScrollType): void; - /** - * Directly trigger a handler or an editor action. - * @param source The source of the call. - * @param handlerId The id of the handler or the id of a contribution. - * @param payload Extra data to be sent to the handler. - */ - trigger(source: string | null | undefined, handlerId: string, payload: any): void; - /** - * Gets the current model attached to this editor. - */ - getModel(): IEditorModel | null; - /** - * Sets the current model attached to this editor. - * If the previous model was created by the editor via the value key in the options - * literal object, it will be destroyed. Otherwise, if the previous model was set - * via setModel, or the model key in the options literal object, the previous model - * will not be destroyed. - * It is safe to call setModel(null) to simply detach the current model from the editor. - */ - setModel(model: IEditorModel | null): void; - /** - * Create a collection of decorations. All decorations added through this collection - * will get the ownerId of the editor (meaning they will not show up in other editors). - * These decorations will be automatically cleared when the editor's model changes. - */ - createDecorationsCollection(decorations?: IModelDeltaDecoration[]): IEditorDecorationsCollection; - } - - /** - * A collection of decorations - */ - export interface IEditorDecorationsCollection { - /** - * An event emitted when decorations change in the editor, - * but the change is not caused by us setting or clearing the collection. - */ - onDidChange: IEvent; - /** - * Get the decorations count. - */ - length: number; - /** - * Get the range for a decoration. - */ - getRange(index: number): Range | null; - /** - * Get all ranges for decorations. - */ - getRanges(): Range[]; - /** - * Determine if a decoration is in this collection. - */ - has(decoration: IModelDecoration): boolean; - /** - * Replace all previous decorations with `newDecorations`. - */ - set(newDecorations: readonly IModelDeltaDecoration[]): string[]; - /** - * Append `newDecorations` to this collection. - */ - append(newDecorations: readonly IModelDeltaDecoration[]): string[]; - /** - * Remove all previous decorations. - */ - clear(): void; - } - - /** - * An editor contribution that gets created every time a new editor gets created and gets disposed when the editor gets disposed. - */ - export interface IEditorContribution { - /** - * Dispose this contribution. - */ - dispose(): void; - /** - * Store view state. - */ - saveViewState?(): any; - /** - * Restore view state. - */ - restoreViewState?(state: any): void; - } - - /** - * The type of the `IEditor`. - */ - export const EditorType: { - ICodeEditor: string; - IDiffEditor: string; - }; - - /** - * An event describing that the current language associated with a model has changed. - */ - export interface IModelLanguageChangedEvent { - /** - * Previous language - */ - readonly oldLanguage: string; - /** - * New language - */ - readonly newLanguage: string; - /** - * Source of the call that caused the event. - */ - readonly source: string; - } - - /** - * An event describing that the language configuration associated with a model has changed. - */ - export interface IModelLanguageConfigurationChangedEvent { - } - - export interface IModelContentChange { - /** - * The range that got replaced. - */ - readonly range: IRange; - /** - * The offset of the range that got replaced. - */ - readonly rangeOffset: number; - /** - * The length of the range that got replaced. - */ - readonly rangeLength: number; - /** - * The new text for the range. - */ - readonly text: string; - } - - /** - * An event describing a change in the text of a model. - */ - export interface IModelContentChangedEvent { - /** - * The changes are ordered from the end of the document to the beginning, so they should be safe to apply in sequence. - */ - readonly changes: IModelContentChange[]; - /** - * The (new) end-of-line character. - */ - readonly eol: string; - /** - * The new version id the model has transitioned to. - */ - readonly versionId: number; - /** - * Flag that indicates that this event was generated while undoing. - */ - readonly isUndoing: boolean; - /** - * Flag that indicates that this event was generated while redoing. - */ - readonly isRedoing: boolean; - /** - * Flag that indicates that all decorations were lost with this edit. - * The model has been reset to a new value. - */ - readonly isFlush: boolean; - /** - * Flag that indicates that this event describes an eol change. - */ - readonly isEolChange: boolean; - } - - /** - * An event describing that model decorations have changed. - */ - export interface IModelDecorationsChangedEvent { - readonly affectsMinimap: boolean; - readonly affectsOverviewRuler: boolean; - readonly affectsGlyphMargin: boolean; - readonly affectsLineNumber: boolean; - } - - export interface IModelOptionsChangedEvent { - readonly tabSize: boolean; - readonly indentSize: boolean; - readonly insertSpaces: boolean; - readonly trimAutoWhitespace: boolean; - } - - /** - * Describes the reason the cursor has changed its position. - */ - export enum CursorChangeReason { - /** - * Unknown or not set. - */ - NotSet = 0, - /** - * A `model.setValue()` was called. - */ - ContentFlush = 1, - /** - * The `model` has been changed outside of this cursor and the cursor recovers its position from associated markers. - */ - RecoverFromMarkers = 2, - /** - * There was an explicit user gesture. - */ - Explicit = 3, - /** - * There was a Paste. - */ - Paste = 4, - /** - * There was an Undo. - */ - Undo = 5, - /** - * There was a Redo. - */ - Redo = 6 - } - - /** - * An event describing that the cursor position has changed. - */ - export interface ICursorPositionChangedEvent { - /** - * Primary cursor's position. - */ - readonly position: Position; - /** - * Secondary cursors' position. - */ - readonly secondaryPositions: Position[]; - /** - * Reason. - */ - readonly reason: CursorChangeReason; - /** - * Source of the call that caused the event. - */ - readonly source: string; - } - - /** - * An event describing that the cursor selection has changed. - */ - export interface ICursorSelectionChangedEvent { - /** - * The primary selection. - */ - readonly selection: Selection; - /** - * The secondary selections. - */ - readonly secondarySelections: Selection[]; - /** - * The model version id. - */ - readonly modelVersionId: number; - /** - * The old selections. - */ - readonly oldSelections: Selection[] | null; - /** - * The model version id the that `oldSelections` refer to. - */ - readonly oldModelVersionId: number; - /** - * Source of the call that caused the event. - */ - readonly source: string; - /** - * Reason. - */ - readonly reason: CursorChangeReason; - } - - export enum AccessibilitySupport { - /** - * This should be the browser case where it is not known if a screen reader is attached or no. - */ - Unknown = 0, - Disabled = 1, - Enabled = 2 - } - - /** - * Configuration options for auto closing quotes and brackets - */ - export type EditorAutoClosingStrategy = 'always' | 'languageDefined' | 'beforeWhitespace' | 'never'; - - /** - * Configuration options for auto wrapping quotes and brackets - */ - export type EditorAutoSurroundStrategy = 'languageDefined' | 'quotes' | 'brackets' | 'never'; - - /** - * Configuration options for typing over closing quotes or brackets - */ - export type EditorAutoClosingEditStrategy = 'always' | 'auto' | 'never'; - - /** - * Configuration options for auto indentation in the editor - */ - export enum EditorAutoIndentStrategy { - None = 0, - Keep = 1, - Brackets = 2, - Advanced = 3, - Full = 4 - } - - /** - * Configuration options for the editor. - */ - export interface IEditorOptions { - /** - * This editor is used inside a diff editor. - */ - inDiffEditor?: boolean; - /** - * The aria label for the editor's textarea (when it is focused). - */ - ariaLabel?: string; - /** - * Whether the aria-required attribute should be set on the editors textarea. - */ - ariaRequired?: boolean; - /** - * Control whether a screen reader announces inline suggestion content immediately. - */ - screenReaderAnnounceInlineSuggestion?: boolean; - /** - * The `tabindex` property of the editor's textarea - */ - tabIndex?: number; - /** - * Render vertical lines at the specified columns. - * Defaults to empty array. - */ - rulers?: (number | IRulerOption)[]; - /** - * Locales used for segmenting lines into words when doing word related navigations or operations. - * - * Specify the BCP 47 language tag of the word you wish to recognize (e.g., ja, zh-CN, zh-Hant-TW, etc.). - * Defaults to empty array - */ - wordSegmenterLocales?: string | string[]; - /** - * A string containing the word separators used when doing word navigation. - * Defaults to `~!@#$%^&*()-=+[{]}\\|;:\'",.<>/? - */ - wordSeparators?: string; - /** - * Enable Linux primary clipboard. - * Defaults to true. - */ - selectionClipboard?: boolean; - /** - * Control the rendering of line numbers. - * If it is a function, it will be invoked when rendering a line number and the return value will be rendered. - * Otherwise, if it is a truthy, line numbers will be rendered normally (equivalent of using an identity function). - * Otherwise, line numbers will not be rendered. - * Defaults to `on`. - */ - lineNumbers?: LineNumbersType; - /** - * Controls the minimal number of visible leading and trailing lines surrounding the cursor. - * Defaults to 0. - */ - cursorSurroundingLines?: number; - /** - * Controls when `cursorSurroundingLines` should be enforced - * Defaults to `default`, `cursorSurroundingLines` is not enforced when cursor position is changed - * by mouse. - */ - cursorSurroundingLinesStyle?: 'default' | 'all'; - /** - * Render last line number when the file ends with a newline. - * Defaults to 'on' for Windows and macOS and 'dimmed' for Linux. - */ - renderFinalNewline?: 'on' | 'off' | 'dimmed'; - /** - * Remove unusual line terminators like LINE SEPARATOR (LS), PARAGRAPH SEPARATOR (PS). - * Defaults to 'prompt'. - */ - unusualLineTerminators?: 'auto' | 'off' | 'prompt'; - /** - * Should the corresponding line be selected when clicking on the line number? - * Defaults to true. - */ - selectOnLineNumbers?: boolean; - /** - * Control the width of line numbers, by reserving horizontal space for rendering at least an amount of digits. - * Defaults to 5. - */ - lineNumbersMinChars?: number; - /** - * Enable the rendering of the glyph margin. - * Defaults to true in vscode and to false in monaco-editor. - */ - glyphMargin?: boolean; - /** - * The width reserved for line decorations (in px). - * Line decorations are placed between line numbers and the editor content. - * You can pass in a string in the format floating point followed by "ch". e.g. 1.3ch. - * Defaults to 10. - */ - lineDecorationsWidth?: number | string; - /** - * When revealing the cursor, a virtual padding (px) is added to the cursor, turning it into a rectangle. - * This virtual padding ensures that the cursor gets revealed before hitting the edge of the viewport. - * Defaults to 30 (px). - */ - revealHorizontalRightPadding?: number; - /** - * Render the editor selection with rounded borders. - * Defaults to true. - */ - roundedSelection?: boolean; - /** - * Class name to be added to the editor. - */ - extraEditorClassName?: string; - /** - * Should the editor be read only. See also `domReadOnly`. - * Defaults to false. - */ - readOnly?: boolean; - /** - * The message to display when the editor is readonly. - */ - readOnlyMessage?: IMarkdownString; - /** - * Should the textarea used for input use the DOM `readonly` attribute. - * Defaults to false. - */ - domReadOnly?: boolean; - /** - * Enable linked editing. - * Defaults to false. - */ - linkedEditing?: boolean; - /** - * deprecated, use linkedEditing instead - */ - renameOnType?: boolean; - /** - * Should the editor render validation decorations. - * Defaults to editable. - */ - renderValidationDecorations?: 'editable' | 'on' | 'off'; - /** - * Control the behavior and rendering of the scrollbars. - */ - scrollbar?: IEditorScrollbarOptions; - /** - * Control the behavior of sticky scroll options - */ - stickyScroll?: IEditorStickyScrollOptions; - /** - * Control the behavior and rendering of the minimap. - */ - minimap?: IEditorMinimapOptions; - /** - * Control the behavior of the find widget. - */ - find?: IEditorFindOptions; - /** - * Display overflow widgets as `fixed`. - * Defaults to `false`. - */ - fixedOverflowWidgets?: boolean; - /** - * The number of vertical lanes the overview ruler should render. - * Defaults to 3. - */ - overviewRulerLanes?: number; - /** - * Controls if a border should be drawn around the overview ruler. - * Defaults to `true`. - */ - overviewRulerBorder?: boolean; - /** - * Control the cursor animation style, possible values are 'blink', 'smooth', 'phase', 'expand' and 'solid'. - * Defaults to 'blink'. - */ - cursorBlinking?: 'blink' | 'smooth' | 'phase' | 'expand' | 'solid'; - /** - * Zoom the font in the editor when using the mouse wheel in combination with holding Ctrl. - * Defaults to false. - */ - mouseWheelZoom?: boolean; - /** - * Control the mouse pointer style, either 'text' or 'default' or 'copy' - * Defaults to 'text' - */ - mouseStyle?: 'text' | 'default' | 'copy'; - /** - * Enable smooth caret animation. - * Defaults to 'off'. - */ - cursorSmoothCaretAnimation?: 'off' | 'explicit' | 'on'; - /** - * Control the cursor style, either 'block' or 'line'. - * Defaults to 'line'. - */ - cursorStyle?: 'line' | 'block' | 'underline' | 'line-thin' | 'block-outline' | 'underline-thin'; - /** - * Control the width of the cursor when cursorStyle is set to 'line' - */ - cursorWidth?: number; - /** - * Enable font ligatures. - * Defaults to false. - */ - fontLigatures?: boolean | string; - /** - * Enable font variations. - * Defaults to false. - */ - fontVariations?: boolean | string; - /** - * Controls whether to use default color decorations or not using the default document color provider - */ - defaultColorDecorators?: boolean; - /** - * Disable the use of `transform: translate3d(0px, 0px, 0px)` for the editor margin and lines layers. - * The usage of `transform: translate3d(0px, 0px, 0px)` acts as a hint for browsers to create an extra layer. - * Defaults to false. - */ - disableLayerHinting?: boolean; - /** - * Disable the optimizations for monospace fonts. - * Defaults to false. - */ - disableMonospaceOptimizations?: boolean; - /** - * Should the cursor be hidden in the overview ruler. - * Defaults to false. - */ - hideCursorInOverviewRuler?: boolean; - /** - * Enable that scrolling can go one screen size after the last line. - * Defaults to true. - */ - scrollBeyondLastLine?: boolean; - /** - * Enable that scrolling can go beyond the last column by a number of columns. - * Defaults to 5. - */ - scrollBeyondLastColumn?: number; - /** - * Enable that the editor animates scrolling to a position. - * Defaults to false. - */ - smoothScrolling?: boolean; - /** - * Enable that the editor will install a ResizeObserver to check if its container dom node size has changed. - * Defaults to false. - */ - automaticLayout?: boolean; - /** - * Control the wrapping of the editor. - * When `wordWrap` = "off", the lines will never wrap. - * When `wordWrap` = "on", the lines will wrap at the viewport width. - * When `wordWrap` = "wordWrapColumn", the lines will wrap at `wordWrapColumn`. - * When `wordWrap` = "bounded", the lines will wrap at min(viewport width, wordWrapColumn). - * Defaults to "off". - */ - wordWrap?: 'off' | 'on' | 'wordWrapColumn' | 'bounded'; - /** - * Override the `wordWrap` setting. - */ - wordWrapOverride1?: 'off' | 'on' | 'inherit'; - /** - * Override the `wordWrapOverride1` setting. - */ - wordWrapOverride2?: 'off' | 'on' | 'inherit'; - /** - * Control the wrapping of the editor. - * When `wordWrap` = "off", the lines will never wrap. - * When `wordWrap` = "on", the lines will wrap at the viewport width. - * When `wordWrap` = "wordWrapColumn", the lines will wrap at `wordWrapColumn`. - * When `wordWrap` = "bounded", the lines will wrap at min(viewport width, wordWrapColumn). - * Defaults to 80. - */ - wordWrapColumn?: number; - /** - * Control indentation of wrapped lines. Can be: 'none', 'same', 'indent' or 'deepIndent'. - * Defaults to 'same' in vscode and to 'none' in monaco-editor. - */ - wrappingIndent?: 'none' | 'same' | 'indent' | 'deepIndent'; - /** - * Controls the wrapping strategy to use. - * Defaults to 'simple'. - */ - wrappingStrategy?: 'simple' | 'advanced'; - /** - * Configure word wrapping characters. A break will be introduced before these characters. - */ - wordWrapBreakBeforeCharacters?: string; - /** - * Configure word wrapping characters. A break will be introduced after these characters. - */ - wordWrapBreakAfterCharacters?: string; - /** - * Sets whether line breaks appear wherever the text would otherwise overflow its content box. - * When wordBreak = 'normal', Use the default line break rule. - * When wordBreak = 'keepAll', Word breaks should not be used for Chinese/Japanese/Korean (CJK) text. Non-CJK text behavior is the same as for normal. - */ - wordBreak?: 'normal' | 'keepAll'; - /** - * Performance guard: Stop rendering a line after x characters. - * Defaults to 10000. - * Use -1 to never stop rendering - */ - stopRenderingLineAfter?: number; - /** - * Configure the editor's hover. - */ - hover?: IEditorHoverOptions; - /** - * Enable detecting links and making them clickable. - * Defaults to true. - */ - links?: boolean; - /** - * Enable inline color decorators and color picker rendering. - */ - colorDecorators?: boolean; - /** - * Controls what is the condition to spawn a color picker from a color dectorator - */ - colorDecoratorsActivatedOn?: 'clickAndHover' | 'click' | 'hover'; - /** - * Controls the max number of color decorators that can be rendered in an editor at once. - */ - colorDecoratorsLimit?: number; - /** - * Control the behaviour of comments in the editor. - */ - comments?: IEditorCommentsOptions; - /** - * Enable custom contextmenu. - * Defaults to true. - */ - contextmenu?: boolean; - /** - * A multiplier to be used on the `deltaX` and `deltaY` of mouse wheel scroll events. - * Defaults to 1. - */ - mouseWheelScrollSensitivity?: number; - /** - * FastScrolling mulitplier speed when pressing `Alt` - * Defaults to 5. - */ - fastScrollSensitivity?: number; - /** - * Enable that the editor scrolls only the predominant axis. Prevents horizontal drift when scrolling vertically on a trackpad. - * Defaults to true. - */ - scrollPredominantAxis?: boolean; - /** - * Enable that the selection with the mouse and keys is doing column selection. - * Defaults to false. - */ - columnSelection?: boolean; - /** - * The modifier to be used to add multiple cursors with the mouse. - * Defaults to 'alt' - */ - multiCursorModifier?: 'ctrlCmd' | 'alt'; - /** - * Merge overlapping selections. - * Defaults to true - */ - multiCursorMergeOverlapping?: boolean; - /** - * Configure the behaviour when pasting a text with the line count equal to the cursor count. - * Defaults to 'spread'. - */ - multiCursorPaste?: 'spread' | 'full'; - /** - * Controls the max number of text cursors that can be in an active editor at once. - */ - multiCursorLimit?: number; - /** - * Configure the editor's accessibility support. - * Defaults to 'auto'. It is best to leave this to 'auto'. - */ - accessibilitySupport?: 'auto' | 'off' | 'on'; - /** - * Controls the number of lines in the editor that can be read out by a screen reader - */ - accessibilityPageSize?: number; - /** - * Suggest options. - */ - suggest?: ISuggestOptions; - inlineSuggest?: IInlineSuggestOptions; - /** - * Smart select options. - */ - smartSelect?: ISmartSelectOptions; - /** - * - */ - gotoLocation?: IGotoLocationOptions; - /** - * Enable quick suggestions (shadow suggestions) - * Defaults to true. - */ - quickSuggestions?: boolean | IQuickSuggestionsOptions; - /** - * Quick suggestions show delay (in ms) - * Defaults to 10 (ms) - */ - quickSuggestionsDelay?: number; - /** - * Controls the spacing around the editor. - */ - padding?: IEditorPaddingOptions; - /** - * Parameter hint options. - */ - parameterHints?: IEditorParameterHintOptions; - /** - * Options for auto closing brackets. - * Defaults to language defined behavior. - */ - autoClosingBrackets?: EditorAutoClosingStrategy; - /** - * Options for auto closing comments. - * Defaults to language defined behavior. - */ - autoClosingComments?: EditorAutoClosingStrategy; - /** - * Options for auto closing quotes. - * Defaults to language defined behavior. - */ - autoClosingQuotes?: EditorAutoClosingStrategy; - /** - * Options for pressing backspace near quotes or bracket pairs. - */ - autoClosingDelete?: EditorAutoClosingEditStrategy; - /** - * Options for typing over closing quotes or brackets. - */ - autoClosingOvertype?: EditorAutoClosingEditStrategy; - /** - * Options for auto surrounding. - * Defaults to always allowing auto surrounding. - */ - autoSurround?: EditorAutoSurroundStrategy; - /** - * Controls whether the editor should automatically adjust the indentation when users type, paste, move or indent lines. - * Defaults to advanced. - */ - autoIndent?: 'none' | 'keep' | 'brackets' | 'advanced' | 'full'; - /** - * Emulate selection behaviour of tab characters when using spaces for indentation. - * This means selection will stick to tab stops. - */ - stickyTabStops?: boolean; - /** - * Enable format on type. - * Defaults to false. - */ - formatOnType?: boolean; - /** - * Enable format on paste. - * Defaults to false. - */ - formatOnPaste?: boolean; - /** - * Controls if the editor should allow to move selections via drag and drop. - * Defaults to false. - */ - dragAndDrop?: boolean; - /** - * Enable the suggestion box to pop-up on trigger characters. - * Defaults to true. - */ - suggestOnTriggerCharacters?: boolean; - /** - * Accept suggestions on ENTER. - * Defaults to 'on'. - */ - acceptSuggestionOnEnter?: 'on' | 'smart' | 'off'; - /** - * Accept suggestions on provider defined characters. - * Defaults to true. - */ - acceptSuggestionOnCommitCharacter?: boolean; - /** - * Enable snippet suggestions. Default to 'true'. - */ - snippetSuggestions?: 'top' | 'bottom' | 'inline' | 'none'; - /** - * Copying without a selection copies the current line. - */ - emptySelectionClipboard?: boolean; - /** - * Syntax highlighting is copied. - */ - copyWithSyntaxHighlighting?: boolean; - /** - * The history mode for suggestions. - */ - suggestSelection?: 'first' | 'recentlyUsed' | 'recentlyUsedByPrefix'; - /** - * The font size for the suggest widget. - * Defaults to the editor font size. - */ - suggestFontSize?: number; - /** - * The line height for the suggest widget. - * Defaults to the editor line height. - */ - suggestLineHeight?: number; - /** - * Enable tab completion. - */ - tabCompletion?: 'on' | 'off' | 'onlySnippets'; - /** - * Enable selection highlight. - * Defaults to true. - */ - selectionHighlight?: boolean; - /** - * Enable semantic occurrences highlight. - * Defaults to 'singleFile'. - * 'off' disables occurrence highlighting - * 'singleFile' triggers occurrence highlighting in the current document - * 'multiFile' triggers occurrence highlighting across valid open documents - */ - occurrencesHighlight?: 'off' | 'singleFile' | 'multiFile'; - /** - * Controls delay for occurrences highlighting - * Defaults to 250. - * Minimum value is 0 - * Maximum value is 2000 - */ - occurrencesHighlightDelay?: number; - /** - * Show code lens - * Defaults to true. - */ - codeLens?: boolean; - /** - * Code lens font family. Defaults to editor font family. - */ - codeLensFontFamily?: string; - /** - * Code lens font size. Default to 90% of the editor font size - */ - codeLensFontSize?: number; - /** - * Control the behavior and rendering of the code action lightbulb. - */ - lightbulb?: IEditorLightbulbOptions; - /** - * Timeout for running code actions on save. - */ - codeActionsOnSaveTimeout?: number; - /** - * Enable code folding. - * Defaults to true. - */ - folding?: boolean; - /** - * Selects the folding strategy. 'auto' uses the strategies contributed for the current document, 'indentation' uses the indentation based folding strategy. - * Defaults to 'auto'. - */ - foldingStrategy?: 'auto' | 'indentation'; - /** - * Enable highlight for folded regions. - * Defaults to true. - */ - foldingHighlight?: boolean; - /** - * Auto fold imports folding regions. - * Defaults to true. - */ - foldingImportsByDefault?: boolean; - /** - * Maximum number of foldable regions. - * Defaults to 5000. - */ - foldingMaximumRegions?: number; - /** - * Controls whether the fold actions in the gutter stay always visible or hide unless the mouse is over the gutter. - * Defaults to 'mouseover'. - */ - showFoldingControls?: 'always' | 'never' | 'mouseover'; - /** - * Controls whether clicking on the empty content after a folded line will unfold the line. - * Defaults to false. - */ - unfoldOnClickAfterEndOfLine?: boolean; - /** - * Enable highlighting of matching brackets. - * Defaults to 'always'. - */ - matchBrackets?: 'never' | 'near' | 'always'; - /** - * Enable experimental rendering using WebGPU. - * Defaults to 'off'. - */ - experimentalGpuAcceleration?: 'on' | 'off'; - /** - * Enable experimental whitespace rendering. - * Defaults to 'svg'. - */ - experimentalWhitespaceRendering?: 'svg' | 'font' | 'off'; - /** - * Enable rendering of whitespace. - * Defaults to 'selection'. - */ - renderWhitespace?: 'none' | 'boundary' | 'selection' | 'trailing' | 'all'; - /** - * Enable rendering of control characters. - * Defaults to true. - */ - renderControlCharacters?: boolean; - /** - * Enable rendering of current line highlight. - * Defaults to all. - */ - renderLineHighlight?: 'none' | 'gutter' | 'line' | 'all'; - /** - * Control if the current line highlight should be rendered only the editor is focused. - * Defaults to false. - */ - renderLineHighlightOnlyWhenFocus?: boolean; - /** - * Inserting and deleting whitespace follows tab stops. - */ - useTabStops?: boolean; - /** - * The font family - */ - fontFamily?: string; - /** - * The font weight - */ - fontWeight?: string; - /** - * The font size - */ - fontSize?: number; - /** - * The line height - */ - lineHeight?: number; - /** - * The letter spacing - */ - letterSpacing?: number; - /** - * Controls fading out of unused variables. - */ - showUnused?: boolean; - /** - * Controls whether to focus the inline editor in the peek widget by default. - * Defaults to false. - */ - peekWidgetDefaultFocus?: 'tree' | 'editor'; - /** - * Sets a placeholder for the editor. - * If set, the placeholder is shown if the editor is empty. - */ - placeholder?: string | undefined; - /** - * Controls whether the definition link opens element in the peek widget. - * Defaults to false. - */ - definitionLinkOpensInPeek?: boolean; - /** - * Controls strikethrough deprecated variables. - */ - showDeprecated?: boolean; - /** - * Controls whether suggestions allow matches in the middle of the word instead of only at the beginning - */ - matchOnWordStartOnly?: boolean; - /** - * Control the behavior and rendering of the inline hints. - */ - inlayHints?: IEditorInlayHintsOptions; - /** - * Control if the editor should use shadow DOM. - */ - useShadowDOM?: boolean; - /** - * Controls the behavior of editor guides. - */ - guides?: IGuidesOptions; - /** - * Controls the behavior of the unicode highlight feature - * (by default, ambiguous and invisible characters are highlighted). - */ - unicodeHighlight?: IUnicodeHighlightOptions; - /** - * Configures bracket pair colorization (disabled by default). - */ - bracketPairColorization?: IBracketPairColorizationOptions; - /** - * Controls dropping into the editor from an external source. - * - * When enabled, this shows a preview of the drop location and triggers an `onDropIntoEditor` event. - */ - dropIntoEditor?: IDropIntoEditorOptions; - /** - * Sets whether the new experimental edit context should be used instead of the text area. - */ - experimentalEditContextEnabled?: boolean; - /** - * Controls support for changing how content is pasted into the editor. - */ - pasteAs?: IPasteAsOptions; - /** - * Controls whether the editor / terminal receives tabs or defers them to the workbench for navigation. - */ - tabFocusMode?: boolean; - /** - * Controls whether the accessibility hint should be provided to screen reader users when an inline completion is shown. - */ - inlineCompletionsAccessibilityVerbose?: boolean; - } - - export interface IDiffEditorBaseOptions { - /** - * Allow the user to resize the diff editor split view. - * Defaults to true. - */ - enableSplitViewResizing?: boolean; - /** - * The default ratio when rendering side-by-side editors. - * Must be a number between 0 and 1, min sizes apply. - * Defaults to 0.5 - */ - splitViewDefaultRatio?: number; - /** - * Render the differences in two side-by-side editors. - * Defaults to true. - */ - renderSideBySide?: boolean; - /** - * When `renderSideBySide` is enabled, `useInlineViewWhenSpaceIsLimited` is set, - * and the diff editor has a width less than `renderSideBySideInlineBreakpoint`, the inline view is used. - */ - renderSideBySideInlineBreakpoint?: number | undefined; - /** - * When `renderSideBySide` is enabled, `useInlineViewWhenSpaceIsLimited` is set, - * and the diff editor has a width less than `renderSideBySideInlineBreakpoint`, the inline view is used. - */ - useInlineViewWhenSpaceIsLimited?: boolean; - /** - * If set, the diff editor is optimized for small views. - * Defaults to `false`. - */ - compactMode?: boolean; - /** - * Timeout in milliseconds after which diff computation is cancelled. - * Defaults to 5000. - */ - maxComputationTime?: number; - /** - * Maximum supported file size in MB. - * Defaults to 50. - */ - maxFileSize?: number; - /** - * Compute the diff by ignoring leading/trailing whitespace - * Defaults to true. - */ - ignoreTrimWhitespace?: boolean; - /** - * Render +/- indicators for added/deleted changes. - * Defaults to true. - */ - renderIndicators?: boolean; - /** - * Shows icons in the glyph margin to revert changes. - * Default to true. - */ - renderMarginRevertIcon?: boolean; - /** - * Indicates if the gutter menu should be rendered. - */ - renderGutterMenu?: boolean; - /** - * Original model should be editable? - * Defaults to false. - */ - originalEditable?: boolean; - /** - * Should the diff editor enable code lens? - * Defaults to false. - */ - diffCodeLens?: boolean; - /** - * Is the diff editor should render overview ruler - * Defaults to true - */ - renderOverviewRuler?: boolean; - /** - * Control the wrapping of the diff editor. - */ - diffWordWrap?: 'off' | 'on' | 'inherit'; - /** - * Diff Algorithm - */ - diffAlgorithm?: 'legacy' | 'advanced'; - /** - * Whether the diff editor aria label should be verbose. - */ - accessibilityVerbose?: boolean; - experimental?: { - /** - * Defaults to false. - */ - showMoves?: boolean; - showEmptyDecorations?: boolean; - /** - * Only applies when `renderSideBySide` is set to false. - */ - useTrueInlineView?: boolean; - }; - /** - * Is the diff editor inside another editor - * Defaults to false - */ - isInEmbeddedEditor?: boolean; - /** - * If the diff editor should only show the difference review mode. - */ - onlyShowAccessibleDiffViewer?: boolean; - hideUnchangedRegions?: { - enabled?: boolean; - revealLineCount?: number; - minimumLineCount?: number; - contextLineCount?: number; - }; - } - - /** - * Configuration options for the diff editor. - */ - export interface IDiffEditorOptions extends IEditorOptions, IDiffEditorBaseOptions { - } - - /** - * An event describing that the configuration of the editor has changed. - */ - export class ConfigurationChangedEvent { - hasChanged(id: EditorOption): boolean; - } - - /** - * All computed editor options. - */ - export interface IComputedEditorOptions { - get(id: T): FindComputedEditorOptionValueById; - } - - export interface IEditorOption { - readonly id: K; - readonly name: string; - defaultValue: V; - /** - * Might modify `value`. - */ - applyUpdate(value: V | undefined, update: V): ApplyUpdateResult; - } - - export class ApplyUpdateResult { - readonly newValue: T; - readonly didChange: boolean; - constructor(newValue: T, didChange: boolean); - } - - /** - * Configuration options for editor comments - */ - export interface IEditorCommentsOptions { - /** - * Insert a space after the line comment token and inside the block comments tokens. - * Defaults to true. - */ - insertSpace?: boolean; - /** - * Ignore empty lines when inserting line comments. - * Defaults to true. - */ - ignoreEmptyLines?: boolean; - } - - /** - * The kind of animation in which the editor's cursor should be rendered. - */ - export enum TextEditorCursorBlinkingStyle { - /** - * Hidden - */ - Hidden = 0, - /** - * Blinking - */ - Blink = 1, - /** - * Blinking with smooth fading - */ - Smooth = 2, - /** - * Blinking with prolonged filled state and smooth fading - */ - Phase = 3, - /** - * Expand collapse animation on the y axis - */ - Expand = 4, - /** - * No-Blinking - */ - Solid = 5 - } - - /** - * The style in which the editor's cursor should be rendered. - */ - export enum TextEditorCursorStyle { - /** - * As a vertical line (sitting between two characters). - */ - Line = 1, - /** - * As a block (sitting on top of a character). - */ - Block = 2, - /** - * As a horizontal line (sitting under a character). - */ - Underline = 3, - /** - * As a thin vertical line (sitting between two characters). - */ - LineThin = 4, - /** - * As an outlined block (sitting on top of a character). - */ - BlockOutline = 5, - /** - * As a thin horizontal line (sitting under a character). - */ - UnderlineThin = 6 - } - - /** - * Configuration options for editor find widget - */ - export interface IEditorFindOptions { - /** - * Controls whether the cursor should move to find matches while typing. - */ - cursorMoveOnType?: boolean; - /** - * Controls if we seed search string in the Find Widget with editor selection. - */ - seedSearchStringFromSelection?: 'never' | 'always' | 'selection'; - /** - * Controls if Find in Selection flag is turned on in the editor. - */ - autoFindInSelection?: 'never' | 'always' | 'multiline'; - addExtraSpaceOnTop?: boolean; - /** - * Controls whether the search result and diff result automatically restarts from the beginning (or the end) when no further matches can be found - */ - loop?: boolean; - } - - export type GoToLocationValues = 'peek' | 'gotoAndPeek' | 'goto'; - - /** - * Configuration options for go to location - */ - export interface IGotoLocationOptions { - multiple?: GoToLocationValues; - multipleDefinitions?: GoToLocationValues; - multipleTypeDefinitions?: GoToLocationValues; - multipleDeclarations?: GoToLocationValues; - multipleImplementations?: GoToLocationValues; - multipleReferences?: GoToLocationValues; - multipleTests?: GoToLocationValues; - alternativeDefinitionCommand?: string; - alternativeTypeDefinitionCommand?: string; - alternativeDeclarationCommand?: string; - alternativeImplementationCommand?: string; - alternativeReferenceCommand?: string; - alternativeTestsCommand?: string; - } - - /** - * Configuration options for editor hover - */ - export interface IEditorHoverOptions { - /** - * Enable the hover. - * Defaults to true. - */ - enabled?: boolean; - /** - * Delay for showing the hover. - * Defaults to 300. - */ - delay?: number; - /** - * Is the hover sticky such that it can be clicked and its contents selected? - * Defaults to true. - */ - sticky?: boolean; - /** - * Controls how long the hover is visible after you hovered out of it. - * Require sticky setting to be true. - */ - hidingDelay?: number; - /** - * Should the hover be shown above the line if possible? - * Defaults to false. - */ - above?: boolean; - } - - /** - * A description for the overview ruler position. - */ - export interface OverviewRulerPosition { - /** - * Width of the overview ruler - */ - readonly width: number; - /** - * Height of the overview ruler - */ - readonly height: number; - /** - * Top position for the overview ruler - */ - readonly top: number; - /** - * Right position for the overview ruler - */ - readonly right: number; - } - - export enum RenderMinimap { - None = 0, - Text = 1, - Blocks = 2 - } - - /** - * The internal layout details of the editor. - */ - export interface EditorLayoutInfo { - /** - * Full editor width. - */ - readonly width: number; - /** - * Full editor height. - */ - readonly height: number; - /** - * Left position for the glyph margin. - */ - readonly glyphMarginLeft: number; - /** - * The width of the glyph margin. - */ - readonly glyphMarginWidth: number; - /** - * The number of decoration lanes to render in the glyph margin. - */ - readonly glyphMarginDecorationLaneCount: number; - /** - * Left position for the line numbers. - */ - readonly lineNumbersLeft: number; - /** - * The width of the line numbers. - */ - readonly lineNumbersWidth: number; - /** - * Left position for the line decorations. - */ - readonly decorationsLeft: number; - /** - * The width of the line decorations. - */ - readonly decorationsWidth: number; - /** - * Left position for the content (actual text) - */ - readonly contentLeft: number; - /** - * The width of the content (actual text) - */ - readonly contentWidth: number; - /** - * Layout information for the minimap - */ - readonly minimap: EditorMinimapLayoutInfo; - /** - * The number of columns (of typical characters) fitting on a viewport line. - */ - readonly viewportColumn: number; - readonly isWordWrapMinified: boolean; - readonly isViewportWrapping: boolean; - readonly wrappingColumn: number; - /** - * The width of the vertical scrollbar. - */ - readonly verticalScrollbarWidth: number; - /** - * The height of the horizontal scrollbar. - */ - readonly horizontalScrollbarHeight: number; - /** - * The position of the overview ruler. - */ - readonly overviewRuler: OverviewRulerPosition; - } - - /** - * The internal layout details of the editor. - */ - export interface EditorMinimapLayoutInfo { - readonly renderMinimap: RenderMinimap; - readonly minimapLeft: number; - readonly minimapWidth: number; - readonly minimapHeightIsEditorHeight: boolean; - readonly minimapIsSampling: boolean; - readonly minimapScale: number; - readonly minimapLineHeight: number; - readonly minimapCanvasInnerWidth: number; - readonly minimapCanvasInnerHeight: number; - readonly minimapCanvasOuterWidth: number; - readonly minimapCanvasOuterHeight: number; - } - - export enum ShowLightbulbIconMode { - Off = 'off', - OnCode = 'onCode', - On = 'on' - } - - /** - * Configuration options for editor lightbulb - */ - export interface IEditorLightbulbOptions { - /** - * Enable the lightbulb code action. - * The three possible values are `off`, `on` and `onCode` and the default is `onCode`. - * `off` disables the code action menu. - * `on` shows the code action menu on code and on empty lines. - * `onCode` shows the code action menu on code only. - */ - enabled?: ShowLightbulbIconMode; - } - - export interface IEditorStickyScrollOptions { - /** - * Enable the sticky scroll - */ - enabled?: boolean; - /** - * Maximum number of sticky lines to show - */ - maxLineCount?: number; - /** - * Model to choose for sticky scroll by default - */ - defaultModel?: 'outlineModel' | 'foldingProviderModel' | 'indentationModel'; - /** - * Define whether to scroll sticky scroll with editor horizontal scrollbae - */ - scrollWithEditor?: boolean; - } - - /** - * Configuration options for editor inlayHints - */ - export interface IEditorInlayHintsOptions { - /** - * Enable the inline hints. - * Defaults to true. - */ - enabled?: 'on' | 'off' | 'offUnlessPressed' | 'onUnlessPressed'; - /** - * Font size of inline hints. - * Default to 90% of the editor font size. - */ - fontSize?: number; - /** - * Font family of inline hints. - * Defaults to editor font family. - */ - fontFamily?: string; - /** - * Enables the padding around the inlay hint. - * Defaults to false. - */ - padding?: boolean; - /** - * Maximum length for inlay hints per line - * Set to 0 to have an unlimited length. - */ - maximumLength?: number; - } - - /** - * Configuration options for editor minimap - */ - export interface IEditorMinimapOptions { - /** - * Enable the rendering of the minimap. - * Defaults to true. - */ - enabled?: boolean; - /** - * Control the rendering of minimap. - */ - autohide?: boolean; - /** - * Control the side of the minimap in editor. - * Defaults to 'right'. - */ - side?: 'right' | 'left'; - /** - * Control the minimap rendering mode. - * Defaults to 'actual'. - */ - size?: 'proportional' | 'fill' | 'fit'; - /** - * Control the rendering of the minimap slider. - * Defaults to 'mouseover'. - */ - showSlider?: 'always' | 'mouseover'; - /** - * Render the actual text on a line (as opposed to color blocks). - * Defaults to true. - */ - renderCharacters?: boolean; - /** - * Limit the width of the minimap to render at most a certain number of columns. - * Defaults to 120. - */ - maxColumn?: number; - /** - * Relative size of the font in the minimap. Defaults to 1. - */ - scale?: number; - /** - * Whether to show named regions as section headers. Defaults to true. - */ - showRegionSectionHeaders?: boolean; - /** - * Whether to show MARK: comments as section headers. Defaults to true. - */ - showMarkSectionHeaders?: boolean; - /** - * Font size of section headers. Defaults to 9. - */ - sectionHeaderFontSize?: number; - /** - * Spacing between the section header characters (in CSS px). Defaults to 1. - */ - sectionHeaderLetterSpacing?: number; - } - - /** - * Configuration options for editor padding - */ - export interface IEditorPaddingOptions { - /** - * Spacing between top edge of editor and first line. - */ - top?: number; - /** - * Spacing between bottom edge of editor and last line. - */ - bottom?: number; - } - - /** - * Configuration options for parameter hints - */ - export interface IEditorParameterHintOptions { - /** - * Enable parameter hints. - * Defaults to true. - */ - enabled?: boolean; - /** - * Enable cycling of parameter hints. - * Defaults to false. - */ - cycle?: boolean; - } - - export type QuickSuggestionsValue = 'on' | 'inline' | 'off'; - - /** - * Configuration options for quick suggestions - */ - export interface IQuickSuggestionsOptions { - other?: boolean | QuickSuggestionsValue; - comments?: boolean | QuickSuggestionsValue; - strings?: boolean | QuickSuggestionsValue; - } - - export interface InternalQuickSuggestionsOptions { - readonly other: QuickSuggestionsValue; - readonly comments: QuickSuggestionsValue; - readonly strings: QuickSuggestionsValue; - } - - export type LineNumbersType = 'on' | 'off' | 'relative' | 'interval' | ((lineNumber: number) => string); - - export enum RenderLineNumbersType { - Off = 0, - On = 1, - Relative = 2, - Interval = 3, - Custom = 4 - } - - export interface InternalEditorRenderLineNumbersOptions { - readonly renderType: RenderLineNumbersType; - readonly renderFn: ((lineNumber: number) => string) | null; - } - - export interface IRulerOption { - readonly column: number; - readonly color: string | null; - } - - /** - * Configuration options for editor scrollbars - */ - export interface IEditorScrollbarOptions { - /** - * The size of arrows (if displayed). - * Defaults to 11. - * **NOTE**: This option cannot be updated using `updateOptions()` - */ - arrowSize?: number; - /** - * Render vertical scrollbar. - * Defaults to 'auto'. - */ - vertical?: 'auto' | 'visible' | 'hidden'; - /** - * Render horizontal scrollbar. - * Defaults to 'auto'. - */ - horizontal?: 'auto' | 'visible' | 'hidden'; - /** - * Cast horizontal and vertical shadows when the content is scrolled. - * Defaults to true. - * **NOTE**: This option cannot be updated using `updateOptions()` - */ - useShadows?: boolean; - /** - * Render arrows at the top and bottom of the vertical scrollbar. - * Defaults to false. - * **NOTE**: This option cannot be updated using `updateOptions()` - */ - verticalHasArrows?: boolean; - /** - * Render arrows at the left and right of the horizontal scrollbar. - * Defaults to false. - * **NOTE**: This option cannot be updated using `updateOptions()` - */ - horizontalHasArrows?: boolean; - /** - * Listen to mouse wheel events and react to them by scrolling. - * Defaults to true. - */ - handleMouseWheel?: boolean; - /** - * Always consume mouse wheel events (always call preventDefault() and stopPropagation() on the browser events). - * Defaults to true. - * **NOTE**: This option cannot be updated using `updateOptions()` - */ - alwaysConsumeMouseWheel?: boolean; - /** - * Height in pixels for the horizontal scrollbar. - * Defaults to 10 (px). - */ - horizontalScrollbarSize?: number; - /** - * Width in pixels for the vertical scrollbar. - * Defaults to 10 (px). - */ - verticalScrollbarSize?: number; - /** - * Width in pixels for the vertical slider. - * Defaults to `verticalScrollbarSize`. - * **NOTE**: This option cannot be updated using `updateOptions()` - */ - verticalSliderSize?: number; - /** - * Height in pixels for the horizontal slider. - * Defaults to `horizontalScrollbarSize`. - * **NOTE**: This option cannot be updated using `updateOptions()` - */ - horizontalSliderSize?: number; - /** - * Scroll gutter clicks move by page vs jump to position. - * Defaults to false. - */ - scrollByPage?: boolean; - /** - * When set, the horizontal scrollbar will not increase content height. - * Defaults to false. - */ - ignoreHorizontalScrollbarInContentHeight?: boolean; - } - - export interface InternalEditorScrollbarOptions { - readonly arrowSize: number; - readonly vertical: ScrollbarVisibility; - readonly horizontal: ScrollbarVisibility; - readonly useShadows: boolean; - readonly verticalHasArrows: boolean; - readonly horizontalHasArrows: boolean; - readonly handleMouseWheel: boolean; - readonly alwaysConsumeMouseWheel: boolean; - readonly horizontalScrollbarSize: number; - readonly horizontalSliderSize: number; - readonly verticalScrollbarSize: number; - readonly verticalSliderSize: number; - readonly scrollByPage: boolean; - readonly ignoreHorizontalScrollbarInContentHeight: boolean; - } - - export type InUntrustedWorkspace = 'inUntrustedWorkspace'; - - /** - * Configuration options for unicode highlighting. - */ - export interface IUnicodeHighlightOptions { - /** - * Controls whether all non-basic ASCII characters are highlighted. Only characters between U+0020 and U+007E, tab, line-feed and carriage-return are considered basic ASCII. - */ - nonBasicASCII?: boolean | InUntrustedWorkspace; - /** - * Controls whether characters that just reserve space or have no width at all are highlighted. - */ - invisibleCharacters?: boolean; - /** - * Controls whether characters are highlighted that can be confused with basic ASCII characters, except those that are common in the current user locale. - */ - ambiguousCharacters?: boolean; - /** - * Controls whether characters in comments should also be subject to unicode highlighting. - */ - includeComments?: boolean | InUntrustedWorkspace; - /** - * Controls whether characters in strings should also be subject to unicode highlighting. - */ - includeStrings?: boolean | InUntrustedWorkspace; - /** - * Defines allowed characters that are not being highlighted. - */ - allowedCharacters?: Record; - /** - * Unicode characters that are common in allowed locales are not being highlighted. - */ - allowedLocales?: Record; - } - - export interface IInlineSuggestOptions { - /** - * Enable or disable the rendering of automatic inline completions. - */ - enabled?: boolean; - /** - * Configures the mode. - * Use `prefix` to only show ghost text if the text to replace is a prefix of the suggestion text. - * Use `subword` to only show ghost text if the replace text is a subword of the suggestion text. - * Use `subwordSmart` to only show ghost text if the replace text is a subword of the suggestion text, but the subword must start after the cursor position. - * Defaults to `prefix`. - */ - mode?: 'prefix' | 'subword' | 'subwordSmart'; - showToolbar?: 'always' | 'onHover' | 'never'; - syntaxHighlightingEnabled?: boolean; - suppressSuggestions?: boolean; - /** - * Does not clear active inline suggestions when the editor loses focus. - */ - keepOnBlur?: boolean; - /** - * Font family for inline suggestions. - */ - fontFamily?: string | 'default'; - edits?: { - experimental?: { - enabled?: boolean; - }; - }; - } - - export interface IBracketPairColorizationOptions { - /** - * Enable or disable bracket pair colorization. - */ - enabled?: boolean; - /** - * Use independent color pool per bracket type. - */ - independentColorPoolPerBracketType?: boolean; - } - - export interface IGuidesOptions { - /** - * Enable rendering of bracket pair guides. - * Defaults to false. - */ - bracketPairs?: boolean | 'active'; - /** - * Enable rendering of vertical bracket pair guides. - * Defaults to 'active'. - */ - bracketPairsHorizontal?: boolean | 'active'; - /** - * Enable highlighting of the active bracket pair. - * Defaults to true. - */ - highlightActiveBracketPair?: boolean; - /** - * Enable rendering of indent guides. - * Defaults to true. - */ - indentation?: boolean; - /** - * Enable highlighting of the active indent guide. - * Defaults to true. - */ - highlightActiveIndentation?: boolean | 'always'; - } - - /** - * Configuration options for editor suggest widget - */ - export interface ISuggestOptions { - /** - * Overwrite word ends on accept. Default to false. - */ - insertMode?: 'insert' | 'replace'; - /** - * Enable graceful matching. Defaults to true. - */ - filterGraceful?: boolean; - /** - * Prevent quick suggestions when a snippet is active. Defaults to true. - */ - snippetsPreventQuickSuggestions?: boolean; - /** - * Favors words that appear close to the cursor. - */ - localityBonus?: boolean; - /** - * Enable using global storage for remembering suggestions. - */ - shareSuggestSelections?: boolean; - /** - * Select suggestions when triggered via quick suggest or trigger characters - */ - selectionMode?: 'always' | 'never' | 'whenTriggerCharacter' | 'whenQuickSuggestion'; - /** - * Enable or disable icons in suggestions. Defaults to true. - */ - showIcons?: boolean; - /** - * Enable or disable the suggest status bar. - */ - showStatusBar?: boolean; - /** - * Enable or disable the rendering of the suggestion preview. - */ - preview?: boolean; - /** - * Configures the mode of the preview. - */ - previewMode?: 'prefix' | 'subword' | 'subwordSmart'; - /** - * Show details inline with the label. Defaults to true. - */ - showInlineDetails?: boolean; - /** - * Show method-suggestions. - */ - showMethods?: boolean; - /** - * Show function-suggestions. - */ - showFunctions?: boolean; - /** - * Show constructor-suggestions. - */ - showConstructors?: boolean; - /** - * Show deprecated-suggestions. - */ - showDeprecated?: boolean; - /** - * Controls whether suggestions allow matches in the middle of the word instead of only at the beginning - */ - matchOnWordStartOnly?: boolean; - /** - * Show field-suggestions. - */ - showFields?: boolean; - /** - * Show variable-suggestions. - */ - showVariables?: boolean; - /** - * Show class-suggestions. - */ - showClasses?: boolean; - /** - * Show struct-suggestions. - */ - showStructs?: boolean; - /** - * Show interface-suggestions. - */ - showInterfaces?: boolean; - /** - * Show module-suggestions. - */ - showModules?: boolean; - /** - * Show property-suggestions. - */ - showProperties?: boolean; - /** - * Show event-suggestions. - */ - showEvents?: boolean; - /** - * Show operator-suggestions. - */ - showOperators?: boolean; - /** - * Show unit-suggestions. - */ - showUnits?: boolean; - /** - * Show value-suggestions. - */ - showValues?: boolean; - /** - * Show constant-suggestions. - */ - showConstants?: boolean; - /** - * Show enum-suggestions. - */ - showEnums?: boolean; - /** - * Show enumMember-suggestions. - */ - showEnumMembers?: boolean; - /** - * Show keyword-suggestions. - */ - showKeywords?: boolean; - /** - * Show text-suggestions. - */ - showWords?: boolean; - /** - * Show color-suggestions. - */ - showColors?: boolean; - /** - * Show file-suggestions. - */ - showFiles?: boolean; - /** - * Show reference-suggestions. - */ - showReferences?: boolean; - /** - * Show folder-suggestions. - */ - showFolders?: boolean; - /** - * Show typeParameter-suggestions. - */ - showTypeParameters?: boolean; - /** - * Show issue-suggestions. - */ - showIssues?: boolean; - /** - * Show user-suggestions. - */ - showUsers?: boolean; - /** - * Show snippet-suggestions. - */ - showSnippets?: boolean; - } - - export interface ISmartSelectOptions { - selectLeadingAndTrailingWhitespace?: boolean; - selectSubwords?: boolean; - } - - /** - * Describes how to indent wrapped lines. - */ - export enum WrappingIndent { - /** - * No indentation => wrapped lines begin at column 1. - */ - None = 0, - /** - * Same => wrapped lines get the same indentation as the parent. - */ - Same = 1, - /** - * Indent => wrapped lines get +1 indentation toward the parent. - */ - Indent = 2, - /** - * DeepIndent => wrapped lines get +2 indentation toward the parent. - */ - DeepIndent = 3 - } - - export interface EditorWrappingInfo { - readonly isDominatedByLongLines: boolean; - readonly isWordWrapMinified: boolean; - readonly isViewportWrapping: boolean; - readonly wrappingColumn: number; - } - - /** - * Configuration options for editor drop into behavior - */ - export interface IDropIntoEditorOptions { - /** - * Enable dropping into editor. - * Defaults to true. - */ - enabled?: boolean; - /** - * Controls if a widget is shown after a drop. - * Defaults to 'afterDrop'. - */ - showDropSelector?: 'afterDrop' | 'never'; - } - - /** - * Configuration options for editor pasting as into behavior - */ - export interface IPasteAsOptions { - /** - * Enable paste as functionality in editors. - * Defaults to true. - */ - enabled?: boolean; - /** - * Controls if a widget is shown after a drop. - * Defaults to 'afterPaste'. - */ - showPasteSelector?: 'afterPaste' | 'never'; - } - - export enum EditorOption { - acceptSuggestionOnCommitCharacter = 0, - acceptSuggestionOnEnter = 1, - accessibilitySupport = 2, - accessibilityPageSize = 3, - ariaLabel = 4, - ariaRequired = 5, - autoClosingBrackets = 6, - autoClosingComments = 7, - screenReaderAnnounceInlineSuggestion = 8, - autoClosingDelete = 9, - autoClosingOvertype = 10, - autoClosingQuotes = 11, - autoIndent = 12, - automaticLayout = 13, - autoSurround = 14, - bracketPairColorization = 15, - guides = 16, - codeLens = 17, - codeLensFontFamily = 18, - codeLensFontSize = 19, - colorDecorators = 20, - colorDecoratorsLimit = 21, - columnSelection = 22, - comments = 23, - contextmenu = 24, - copyWithSyntaxHighlighting = 25, - cursorBlinking = 26, - cursorSmoothCaretAnimation = 27, - cursorStyle = 28, - cursorSurroundingLines = 29, - cursorSurroundingLinesStyle = 30, - cursorWidth = 31, - disableLayerHinting = 32, - disableMonospaceOptimizations = 33, - domReadOnly = 34, - dragAndDrop = 35, - dropIntoEditor = 36, - experimentalEditContextEnabled = 37, - emptySelectionClipboard = 38, - experimentalGpuAcceleration = 39, - experimentalWhitespaceRendering = 40, - extraEditorClassName = 41, - fastScrollSensitivity = 42, - find = 43, - fixedOverflowWidgets = 44, - folding = 45, - foldingStrategy = 46, - foldingHighlight = 47, - foldingImportsByDefault = 48, - foldingMaximumRegions = 49, - unfoldOnClickAfterEndOfLine = 50, - fontFamily = 51, - fontInfo = 52, - fontLigatures = 53, - fontSize = 54, - fontWeight = 55, - fontVariations = 56, - formatOnPaste = 57, - formatOnType = 58, - glyphMargin = 59, - gotoLocation = 60, - hideCursorInOverviewRuler = 61, - hover = 62, - inDiffEditor = 63, - inlineSuggest = 64, - letterSpacing = 65, - lightbulb = 66, - lineDecorationsWidth = 67, - lineHeight = 68, - lineNumbers = 69, - lineNumbersMinChars = 70, - linkedEditing = 71, - links = 72, - matchBrackets = 73, - minimap = 74, - mouseStyle = 75, - mouseWheelScrollSensitivity = 76, - mouseWheelZoom = 77, - multiCursorMergeOverlapping = 78, - multiCursorModifier = 79, - multiCursorPaste = 80, - multiCursorLimit = 81, - occurrencesHighlight = 82, - occurrencesHighlightDelay = 83, - overviewRulerBorder = 84, - overviewRulerLanes = 85, - padding = 86, - pasteAs = 87, - parameterHints = 88, - peekWidgetDefaultFocus = 89, - placeholder = 90, - definitionLinkOpensInPeek = 91, - quickSuggestions = 92, - quickSuggestionsDelay = 93, - readOnly = 94, - readOnlyMessage = 95, - renameOnType = 96, - renderControlCharacters = 97, - renderFinalNewline = 98, - renderLineHighlight = 99, - renderLineHighlightOnlyWhenFocus = 100, - renderValidationDecorations = 101, - renderWhitespace = 102, - revealHorizontalRightPadding = 103, - roundedSelection = 104, - rulers = 105, - scrollbar = 106, - scrollBeyondLastColumn = 107, - scrollBeyondLastLine = 108, - scrollPredominantAxis = 109, - selectionClipboard = 110, - selectionHighlight = 111, - selectOnLineNumbers = 112, - showFoldingControls = 113, - showUnused = 114, - snippetSuggestions = 115, - smartSelect = 116, - smoothScrolling = 117, - stickyScroll = 118, - stickyTabStops = 119, - stopRenderingLineAfter = 120, - suggest = 121, - suggestFontSize = 122, - suggestLineHeight = 123, - suggestOnTriggerCharacters = 124, - suggestSelection = 125, - tabCompletion = 126, - tabIndex = 127, - unicodeHighlighting = 128, - unusualLineTerminators = 129, - useShadowDOM = 130, - useTabStops = 131, - wordBreak = 132, - wordSegmenterLocales = 133, - wordSeparators = 134, - wordWrap = 135, - wordWrapBreakAfterCharacters = 136, - wordWrapBreakBeforeCharacters = 137, - wordWrapColumn = 138, - wordWrapOverride1 = 139, - wordWrapOverride2 = 140, - wrappingIndent = 141, - wrappingStrategy = 142, - showDeprecated = 143, - inlayHints = 144, - editorClassName = 145, - pixelRatio = 146, - tabFocusMode = 147, - layoutInfo = 148, - wrappingInfo = 149, - defaultColorDecorators = 150, - colorDecoratorsActivatedOn = 151, - inlineCompletionsAccessibilityVerbose = 152 - } - - export const EditorOptions: { - acceptSuggestionOnCommitCharacter: IEditorOption; - acceptSuggestionOnEnter: IEditorOption; - accessibilitySupport: IEditorOption; - accessibilityPageSize: IEditorOption; - ariaLabel: IEditorOption; - ariaRequired: IEditorOption; - screenReaderAnnounceInlineSuggestion: IEditorOption; - autoClosingBrackets: IEditorOption; - autoClosingComments: IEditorOption; - autoClosingDelete: IEditorOption; - autoClosingOvertype: IEditorOption; - autoClosingQuotes: IEditorOption; - autoIndent: IEditorOption; - automaticLayout: IEditorOption; - autoSurround: IEditorOption; - bracketPairColorization: IEditorOption>>; - bracketPairGuides: IEditorOption>>; - stickyTabStops: IEditorOption; - codeLens: IEditorOption; - codeLensFontFamily: IEditorOption; - codeLensFontSize: IEditorOption; - colorDecorators: IEditorOption; - colorDecoratorActivatedOn: IEditorOption; - colorDecoratorsLimit: IEditorOption; - columnSelection: IEditorOption; - comments: IEditorOption>>; - contextmenu: IEditorOption; - copyWithSyntaxHighlighting: IEditorOption; - cursorBlinking: IEditorOption; - cursorSmoothCaretAnimation: IEditorOption; - cursorStyle: IEditorOption; - cursorSurroundingLines: IEditorOption; - cursorSurroundingLinesStyle: IEditorOption; - cursorWidth: IEditorOption; - disableLayerHinting: IEditorOption; - disableMonospaceOptimizations: IEditorOption; - domReadOnly: IEditorOption; - dragAndDrop: IEditorOption; - emptySelectionClipboard: IEditorOption; - dropIntoEditor: IEditorOption>>; - experimentalEditContextEnabled: IEditorOption; - stickyScroll: IEditorOption>>; - experimentalGpuAcceleration: IEditorOption; - experimentalWhitespaceRendering: IEditorOption; - extraEditorClassName: IEditorOption; - fastScrollSensitivity: IEditorOption; - find: IEditorOption>>; - fixedOverflowWidgets: IEditorOption; - folding: IEditorOption; - foldingStrategy: IEditorOption; - foldingHighlight: IEditorOption; - foldingImportsByDefault: IEditorOption; - foldingMaximumRegions: IEditorOption; - unfoldOnClickAfterEndOfLine: IEditorOption; - fontFamily: IEditorOption; - fontInfo: IEditorOption; - fontLigatures2: IEditorOption; - fontSize: IEditorOption; - fontWeight: IEditorOption; - fontVariations: IEditorOption; - formatOnPaste: IEditorOption; - formatOnType: IEditorOption; - glyphMargin: IEditorOption; - gotoLocation: IEditorOption>>; - hideCursorInOverviewRuler: IEditorOption; - hover: IEditorOption>>; - inDiffEditor: IEditorOption; - letterSpacing: IEditorOption; - lightbulb: IEditorOption>>; - lineDecorationsWidth: IEditorOption; - lineHeight: IEditorOption; - lineNumbers: IEditorOption; - lineNumbersMinChars: IEditorOption; - linkedEditing: IEditorOption; - links: IEditorOption; - matchBrackets: IEditorOption; - minimap: IEditorOption>>; - mouseStyle: IEditorOption; - mouseWheelScrollSensitivity: IEditorOption; - mouseWheelZoom: IEditorOption; - multiCursorMergeOverlapping: IEditorOption; - multiCursorModifier: IEditorOption; - multiCursorPaste: IEditorOption; - multiCursorLimit: IEditorOption; - occurrencesHighlight: IEditorOption; - occurrencesHighlightDelay: IEditorOption; - overviewRulerBorder: IEditorOption; - overviewRulerLanes: IEditorOption; - padding: IEditorOption>>; - pasteAs: IEditorOption>>; - parameterHints: IEditorOption>>; - peekWidgetDefaultFocus: IEditorOption; - placeholder: IEditorOption; - definitionLinkOpensInPeek: IEditorOption; - quickSuggestions: IEditorOption; - quickSuggestionsDelay: IEditorOption; - readOnly: IEditorOption; - readOnlyMessage: IEditorOption; - renameOnType: IEditorOption; - renderControlCharacters: IEditorOption; - renderFinalNewline: IEditorOption; - renderLineHighlight: IEditorOption; - renderLineHighlightOnlyWhenFocus: IEditorOption; - renderValidationDecorations: IEditorOption; - renderWhitespace: IEditorOption; - revealHorizontalRightPadding: IEditorOption; - roundedSelection: IEditorOption; - rulers: IEditorOption; - scrollbar: IEditorOption; - scrollBeyondLastColumn: IEditorOption; - scrollBeyondLastLine: IEditorOption; - scrollPredominantAxis: IEditorOption; - selectionClipboard: IEditorOption; - selectionHighlight: IEditorOption; - selectOnLineNumbers: IEditorOption; - showFoldingControls: IEditorOption; - showUnused: IEditorOption; - showDeprecated: IEditorOption; - inlayHints: IEditorOption>>; - snippetSuggestions: IEditorOption; - smartSelect: IEditorOption>>; - smoothScrolling: IEditorOption; - stopRenderingLineAfter: IEditorOption; - suggest: IEditorOption>>; - inlineSuggest: IEditorOption>>; - inlineCompletionsAccessibilityVerbose: IEditorOption; - suggestFontSize: IEditorOption; - suggestLineHeight: IEditorOption; - suggestOnTriggerCharacters: IEditorOption; - suggestSelection: IEditorOption; - tabCompletion: IEditorOption; - tabIndex: IEditorOption; - unicodeHighlight: IEditorOption; - unusualLineTerminators: IEditorOption; - useShadowDOM: IEditorOption; - useTabStops: IEditorOption; - wordBreak: IEditorOption; - wordSegmenterLocales: IEditorOption; - wordSeparators: IEditorOption; - wordWrap: IEditorOption; - wordWrapBreakAfterCharacters: IEditorOption; - wordWrapBreakBeforeCharacters: IEditorOption; - wordWrapColumn: IEditorOption; - wordWrapOverride1: IEditorOption; - wordWrapOverride2: IEditorOption; - editorClassName: IEditorOption; - defaultColorDecorators: IEditorOption; - pixelRatio: IEditorOption; - tabFocusMode: IEditorOption; - layoutInfo: IEditorOption; - wrappingInfo: IEditorOption; - wrappingIndent: IEditorOption; - wrappingStrategy: IEditorOption; - }; - - type EditorOptionsType = typeof EditorOptions; - - type FindEditorOptionsKeyById = { - [K in keyof EditorOptionsType]: EditorOptionsType[K]['id'] extends T ? K : never; - }[keyof EditorOptionsType]; - - type ComputedEditorOptionValue> = T extends IEditorOption ? R : never; - - export type FindComputedEditorOptionValueById = NonNullable]>>; - - export interface IEditorConstructionOptions extends IEditorOptions { - /** - * The initial editor dimension (to avoid measuring the container). - */ - dimension?: IDimension; - /** - * Place overflow widgets inside an external DOM node. - * Defaults to an internal DOM node. - */ - overflowWidgetsDomNode?: HTMLElement; - } - - /** - * A view zone is a full horizontal rectangle that 'pushes' text down. - * The editor reserves space for view zones when rendering. - */ - export interface IViewZone { - /** - * The line number after which this zone should appear. - * Use 0 to place a view zone before the first line number. - */ - afterLineNumber: number; - /** - * The column after which this zone should appear. - * If not set, the maxLineColumn of `afterLineNumber` will be used. - * This is relevant for wrapped lines. - */ - afterColumn?: number; - /** - * If the `afterColumn` has multiple view columns, the affinity specifies which one to use. Defaults to `none`. - */ - afterColumnAffinity?: PositionAffinity; - /** - * Render the zone even when its line is hidden. - */ - showInHiddenAreas?: boolean; - /** - * Tiebreaker that is used when multiple view zones want to be after the same line. - * Defaults to `afterColumn` otherwise 10000; - */ - ordinal?: number; - /** - * Suppress mouse down events. - * If set, the editor will attach a mouse down listener to the view zone and .preventDefault on it. - * Defaults to false - */ - suppressMouseDown?: boolean; - /** - * The height in lines of the view zone. - * If specified, `heightInPx` will be used instead of this. - * If neither `heightInPx` nor `heightInLines` is specified, a default of `heightInLines` = 1 will be chosen. - */ - heightInLines?: number; - /** - * The height in px of the view zone. - * If this is set, the editor will give preference to it rather than `heightInLines` above. - * If neither `heightInPx` nor `heightInLines` is specified, a default of `heightInLines` = 1 will be chosen. - */ - heightInPx?: number; - /** - * The minimum width in px of the view zone. - * If this is set, the editor will ensure that the scroll width is >= than this value. - */ - minWidthInPx?: number; - /** - * The dom node of the view zone - */ - domNode: HTMLElement; - /** - * An optional dom node for the view zone that will be placed in the margin area. - */ - marginDomNode?: HTMLElement | null; - /** - * Callback which gives the relative top of the view zone as it appears (taking scrolling into account). - */ - onDomNodeTop?: (top: number) => void; - /** - * Callback which gives the height in pixels of the view zone. - */ - onComputedHeight?: (height: number) => void; - } - - /** - * An accessor that allows for zones to be added or removed. - */ - export interface IViewZoneChangeAccessor { - /** - * Create a new view zone. - * @param zone Zone to create - * @return A unique identifier to the view zone. - */ - addZone(zone: IViewZone): string; - /** - * Remove a zone - * @param id A unique identifier to the view zone, as returned by the `addZone` call. - */ - removeZone(id: string): void; - /** - * Change a zone's position. - * The editor will rescan the `afterLineNumber` and `afterColumn` properties of a view zone. - */ - layoutZone(id: string): void; - } - - /** - * A positioning preference for rendering content widgets. - */ - export enum ContentWidgetPositionPreference { - /** - * Place the content widget exactly at a position - */ - EXACT = 0, - /** - * Place the content widget above a position - */ - ABOVE = 1, - /** - * Place the content widget below a position - */ - BELOW = 2 - } - - /** - * A position for rendering content widgets. - */ - export interface IContentWidgetPosition { - /** - * Desired position which serves as an anchor for placing the content widget. - * The widget will be placed above, at, or below the specified position, based on the - * provided preference. The widget will always touch this position. - * - * Given sufficient horizontal space, the widget will be placed to the right of the - * passed in position. This can be tweaked by providing a `secondaryPosition`. - * - * @see preference - * @see secondaryPosition - */ - position: IPosition | null; - /** - * Optionally, a secondary position can be provided to further define the placing of - * the content widget. The secondary position must have the same line number as the - * primary position. If possible, the widget will be placed such that it also touches - * the secondary position. - */ - secondaryPosition?: IPosition | null; - /** - * Placement preference for position, in order of preference. - */ - preference: ContentWidgetPositionPreference[]; - /** - * Placement preference when multiple view positions refer to the same (model) position. - * This plays a role when injected text is involved. - */ - positionAffinity?: PositionAffinity; - } - - /** - * A content widget renders inline with the text and can be easily placed 'near' an editor position. - */ - export interface IContentWidget { - /** - * Render this content widget in a location where it could overflow the editor's view dom node. - */ - allowEditorOverflow?: boolean; - /** - * Call preventDefault() on mousedown events that target the content widget. - */ - suppressMouseDown?: boolean; - /** - * Get a unique identifier of the content widget. - */ - getId(): string; - /** - * Get the dom node of the content widget. - */ - getDomNode(): HTMLElement; - /** - * Get the placement of the content widget. - * If null is returned, the content widget will be placed off screen. - */ - getPosition(): IContentWidgetPosition | null; - /** - * Optional function that is invoked before rendering - * the content widget. If a dimension is returned the editor will - * attempt to use it. - */ - beforeRender?(): IDimension | null; - /** - * Optional function that is invoked after rendering the content - * widget. Is being invoked with the selected position preference - * or `null` if not rendered. - */ - afterRender?(position: ContentWidgetPositionPreference | null): void; - } - - /** - * A positioning preference for rendering overlay widgets. - */ - export enum OverlayWidgetPositionPreference { - /** - * Position the overlay widget in the top right corner - */ - TOP_RIGHT_CORNER = 0, - /** - * Position the overlay widget in the bottom right corner - */ - BOTTOM_RIGHT_CORNER = 1, - /** - * Position the overlay widget in the top center - */ - TOP_CENTER = 2 - } - - /** - * Represents editor-relative coordinates of an overlay widget. - */ - export interface IOverlayWidgetPositionCoordinates { - /** - * The top position for the overlay widget, relative to the editor. - */ - top: number; - /** - * The left position for the overlay widget, relative to the editor. - */ - left: number; - } - - /** - * A position for rendering overlay widgets. - */ - export interface IOverlayWidgetPosition { - /** - * The position preference for the overlay widget. - */ - preference: OverlayWidgetPositionPreference | IOverlayWidgetPositionCoordinates | null; - /** - * When set, stacks with other overlay widgets with the same preference, - * in an order determined by the ordinal value. - */ - stackOridinal?: number; - } - - /** - * An overlay widgets renders on top of the text. - */ - export interface IOverlayWidget { - /** - * Event fired when the widget layout changes. - */ - onDidLayout?: IEvent; - /** - * Render this overlay widget in a location where it could overflow the editor's view dom node. - */ - allowEditorOverflow?: boolean; - /** - * Get a unique identifier of the overlay widget. - */ - getId(): string; - /** - * Get the dom node of the overlay widget. - */ - getDomNode(): HTMLElement; - /** - * Get the placement of the overlay widget. - * If null is returned, the overlay widget is responsible to place itself. - */ - getPosition(): IOverlayWidgetPosition | null; - /** - * The editor will ensure that the scroll width is >= than this value. - */ - getMinContentWidthInPx?(): number; - } - - /** - * A glyph margin widget renders in the editor glyph margin. - */ - export interface IGlyphMarginWidget { - /** - * Get a unique identifier of the glyph widget. - */ - getId(): string; - /** - * Get the dom node of the glyph widget. - */ - getDomNode(): HTMLElement; - /** - * Get the placement of the glyph widget. - */ - getPosition(): IGlyphMarginWidgetPosition; - } - - /** - * A position for rendering glyph margin widgets. - */ - export interface IGlyphMarginWidgetPosition { - /** - * The glyph margin lane where the widget should be shown. - */ - lane: GlyphMarginLane; - /** - * The priority order of the widget, used for determining which widget - * to render when there are multiple. - */ - zIndex: number; - /** - * The editor range that this widget applies to. - */ - range: IRange; - } - - /** - * Type of hit element with the mouse in the editor. - */ - export enum MouseTargetType { - /** - * Mouse is on top of an unknown element. - */ - UNKNOWN = 0, - /** - * Mouse is on top of the textarea used for input. - */ - TEXTAREA = 1, - /** - * Mouse is on top of the glyph margin - */ - GUTTER_GLYPH_MARGIN = 2, - /** - * Mouse is on top of the line numbers - */ - GUTTER_LINE_NUMBERS = 3, - /** - * Mouse is on top of the line decorations - */ - GUTTER_LINE_DECORATIONS = 4, - /** - * Mouse is on top of the whitespace left in the gutter by a view zone. - */ - GUTTER_VIEW_ZONE = 5, - /** - * Mouse is on top of text in the content. - */ - CONTENT_TEXT = 6, - /** - * Mouse is on top of empty space in the content (e.g. after line text or below last line) - */ - CONTENT_EMPTY = 7, - /** - * Mouse is on top of a view zone in the content. - */ - CONTENT_VIEW_ZONE = 8, - /** - * Mouse is on top of a content widget. - */ - CONTENT_WIDGET = 9, - /** - * Mouse is on top of the decorations overview ruler. - */ - OVERVIEW_RULER = 10, - /** - * Mouse is on top of a scrollbar. - */ - SCROLLBAR = 11, - /** - * Mouse is on top of an overlay widget. - */ - OVERLAY_WIDGET = 12, - /** - * Mouse is outside of the editor. - */ - OUTSIDE_EDITOR = 13 - } - - export interface IBaseMouseTarget { - /** - * The target element - */ - readonly element: HTMLElement | null; - /** - * The 'approximate' editor position - */ - readonly position: Position | null; - /** - * Desired mouse column (e.g. when position.column gets clamped to text length -- clicking after text on a line). - */ - readonly mouseColumn: number; - /** - * The 'approximate' editor range - */ - readonly range: Range | null; - } - - export interface IMouseTargetUnknown extends IBaseMouseTarget { - readonly type: MouseTargetType.UNKNOWN; - } - - export interface IMouseTargetTextarea extends IBaseMouseTarget { - readonly type: MouseTargetType.TEXTAREA; - readonly position: null; - readonly range: null; - } - - export interface IMouseTargetMarginData { - readonly isAfterLines: boolean; - readonly glyphMarginLeft: number; - readonly glyphMarginWidth: number; - readonly glyphMarginLane?: GlyphMarginLane; - readonly lineNumbersWidth: number; - readonly offsetX: number; - } - - export interface IMouseTargetMargin extends IBaseMouseTarget { - readonly type: MouseTargetType.GUTTER_GLYPH_MARGIN | MouseTargetType.GUTTER_LINE_NUMBERS | MouseTargetType.GUTTER_LINE_DECORATIONS; - readonly position: Position; - readonly range: Range; - readonly detail: IMouseTargetMarginData; - } - - export interface IMouseTargetViewZoneData { - readonly viewZoneId: string; - readonly positionBefore: Position | null; - readonly positionAfter: Position | null; - readonly position: Position; - readonly afterLineNumber: number; - } - - export interface IMouseTargetViewZone extends IBaseMouseTarget { - readonly type: MouseTargetType.GUTTER_VIEW_ZONE | MouseTargetType.CONTENT_VIEW_ZONE; - readonly position: Position; - readonly range: Range; - readonly detail: IMouseTargetViewZoneData; - } - - export interface IMouseTargetContentTextData { - readonly mightBeForeignElement: boolean; - } - - export interface IMouseTargetContentText extends IBaseMouseTarget { - readonly type: MouseTargetType.CONTENT_TEXT; - readonly position: Position; - readonly range: Range; - readonly detail: IMouseTargetContentTextData; - } - - export interface IMouseTargetContentEmptyData { - readonly isAfterLines: boolean; - readonly horizontalDistanceToText?: number; - } - - export interface IMouseTargetContentEmpty extends IBaseMouseTarget { - readonly type: MouseTargetType.CONTENT_EMPTY; - readonly position: Position; - readonly range: Range; - readonly detail: IMouseTargetContentEmptyData; - } - - export interface IMouseTargetContentWidget extends IBaseMouseTarget { - readonly type: MouseTargetType.CONTENT_WIDGET; - readonly position: null; - readonly range: null; - readonly detail: string; - } - - export interface IMouseTargetOverlayWidget extends IBaseMouseTarget { - readonly type: MouseTargetType.OVERLAY_WIDGET; - readonly position: null; - readonly range: null; - readonly detail: string; - } - - export interface IMouseTargetScrollbar extends IBaseMouseTarget { - readonly type: MouseTargetType.SCROLLBAR; - readonly position: Position; - readonly range: Range; - } - - export interface IMouseTargetOverviewRuler extends IBaseMouseTarget { - readonly type: MouseTargetType.OVERVIEW_RULER; - } - - export interface IMouseTargetOutsideEditor extends IBaseMouseTarget { - readonly type: MouseTargetType.OUTSIDE_EDITOR; - readonly outsidePosition: 'above' | 'below' | 'left' | 'right'; - readonly outsideDistance: number; - } - - /** - * Target hit with the mouse in the editor. - */ - export type IMouseTarget = (IMouseTargetUnknown | IMouseTargetTextarea | IMouseTargetMargin | IMouseTargetViewZone | IMouseTargetContentText | IMouseTargetContentEmpty | IMouseTargetContentWidget | IMouseTargetOverlayWidget | IMouseTargetScrollbar | IMouseTargetOverviewRuler | IMouseTargetOutsideEditor); - - /** - * A mouse event originating from the editor. - */ - export interface IEditorMouseEvent { - readonly event: IMouseEvent; - readonly target: IMouseTarget; - } - - export interface IPartialEditorMouseEvent { - readonly event: IMouseEvent; - readonly target: IMouseTarget | null; - } - - /** - * A paste event originating from the editor. - */ - export interface IPasteEvent { - readonly range: Range; - readonly languageId: string | null; - readonly clipboardEvent?: ClipboardEvent; - } - - export interface IDiffEditorConstructionOptions extends IDiffEditorOptions, IEditorConstructionOptions { - /** - * Place overflow widgets inside an external DOM node. - * Defaults to an internal DOM node. - */ - overflowWidgetsDomNode?: HTMLElement; - /** - * Aria label for original editor. - */ - originalAriaLabel?: string; - /** - * Aria label for modified editor. - */ - modifiedAriaLabel?: string; - } - - /** - * A rich code editor. - */ - export interface ICodeEditor extends IEditor { - /** - * An event emitted when the content of the current model has changed. - * @event - */ - readonly onDidChangeModelContent: IEvent; - /** - * An event emitted when the language of the current model has changed. - * @event - */ - readonly onDidChangeModelLanguage: IEvent; - /** - * An event emitted when the language configuration of the current model has changed. - * @event - */ - readonly onDidChangeModelLanguageConfiguration: IEvent; - /** - * An event emitted when the options of the current model has changed. - * @event - */ - readonly onDidChangeModelOptions: IEvent; - /** - * An event emitted when the configuration of the editor has changed. (e.g. `editor.updateOptions()`) - * @event - */ - readonly onDidChangeConfiguration: IEvent; - /** - * An event emitted when the cursor position has changed. - * @event - */ - readonly onDidChangeCursorPosition: IEvent; - /** - * An event emitted when the cursor selection has changed. - * @event - */ - readonly onDidChangeCursorSelection: IEvent; - /** - * An event emitted when the model of this editor is about to change (e.g. from `editor.setModel()`). - * @event - */ - readonly onWillChangeModel: IEvent; - /** - * An event emitted when the model of this editor has changed (e.g. `editor.setModel()`). - * @event - */ - readonly onDidChangeModel: IEvent; - /** - * An event emitted when the decorations of the current model have changed. - * @event - */ - readonly onDidChangeModelDecorations: IEvent; - /** - * An event emitted when the text inside this editor gained focus (i.e. cursor starts blinking). - * @event - */ - readonly onDidFocusEditorText: IEvent; - /** - * An event emitted when the text inside this editor lost focus (i.e. cursor stops blinking). - * @event - */ - readonly onDidBlurEditorText: IEvent; - /** - * An event emitted when the text inside this editor or an editor widget gained focus. - * @event - */ - readonly onDidFocusEditorWidget: IEvent; - /** - * An event emitted when the text inside this editor or an editor widget lost focus. - * @event - */ - readonly onDidBlurEditorWidget: IEvent; - /** - * An event emitted after composition has started. - */ - readonly onDidCompositionStart: IEvent; - /** - * An event emitted after composition has ended. - */ - readonly onDidCompositionEnd: IEvent; - /** - * An event emitted when editing failed because the editor is read-only. - * @event - */ - readonly onDidAttemptReadOnlyEdit: IEvent; - /** - * An event emitted when users paste text in the editor. - * @event - */ - readonly onDidPaste: IEvent; - /** - * An event emitted on a "mouseup". - * @event - */ - readonly onMouseUp: IEvent; - /** - * An event emitted on a "mousedown". - * @event - */ - readonly onMouseDown: IEvent; - /** - * An event emitted on a "contextmenu". - * @event - */ - readonly onContextMenu: IEvent; - /** - * An event emitted on a "mousemove". - * @event - */ - readonly onMouseMove: IEvent; - /** - * An event emitted on a "mouseleave". - * @event - */ - readonly onMouseLeave: IEvent; - /** - * An event emitted on a "keyup". - * @event - */ - readonly onKeyUp: IEvent; - /** - * An event emitted on a "keydown". - * @event - */ - readonly onKeyDown: IEvent; - /** - * An event emitted when the layout of the editor has changed. - * @event - */ - readonly onDidLayoutChange: IEvent; - /** - * An event emitted when the content width or content height in the editor has changed. - * @event - */ - readonly onDidContentSizeChange: IEvent; - /** - * An event emitted when the scroll in the editor has changed. - * @event - */ - readonly onDidScrollChange: IEvent; - /** - * An event emitted when hidden areas change in the editor (e.g. due to folding). - * @event - */ - readonly onDidChangeHiddenAreas: IEvent; - /** - * Some editor operations fire multiple events at once. - * To allow users to react to multiple events fired by a single operation, - * the editor fires a begin update before the operation and an end update after the operation. - * Whenever the editor fires `onBeginUpdate`, it will also fire `onEndUpdate` once the operation finishes. - * Note that not all operations are bracketed by `onBeginUpdate` and `onEndUpdate`. - */ - readonly onBeginUpdate: IEvent; - /** - * Fires after the editor completes the operation it fired `onBeginUpdate` for. - */ - readonly onEndUpdate: IEvent; - /** - * Saves current view state of the editor in a serializable object. - */ - saveViewState(): ICodeEditorViewState | null; - /** - * Restores the view state of the editor from a serializable object generated by `saveViewState`. - */ - restoreViewState(state: ICodeEditorViewState | null): void; - /** - * Returns true if the text inside this editor or an editor widget has focus. - */ - hasWidgetFocus(): boolean; - /** - * Get a contribution of this editor. - * @id Unique identifier of the contribution. - * @return The contribution or null if contribution not found. - */ - getContribution(id: string): T | null; - /** - * Type the getModel() of IEditor. - */ - getModel(): ITextModel | null; - /** - * Sets the current model attached to this editor. - * If the previous model was created by the editor via the value key in the options - * literal object, it will be destroyed. Otherwise, if the previous model was set - * via setModel, or the model key in the options literal object, the previous model - * will not be destroyed. - * It is safe to call setModel(null) to simply detach the current model from the editor. - */ - setModel(model: ITextModel | null): void; - /** - * Gets all the editor computed options. - */ - getOptions(): IComputedEditorOptions; - /** - * Gets a specific editor option. - */ - getOption(id: T): FindComputedEditorOptionValueById; - /** - * Returns the editor's configuration (without any validation or defaults). - */ - getRawOptions(): IEditorOptions; - /** - * Get value of the current model attached to this editor. - * @see {@link ITextModel.getValue} - */ - getValue(options?: { - preserveBOM: boolean; - lineEnding: string; - }): string; - /** - * Set the value of the current model attached to this editor. - * @see {@link ITextModel.setValue} - */ - setValue(newValue: string): void; - /** - * Get the width of the editor's content. - * This is information that is "erased" when computing `scrollWidth = Math.max(contentWidth, width)` - */ - getContentWidth(): number; - /** - * Get the scrollWidth of the editor's viewport. - */ - getScrollWidth(): number; - /** - * Get the scrollLeft of the editor's viewport. - */ - getScrollLeft(): number; - /** - * Get the height of the editor's content. - * This is information that is "erased" when computing `scrollHeight = Math.max(contentHeight, height)` - */ - getContentHeight(): number; - /** - * Get the scrollHeight of the editor's viewport. - */ - getScrollHeight(): number; - /** - * Get the scrollTop of the editor's viewport. - */ - getScrollTop(): number; - /** - * Change the scrollLeft of the editor's viewport. - */ - setScrollLeft(newScrollLeft: number, scrollType?: ScrollType): void; - /** - * Change the scrollTop of the editor's viewport. - */ - setScrollTop(newScrollTop: number, scrollType?: ScrollType): void; - /** - * Change the scroll position of the editor's viewport. - */ - setScrollPosition(position: INewScrollPosition, scrollType?: ScrollType): void; - /** - * Check if the editor is currently scrolling towards a different scroll position. - */ - hasPendingScrollAnimation(): boolean; - /** - * Get an action that is a contribution to this editor. - * @id Unique identifier of the contribution. - * @return The action or null if action not found. - */ - getAction(id: string): IEditorAction | null; - /** - * Execute a command on the editor. - * The edits will land on the undo-redo stack, but no "undo stop" will be pushed. - * @param source The source of the call. - * @param command The command to execute - */ - executeCommand(source: string | null | undefined, command: ICommand): void; - /** - * Create an "undo stop" in the undo-redo stack. - */ - pushUndoStop(): boolean; - /** - * Remove the "undo stop" in the undo-redo stack. - */ - popUndoStop(): boolean; - /** - * Execute edits on the editor. - * The edits will land on the undo-redo stack, but no "undo stop" will be pushed. - * @param source The source of the call. - * @param edits The edits to execute. - * @param endCursorState Cursor state after the edits were applied. - */ - executeEdits(source: string | null | undefined, edits: IIdentifiedSingleEditOperation[], endCursorState?: ICursorStateComputer | Selection[]): boolean; - /** - * Execute multiple (concomitant) commands on the editor. - * @param source The source of the call. - * @param command The commands to execute - */ - executeCommands(source: string | null | undefined, commands: (ICommand | null)[]): void; - /** - * Get all the decorations on a line (filtering out decorations from other editors). - */ - getLineDecorations(lineNumber: number): IModelDecoration[] | null; - /** - * Get all the decorations for a range (filtering out decorations from other editors). - */ - getDecorationsInRange(range: Range): IModelDecoration[] | null; - /** - * All decorations added through this call will get the ownerId of this editor. - * @deprecated Use `createDecorationsCollection` - * @see createDecorationsCollection - */ - deltaDecorations(oldDecorations: string[], newDecorations: IModelDeltaDecoration[]): string[]; - /** - * Remove previously added decorations. - */ - removeDecorations(decorationIds: string[]): void; - /** - * Get the layout info for the editor. - */ - getLayoutInfo(): EditorLayoutInfo; - /** - * Returns the ranges that are currently visible. - * Does not account for horizontal scrolling. - */ - getVisibleRanges(): Range[]; - /** - * Get the vertical position (top offset) for the line's top w.r.t. to the first line. - */ - getTopForLineNumber(lineNumber: number, includeViewZones?: boolean): number; - /** - * Get the vertical position (top offset) for the line's bottom w.r.t. to the first line. - */ - getBottomForLineNumber(lineNumber: number): number; - /** - * Get the vertical position (top offset) for the position w.r.t. to the first line. - */ - getTopForPosition(lineNumber: number, column: number): number; - /** - * Write the screen reader content to be the current selection - */ - writeScreenReaderContent(reason: string): void; - /** - * Returns the editor's container dom node - */ - getContainerDomNode(): HTMLElement; - /** - * Returns the editor's dom node - */ - getDomNode(): HTMLElement | null; - /** - * Add a content widget. Widgets must have unique ids, otherwise they will be overwritten. - */ - addContentWidget(widget: IContentWidget): void; - /** - * Layout/Reposition a content widget. This is a ping to the editor to call widget.getPosition() - * and update appropriately. - */ - layoutContentWidget(widget: IContentWidget): void; - /** - * Remove a content widget. - */ - removeContentWidget(widget: IContentWidget): void; - /** - * Add an overlay widget. Widgets must have unique ids, otherwise they will be overwritten. - */ - addOverlayWidget(widget: IOverlayWidget): void; - /** - * Layout/Reposition an overlay widget. This is a ping to the editor to call widget.getPosition() - * and update appropriately. - */ - layoutOverlayWidget(widget: IOverlayWidget): void; - /** - * Remove an overlay widget. - */ - removeOverlayWidget(widget: IOverlayWidget): void; - /** - * Add a glyph margin widget. Widgets must have unique ids, otherwise they will be overwritten. - */ - addGlyphMarginWidget(widget: IGlyphMarginWidget): void; - /** - * Layout/Reposition a glyph margin widget. This is a ping to the editor to call widget.getPosition() - * and update appropriately. - */ - layoutGlyphMarginWidget(widget: IGlyphMarginWidget): void; - /** - * Remove a glyph margin widget. - */ - removeGlyphMarginWidget(widget: IGlyphMarginWidget): void; - /** - * Change the view zones. View zones are lost when a new model is attached to the editor. - */ - changeViewZones(callback: (accessor: IViewZoneChangeAccessor) => void): void; - /** - * Get the horizontal position (left offset) for the column w.r.t to the beginning of the line. - * This method works only if the line `lineNumber` is currently rendered (in the editor's viewport). - * Use this method with caution. - */ - getOffsetForColumn(lineNumber: number, column: number): number; - /** - * Force an editor render now. - */ - render(forceRedraw?: boolean): void; - /** - * Get the hit test target at coordinates `clientX` and `clientY`. - * The coordinates are relative to the top-left of the viewport. - * - * @returns Hit test target or null if the coordinates fall outside the editor or the editor has no model. - */ - getTargetAtClientPoint(clientX: number, clientY: number): IMouseTarget | null; - /** - * Get the visible position for `position`. - * The result position takes scrolling into account and is relative to the top left corner of the editor. - * Explanation 1: the results of this method will change for the same `position` if the user scrolls the editor. - * Explanation 2: the results of this method will not change if the container of the editor gets repositioned. - * Warning: the results of this method are inaccurate for positions that are outside the current editor viewport. - */ - getScrolledVisiblePosition(position: IPosition): { - top: number; - left: number; - height: number; - } | null; - /** - * Apply the same font settings as the editor to `target`. - */ - applyFontInfo(target: HTMLElement): void; - setBanner(bannerDomNode: HTMLElement | null, height: number): void; - /** - * Is called when the model has been set, view state was restored and options are updated. - * This is the best place to compute data for the viewport (such as tokens). - */ - handleInitialized?(): void; - } - - /** - * A rich diff editor. - */ - export interface IDiffEditor extends IEditor { - /** - * @see {@link ICodeEditor.getContainerDomNode} - */ - getContainerDomNode(): HTMLElement; - /** - * An event emitted when the diff information computed by this diff editor has been updated. - * @event - */ - readonly onDidUpdateDiff: IEvent; - /** - * An event emitted when the diff model is changed (i.e. the diff editor shows new content). - * @event - */ - readonly onDidChangeModel: IEvent; - /** - * Saves current view state of the editor in a serializable object. - */ - saveViewState(): IDiffEditorViewState | null; - /** - * Restores the view state of the editor from a serializable object generated by `saveViewState`. - */ - restoreViewState(state: IDiffEditorViewState | null): void; - /** - * Type the getModel() of IEditor. - */ - getModel(): IDiffEditorModel | null; - createViewModel(model: IDiffEditorModel): IDiffEditorViewModel; - /** - * Sets the current model attached to this editor. - * If the previous model was created by the editor via the value key in the options - * literal object, it will be destroyed. Otherwise, if the previous model was set - * via setModel, or the model key in the options literal object, the previous model - * will not be destroyed. - * It is safe to call setModel(null) to simply detach the current model from the editor. - */ - setModel(model: IDiffEditorModel | IDiffEditorViewModel | null): void; - /** - * Get the `original` editor. - */ - getOriginalEditor(): ICodeEditor; - /** - * Get the `modified` editor. - */ - getModifiedEditor(): ICodeEditor; - /** - * Get the computed diff information. - */ - getLineChanges(): ILineChange[] | null; - /** - * Update the editor's options after the editor has been created. - */ - updateOptions(newOptions: IDiffEditorOptions): void; - /** - * Jumps to the next or previous diff. - */ - goToDiff(target: 'next' | 'previous'): void; - /** - * Scrolls to the first diff. - * (Waits until the diff computation finished.) - */ - revealFirstDiff(): unknown; - accessibleDiffViewerNext(): void; - accessibleDiffViewerPrev(): void; - handleInitialized(): void; - } - - export class FontInfo extends BareFontInfo { - readonly _editorStylingBrand: void; - readonly version: number; - readonly isTrusted: boolean; - readonly isMonospace: boolean; - readonly typicalHalfwidthCharacterWidth: number; - readonly typicalFullwidthCharacterWidth: number; - readonly canUseHalfwidthRightwardsArrow: boolean; - readonly spaceWidth: number; - readonly middotWidth: number; - readonly wsmiddotWidth: number; - readonly maxDigitWidth: number; - } - - export class BareFontInfo { - readonly _bareFontInfoBrand: void; - readonly pixelRatio: number; - readonly fontFamily: string; - readonly fontWeight: string; - readonly fontSize: number; - readonly fontFeatureSettings: string; - readonly fontVariationSettings: string; - readonly lineHeight: number; - readonly letterSpacing: number; - } - - export const EditorZoom: IEditorZoom; - - export interface IEditorZoom { - onDidChangeZoomLevel: IEvent; - getZoomLevel(): number; - setZoomLevel(zoomLevel: number): void; - } - - //compatibility: - export type IReadOnlyModel = ITextModel; - export type IModel = ITextModel; -} - -declare namespace monaco.languages { - - export interface IRelativePattern { - /** - * A base file path to which this pattern will be matched against relatively. - */ - readonly base: string; - /** - * A file glob pattern like `*.{ts,js}` that will be matched on file paths - * relative to the base path. - * - * Example: Given a base of `/home/work/folder` and a file path of `/home/work/folder/index.js`, - * the file glob pattern will match on `index.js`. - */ - readonly pattern: string; - } - - export type LanguageSelector = string | LanguageFilter | ReadonlyArray; - - export interface LanguageFilter { - readonly language?: string; - readonly scheme?: string; - readonly pattern?: string | IRelativePattern; - readonly notebookType?: string; - /** - * This provider is implemented in the UI thread. - */ - readonly hasAccessToAllModels?: boolean; - readonly exclusive?: boolean; - /** - * This provider comes from a builtin extension. - */ - readonly isBuiltin?: boolean; - } - - /** - * Register information about a new language. - */ - export function register(language: ILanguageExtensionPoint): void; - - /** - * Get the information of all the registered languages. - */ - export function getLanguages(): ILanguageExtensionPoint[]; - - export function getEncodedLanguageId(languageId: string): number; - - /** - * An event emitted when a language is associated for the first time with a text model. - * @event - */ - export function onLanguage(languageId: string, callback: () => void): IDisposable; - - /** - * An event emitted when a language is associated for the first time with a text model or - * when a language is encountered during the tokenization of another language. - * @event - */ - export function onLanguageEncountered(languageId: string, callback: () => void): IDisposable; - - /** - * Set the editing configuration for a language. - */ - export function setLanguageConfiguration(languageId: string, configuration: LanguageConfiguration): IDisposable; - - /** - * A token. - */ - export interface IToken { - startIndex: number; - scopes: string; - } - - /** - * The result of a line tokenization. - */ - export interface ILineTokens { - /** - * The list of tokens on the line. - */ - tokens: IToken[]; - /** - * The tokenization end state. - * A pointer will be held to this and the object should not be modified by the tokenizer after the pointer is returned. - */ - endState: IState; - } - - /** - * The result of a line tokenization. - */ - export interface IEncodedLineTokens { - /** - * The tokens on the line in a binary, encoded format. Each token occupies two array indices. For token i: - * - at offset 2*i => startIndex - * - at offset 2*i + 1 => metadata - * Meta data is in binary format: - * - ------------------------------------------- - * 3322 2222 2222 1111 1111 1100 0000 0000 - * 1098 7654 3210 9876 5432 1098 7654 3210 - * - ------------------------------------------- - * bbbb bbbb bfff ffff ffFF FFTT LLLL LLLL - * - ------------------------------------------- - * - L = EncodedLanguageId (8 bits): Use `getEncodedLanguageId` to get the encoded ID of a language. - * - T = StandardTokenType (2 bits): Other = 0, Comment = 1, String = 2, RegEx = 3. - * - F = FontStyle (4 bits): None = 0, Italic = 1, Bold = 2, Underline = 4, Strikethrough = 8. - * - f = foreground ColorId (9 bits) - * - b = background ColorId (9 bits) - * - The color value for each colorId is defined in IStandaloneThemeData.customTokenColors: - * e.g. colorId = 1 is stored in IStandaloneThemeData.customTokenColors[1]. Color id = 0 means no color, - * id = 1 is for the default foreground color, id = 2 for the default background. - */ - tokens: Uint32Array; - /** - * The tokenization end state. - * A pointer will be held to this and the object should not be modified by the tokenizer after the pointer is returned. - */ - endState: IState; - } - - /** - * A factory for token providers. - */ - export interface TokensProviderFactory { - create(): ProviderResult; - } - - /** - * A "manual" provider of tokens. - */ - export interface TokensProvider { - /** - * The initial state of a language. Will be the state passed in to tokenize the first line. - */ - getInitialState(): IState; - /** - * Tokenize a line given the state at the beginning of the line. - */ - tokenize(line: string, state: IState): ILineTokens; - } - - /** - * A "manual" provider of tokens, returning tokens in a binary form. - */ - export interface EncodedTokensProvider { - /** - * The initial state of a language. Will be the state passed in to tokenize the first line. - */ - getInitialState(): IState; - /** - * Tokenize a line given the state at the beginning of the line. - */ - tokenizeEncoded(line: string, state: IState): IEncodedLineTokens; - /** - * Tokenize a line given the state at the beginning of the line. - */ - tokenize?(line: string, state: IState): ILineTokens; - } - - /** - * Change the color map that is used for token colors. - * Supported formats (hex): #RRGGBB, $RRGGBBAA, #RGB, #RGBA - */ - export function setColorMap(colorMap: string[] | null): void; - - /** - * Register a tokens provider factory for a language. This tokenizer will be exclusive with a tokenizer - * set using `setTokensProvider` or one created using `setMonarchTokensProvider`, but will work together - * with a tokens provider set using `registerDocumentSemanticTokensProvider` or `registerDocumentRangeSemanticTokensProvider`. - */ - export function registerTokensProviderFactory(languageId: string, factory: TokensProviderFactory): IDisposable; - - /** - * Set the tokens provider for a language (manual implementation). This tokenizer will be exclusive - * with a tokenizer created using `setMonarchTokensProvider`, or with `registerTokensProviderFactory`, - * but will work together with a tokens provider set using `registerDocumentSemanticTokensProvider` - * or `registerDocumentRangeSemanticTokensProvider`. - */ - export function setTokensProvider(languageId: string, provider: TokensProvider | EncodedTokensProvider | Thenable): IDisposable; - - /** - * Set the tokens provider for a language (monarch implementation). This tokenizer will be exclusive - * with a tokenizer set using `setTokensProvider`, or with `registerTokensProviderFactory`, but will - * work together with a tokens provider set using `registerDocumentSemanticTokensProvider` or - * `registerDocumentRangeSemanticTokensProvider`. - */ - export function setMonarchTokensProvider(languageId: string, languageDef: IMonarchLanguage | Thenable): IDisposable; - - /** - * Register a reference provider (used by e.g. reference search). - */ - export function registerReferenceProvider(languageSelector: LanguageSelector, provider: ReferenceProvider): IDisposable; - - /** - * Register a rename provider (used by e.g. rename symbol). - */ - export function registerRenameProvider(languageSelector: LanguageSelector, provider: RenameProvider): IDisposable; - - /** - * Register a new symbol-name provider (e.g., when a symbol is being renamed, show new possible symbol-names) - */ - export function registerNewSymbolNameProvider(languageSelector: LanguageSelector, provider: NewSymbolNamesProvider): IDisposable; - - /** - * Register a signature help provider (used by e.g. parameter hints). - */ - export function registerSignatureHelpProvider(languageSelector: LanguageSelector, provider: SignatureHelpProvider): IDisposable; - - /** - * Register a hover provider (used by e.g. editor hover). - */ - export function registerHoverProvider(languageSelector: LanguageSelector, provider: HoverProvider): IDisposable; - - /** - * Register a document symbol provider (used by e.g. outline). - */ - export function registerDocumentSymbolProvider(languageSelector: LanguageSelector, provider: DocumentSymbolProvider): IDisposable; - - /** - * Register a document highlight provider (used by e.g. highlight occurrences). - */ - export function registerDocumentHighlightProvider(languageSelector: LanguageSelector, provider: DocumentHighlightProvider): IDisposable; - - /** - * Register an linked editing range provider. - */ - export function registerLinkedEditingRangeProvider(languageSelector: LanguageSelector, provider: LinkedEditingRangeProvider): IDisposable; - - /** - * Register a definition provider (used by e.g. go to definition). - */ - export function registerDefinitionProvider(languageSelector: LanguageSelector, provider: DefinitionProvider): IDisposable; - - /** - * Register a implementation provider (used by e.g. go to implementation). - */ - export function registerImplementationProvider(languageSelector: LanguageSelector, provider: ImplementationProvider): IDisposable; - - /** - * Register a type definition provider (used by e.g. go to type definition). - */ - export function registerTypeDefinitionProvider(languageSelector: LanguageSelector, provider: TypeDefinitionProvider): IDisposable; - - /** - * Register a code lens provider (used by e.g. inline code lenses). - */ - export function registerCodeLensProvider(languageSelector: LanguageSelector, provider: CodeLensProvider): IDisposable; - - /** - * Register a code action provider (used by e.g. quick fix). - */ - export function registerCodeActionProvider(languageSelector: LanguageSelector, provider: CodeActionProvider, metadata?: CodeActionProviderMetadata): IDisposable; - - /** - * Register a formatter that can handle only entire models. - */ - export function registerDocumentFormattingEditProvider(languageSelector: LanguageSelector, provider: DocumentFormattingEditProvider): IDisposable; - - /** - * Register a formatter that can handle a range inside a model. - */ - export function registerDocumentRangeFormattingEditProvider(languageSelector: LanguageSelector, provider: DocumentRangeFormattingEditProvider): IDisposable; - - /** - * Register a formatter than can do formatting as the user types. - */ - export function registerOnTypeFormattingEditProvider(languageSelector: LanguageSelector, provider: OnTypeFormattingEditProvider): IDisposable; - - /** - * Register a link provider that can find links in text. - */ - export function registerLinkProvider(languageSelector: LanguageSelector, provider: LinkProvider): IDisposable; - - /** - * Register a completion item provider (use by e.g. suggestions). - */ - export function registerCompletionItemProvider(languageSelector: LanguageSelector, provider: CompletionItemProvider): IDisposable; - - /** - * Register a document color provider (used by Color Picker, Color Decorator). - */ - export function registerColorProvider(languageSelector: LanguageSelector, provider: DocumentColorProvider): IDisposable; - - /** - * Register a folding range provider - */ - export function registerFoldingRangeProvider(languageSelector: LanguageSelector, provider: FoldingRangeProvider): IDisposable; - - /** - * Register a declaration provider - */ - export function registerDeclarationProvider(languageSelector: LanguageSelector, provider: DeclarationProvider): IDisposable; - - /** - * Register a selection range provider - */ - export function registerSelectionRangeProvider(languageSelector: LanguageSelector, provider: SelectionRangeProvider): IDisposable; - - /** - * Register a document semantic tokens provider. A semantic tokens provider will complement and enhance a - * simple top-down tokenizer. Simple top-down tokenizers can be set either via `setMonarchTokensProvider` - * or `setTokensProvider`. - * - * For the best user experience, register both a semantic tokens provider and a top-down tokenizer. - */ - export function registerDocumentSemanticTokensProvider(languageSelector: LanguageSelector, provider: DocumentSemanticTokensProvider): IDisposable; - - /** - * Register a document range semantic tokens provider. A semantic tokens provider will complement and enhance a - * simple top-down tokenizer. Simple top-down tokenizers can be set either via `setMonarchTokensProvider` - * or `setTokensProvider`. - * - * For the best user experience, register both a semantic tokens provider and a top-down tokenizer. - */ - export function registerDocumentRangeSemanticTokensProvider(languageSelector: LanguageSelector, provider: DocumentRangeSemanticTokensProvider): IDisposable; - - /** - * Register an inline completions provider. - */ - export function registerInlineCompletionsProvider(languageSelector: LanguageSelector, provider: InlineCompletionsProvider): IDisposable; - - export function registerInlineEditProvider(languageSelector: LanguageSelector, provider: InlineEditProvider): IDisposable; - - /** - * Register an inlay hints provider. - */ - export function registerInlayHintsProvider(languageSelector: LanguageSelector, provider: InlayHintsProvider): IDisposable; - - /** - * Contains additional diagnostic information about the context in which - * a [code action](#CodeActionProvider.provideCodeActions) is run. - */ - export interface CodeActionContext { - /** - * An array of diagnostics. - */ - readonly markers: editor.IMarkerData[]; - /** - * Requested kind of actions to return. - */ - readonly only?: string; - /** - * The reason why code actions were requested. - */ - readonly trigger: CodeActionTriggerType; - } - - /** - * The code action interface defines the contract between extensions and - * the [light bulb](https://code.visualstudio.com/docs/editor/editingevolved#_code-action) feature. - */ - export interface CodeActionProvider { - /** - * Provide commands for the given document and range. - */ - provideCodeActions(model: editor.ITextModel, range: Range, context: CodeActionContext, token: CancellationToken): ProviderResult; - /** - * Given a code action fill in the edit. Will only invoked when missing. - */ - resolveCodeAction?(codeAction: CodeAction, token: CancellationToken): ProviderResult; - } - - /** - * Metadata about the type of code actions that a {@link CodeActionProvider} provides. - */ - export interface CodeActionProviderMetadata { - /** - * List of code action kinds that a {@link CodeActionProvider} may return. - * - * This list is used to determine if a given `CodeActionProvider` should be invoked or not. - * To avoid unnecessary computation, every `CodeActionProvider` should list use `providedCodeActionKinds`. The - * list of kinds may either be generic, such as `["quickfix", "refactor", "source"]`, or list out every kind provided, - * such as `["quickfix.removeLine", "source.fixAll" ...]`. - */ - readonly providedCodeActionKinds?: readonly string[]; - readonly documentation?: ReadonlyArray<{ - readonly kind: string; - readonly command: Command; - }>; - } - - /** - * Describes how comments for a language work. - */ - export interface CommentRule { - /** - * The line comment token, like `// this is a comment` - */ - lineComment?: string | null; - /** - * The block comment character pair, like `/* block comment */` - */ - blockComment?: CharacterPair | null; - } - - /** - * The language configuration interface defines the contract between extensions and - * various editor features, like automatic bracket insertion, automatic indentation etc. - */ - export interface LanguageConfiguration { - /** - * The language's comment settings. - */ - comments?: CommentRule; - /** - * The language's brackets. - * This configuration implicitly affects pressing Enter around these brackets. - */ - brackets?: CharacterPair[]; - /** - * The language's word definition. - * If the language supports Unicode identifiers (e.g. JavaScript), it is preferable - * to provide a word definition that uses exclusion of known separators. - * e.g.: A regex that matches anything except known separators (and dot is allowed to occur in a floating point number): - * /(-?\d*\.\d\w*)|([^\`\~\!\@\#\%\^\&\*\(\)\-\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g - */ - wordPattern?: RegExp; - /** - * The language's indentation settings. - */ - indentationRules?: IndentationRule; - /** - * The language's rules to be evaluated when pressing Enter. - */ - onEnterRules?: OnEnterRule[]; - /** - * The language's auto closing pairs. The 'close' character is automatically inserted with the - * 'open' character is typed. If not set, the configured brackets will be used. - */ - autoClosingPairs?: IAutoClosingPairConditional[]; - /** - * The language's surrounding pairs. When the 'open' character is typed on a selection, the - * selected string is surrounded by the open and close characters. If not set, the autoclosing pairs - * settings will be used. - */ - surroundingPairs?: IAutoClosingPair[]; - /** - * Defines a list of bracket pairs that are colorized depending on their nesting level. - * If not set, the configured brackets will be used. - */ - colorizedBracketPairs?: CharacterPair[]; - /** - * Defines what characters must be after the cursor for bracket or quote autoclosing to occur when using the \'languageDefined\' autoclosing setting. - * - * This is typically the set of characters which can not start an expression, such as whitespace, closing brackets, non-unary operators, etc. - */ - autoCloseBefore?: string; - /** - * The language's folding rules. - */ - folding?: FoldingRules; - /** - * **Deprecated** Do not use. - * - * @deprecated Will be replaced by a better API soon. - */ - __electricCharacterSupport?: { - docComment?: IDocComment; - }; - } - - /** - * Describes indentation rules for a language. - */ - export interface IndentationRule { - /** - * If a line matches this pattern, then all the lines after it should be unindented once (until another rule matches). - */ - decreaseIndentPattern: RegExp; - /** - * If a line matches this pattern, then all the lines after it should be indented once (until another rule matches). - */ - increaseIndentPattern: RegExp; - /** - * If a line matches this pattern, then **only the next line** after it should be indented once. - */ - indentNextLinePattern?: RegExp | null; - /** - * If a line matches this pattern, then its indentation should not be changed and it should not be evaluated against the other rules. - */ - unIndentedLinePattern?: RegExp | null; - } - - /** - * Describes language specific folding markers such as '#region' and '#endregion'. - * The start and end regexes will be tested against the contents of all lines and must be designed efficiently: - * - the regex should start with '^' - * - regexp flags (i, g) are ignored - */ - export interface FoldingMarkers { - start: RegExp; - end: RegExp; - } - - /** - * Describes folding rules for a language. - */ - export interface FoldingRules { - /** - * Used by the indentation based strategy to decide whether empty lines belong to the previous or the next block. - * A language adheres to the off-side rule if blocks in that language are expressed by their indentation. - * See [wikipedia](https://en.wikipedia.org/wiki/Off-side_rule) for more information. - * If not set, `false` is used and empty lines belong to the previous block. - */ - offSide?: boolean; - /** - * Region markers used by the language. - */ - markers?: FoldingMarkers; - } - - /** - * Describes a rule to be evaluated when pressing Enter. - */ - export interface OnEnterRule { - /** - * This rule will only execute if the text before the cursor matches this regular expression. - */ - beforeText: RegExp; - /** - * This rule will only execute if the text after the cursor matches this regular expression. - */ - afterText?: RegExp; - /** - * This rule will only execute if the text above the this line matches this regular expression. - */ - previousLineText?: RegExp; - /** - * The action to execute. - */ - action: EnterAction; - } - - /** - * Definition of documentation comments (e.g. Javadoc/JSdoc) - */ - export interface IDocComment { - /** - * The string that starts a doc comment (e.g. '/**') - */ - open: string; - /** - * The string that appears on the last line and closes the doc comment (e.g. ' * /'). - */ - close?: string; - } - - /** - * A tuple of two characters, like a pair of - * opening and closing brackets. - */ - export type CharacterPair = [string, string]; - - export interface IAutoClosingPair { - open: string; - close: string; - } - - export interface IAutoClosingPairConditional extends IAutoClosingPair { - notIn?: string[]; - } - - /** - * Describes what to do with the indentation when pressing Enter. - */ - export enum IndentAction { - /** - * Insert new line and copy the previous line's indentation. - */ - None = 0, - /** - * Insert new line and indent once (relative to the previous line's indentation). - */ - Indent = 1, - /** - * Insert two new lines: - * - the first one indented which will hold the cursor - * - the second one at the same indentation level - */ - IndentOutdent = 2, - /** - * Insert new line and outdent once (relative to the previous line's indentation). - */ - Outdent = 3 - } - - /** - * Describes what to do when pressing Enter. - */ - export interface EnterAction { - /** - * Describe what to do with the indentation. - */ - indentAction: IndentAction; - /** - * Describes text to be appended after the new line and after the indentation. - */ - appendText?: string; - /** - * Describes the number of characters to remove from the new line's indentation. - */ - removeText?: number; - } - - /** - * The state of the tokenizer between two lines. - * It is useful to store flags such as in multiline comment, etc. - * The model will clone the previous line's state and pass it in to tokenize the next line. - */ - export interface IState { - clone(): IState; - equals(other: IState): boolean; - } - - /** - * A provider result represents the values a provider, like the {@link HoverProvider}, - * may return. For once this is the actual result type `T`, like `Hover`, or a thenable that resolves - * to that type `T`. In addition, `null` and `undefined` can be returned - either directly or from a - * thenable. - */ - export type ProviderResult = T | undefined | null | Thenable; - - /** - * A hover represents additional information for a symbol or word. Hovers are - * rendered in a tooltip-like widget. - */ - export interface Hover { - /** - * The contents of this hover. - */ - contents: IMarkdownString[]; - /** - * The range to which this hover applies. When missing, the - * editor will use the range at the current position or the - * current position itself. - */ - range?: IRange; - /** - * Can increase the verbosity of the hover - */ - canIncreaseVerbosity?: boolean; - /** - * Can decrease the verbosity of the hover - */ - canDecreaseVerbosity?: boolean; - } - - /** - * The hover provider interface defines the contract between extensions and - * the [hover](https://code.visualstudio.com/docs/editor/intellisense)-feature. - */ - export interface HoverProvider { - /** - * Provide a hover for the given position, context and document. Multiple hovers at the same - * position will be merged by the editor. A hover can have a range which defaults - * to the word range at the position when omitted. - */ - provideHover(model: editor.ITextModel, position: Position, token: CancellationToken, context?: HoverContext): ProviderResult; - } - - export interface HoverContext { - /** - * Hover verbosity request - */ - verbosityRequest?: HoverVerbosityRequest; - } - - export interface HoverVerbosityRequest { - /** - * The delta by which to increase/decrease the hover verbosity level - */ - verbosityDelta: number; - /** - * The previous hover for the same position - */ - previousHover: THover; - } - - export enum HoverVerbosityAction { - /** - * Increase the verbosity of the hover - */ - Increase = 0, - /** - * Decrease the verbosity of the hover - */ - Decrease = 1 - } - - export enum CompletionItemKind { - Method = 0, - Function = 1, - Constructor = 2, - Field = 3, - Variable = 4, - Class = 5, - Struct = 6, - Interface = 7, - Module = 8, - Property = 9, - Event = 10, - Operator = 11, - Unit = 12, - Value = 13, - Constant = 14, - Enum = 15, - EnumMember = 16, - Keyword = 17, - Text = 18, - Color = 19, - File = 20, - Reference = 21, - Customcolor = 22, - Folder = 23, - TypeParameter = 24, - User = 25, - Issue = 26, - Snippet = 27 - } - - export interface CompletionItemLabel { - label: string; - detail?: string; - description?: string; - } - - export enum CompletionItemTag { - Deprecated = 1 - } - - export enum CompletionItemInsertTextRule { - None = 0, - /** - * Adjust whitespace/indentation of multiline insert texts to - * match the current line indentation. - */ - KeepWhitespace = 1, - /** - * `insertText` is a snippet. - */ - InsertAsSnippet = 4 - } - - export interface CompletionItemRanges { - insert: IRange; - replace: IRange; - } - - /** - * A completion item represents a text snippet that is - * proposed to complete text that is being typed. - */ - export interface CompletionItem { - /** - * The label of this completion item. By default - * this is also the text that is inserted when selecting - * this completion. - */ - label: string | CompletionItemLabel; - /** - * The kind of this completion item. Based on the kind - * an icon is chosen by the editor. - */ - kind: CompletionItemKind; - /** - * A modifier to the `kind` which affect how the item - * is rendered, e.g. Deprecated is rendered with a strikeout - */ - tags?: ReadonlyArray; - /** - * A human-readable string with additional information - * about this item, like type or symbol information. - */ - detail?: string; - /** - * A human-readable string that represents a doc-comment. - */ - documentation?: string | IMarkdownString; - /** - * A string that should be used when comparing this item - * with other items. When `falsy` the {@link CompletionItem.label label} - * is used. - */ - sortText?: string; - /** - * A string that should be used when filtering a set of - * completion items. When `falsy` the {@link CompletionItem.label label} - * is used. - */ - filterText?: string; - /** - * Select this item when showing. *Note* that only one completion item can be selected and - * that the editor decides which item that is. The rule is that the *first* item of those - * that match best is selected. - */ - preselect?: boolean; - /** - * A string or snippet that should be inserted in a document when selecting - * this completion. - */ - insertText: string; - /** - * Additional rules (as bitmask) that should be applied when inserting - * this completion. - */ - insertTextRules?: CompletionItemInsertTextRule; - /** - * A range of text that should be replaced by this completion item. - * - * Defaults to a range from the start of the {@link TextDocument.getWordRangeAtPosition current word} to the - * current position. - * - * *Note:* The range must be a {@link Range.isSingleLine single line} and it must - * {@link Range.contains contain} the position at which completion has been {@link CompletionItemProvider.provideCompletionItems requested}. - */ - range: IRange | CompletionItemRanges; - /** - * An optional set of characters that when pressed while this completion is active will accept it first and - * then type that character. *Note* that all commit characters should have `length=1` and that superfluous - * characters will be ignored. - */ - commitCharacters?: string[]; - /** - * An optional array of additional text edits that are applied when - * selecting this completion. Edits must not overlap with the main edit - * nor with themselves. - */ - additionalTextEdits?: editor.ISingleEditOperation[]; - /** - * A command that should be run upon acceptance of this item. - */ - command?: Command; - } - - export interface CompletionList { - suggestions: CompletionItem[]; - incomplete?: boolean; - dispose?(): void; - } - - /** - * Info provided on partial acceptance. - */ - export interface PartialAcceptInfo { - kind: PartialAcceptTriggerKind; - } - - /** - * How a partial acceptance was triggered. - */ - export enum PartialAcceptTriggerKind { - Word = 0, - Line = 1, - Suggest = 2 - } - - /** - * How a suggest provider was triggered. - */ - export enum CompletionTriggerKind { - Invoke = 0, - TriggerCharacter = 1, - TriggerForIncompleteCompletions = 2 - } - - /** - * Contains additional information about the context in which - * {@link CompletionItemProvider.provideCompletionItems completion provider} is triggered. - */ - export interface CompletionContext { - /** - * How the completion was triggered. - */ - triggerKind: CompletionTriggerKind; - /** - * Character that triggered the completion item provider. - * - * `undefined` if provider was not triggered by a character. - */ - triggerCharacter?: string; - } - - /** - * The completion item provider interface defines the contract between extensions and - * the [IntelliSense](https://code.visualstudio.com/docs/editor/intellisense). - * - * When computing *complete* completion items is expensive, providers can optionally implement - * the `resolveCompletionItem`-function. In that case it is enough to return completion - * items with a {@link CompletionItem.label label} from the - * {@link CompletionItemProvider.provideCompletionItems provideCompletionItems}-function. Subsequently, - * when a completion item is shown in the UI and gains focus this provider is asked to resolve - * the item, like adding {@link CompletionItem.documentation doc-comment} or {@link CompletionItem.detail details}. - */ - export interface CompletionItemProvider { - triggerCharacters?: string[]; - /** - * Provide completion items for the given position and document. - */ - provideCompletionItems(model: editor.ITextModel, position: Position, context: CompletionContext, token: CancellationToken): ProviderResult; - /** - * Given a completion item fill in more data, like {@link CompletionItem.documentation doc-comment} - * or {@link CompletionItem.detail details}. - * - * The editor will only resolve a completion item once. - */ - resolveCompletionItem?(item: CompletionItem, token: CancellationToken): ProviderResult; - } - - /** - * How an {@link InlineCompletionsProvider inline completion provider} was triggered. - */ - export enum InlineCompletionTriggerKind { - /** - * Completion was triggered automatically while editing. - * It is sufficient to return a single completion item in this case. - */ - Automatic = 0, - /** - * Completion was triggered explicitly by a user gesture. - * Return multiple completion items to enable cycling through them. - */ - Explicit = 1 - } - - export interface InlineCompletionContext { - /** - * How the completion was triggered. - */ - readonly triggerKind: InlineCompletionTriggerKind; - readonly selectedSuggestionInfo: SelectedSuggestionInfo | undefined; - readonly includeInlineEdits: boolean; - readonly includeInlineCompletions: boolean; - } - - export class SelectedSuggestionInfo { - readonly range: IRange; - readonly text: string; - readonly completionKind: CompletionItemKind; - readonly isSnippetText: boolean; - constructor(range: IRange, text: string, completionKind: CompletionItemKind, isSnippetText: boolean); - equals(other: SelectedSuggestionInfo): boolean; - } - - export interface InlineCompletion { - /** - * The text to insert. - * If the text contains a line break, the range must end at the end of a line. - * If existing text should be replaced, the existing text must be a prefix of the text to insert. - * - * The text can also be a snippet. In that case, a preview with default parameters is shown. - * When accepting the suggestion, the full snippet is inserted. - */ - readonly insertText: string | { - snippet: string; - }; - /** - * A text that is used to decide if this inline completion should be shown. - * An inline completion is shown if the text to replace is a subword of the filter text. - */ - readonly filterText?: string; - /** - * An optional array of additional text edits that are applied when - * selecting this completion. Edits must not overlap with the main edit - * nor with themselves. - */ - readonly additionalTextEdits?: editor.ISingleEditOperation[]; - /** - * The range to replace. - * Must begin and end on the same line. - */ - readonly range?: IRange; - readonly command?: Command; - /** - * If set to `true`, unopened closing brackets are removed and unclosed opening brackets are closed. - * Defaults to `false`. - */ - readonly completeBracketPairs?: boolean; - readonly isInlineEdit?: boolean; - } - - export interface InlineCompletions { - readonly items: readonly TItem[]; - /** - * A list of commands associated with the inline completions of this list. - */ - readonly commands?: Command[]; - readonly suppressSuggestions?: boolean | undefined; - /** - * When set and the user types a suggestion without derivating from it, the inline suggestion is not updated. - */ - readonly enableForwardStability?: boolean | undefined; - } - - export type InlineCompletionProviderGroupId = string; - - export interface InlineCompletionsProvider { - provideInlineCompletions(model: editor.ITextModel, position: Position, context: InlineCompletionContext, token: CancellationToken): ProviderResult; - /** - * Will be called when an item is shown. - * @param updatedInsertText Is useful to understand bracket completion. - */ - handleItemDidShow?(completions: T, item: T['items'][number], updatedInsertText: string): void; - /** - * Will be called when an item is partially accepted. TODO: also handle full acceptance here! - */ - handlePartialAccept?(completions: T, item: T['items'][number], acceptedCharacters: number, info: PartialAcceptInfo): void; - handleRejection?(completions: T, item: T['items'][number]): void; - /** - * Will be called when a completions list is no longer in use and can be garbage-collected. - */ - freeInlineCompletions(completions: T): void; - /** - * Only used for {@link yieldsToGroupIds}. - * Multiple providers can have the same group id. - */ - groupId?: InlineCompletionProviderGroupId; - /** - * Returns a list of preferred provider {@link groupId}s. - * The current provider is only requested for completions if no provider with a preferred group id returned a result. - */ - yieldsToGroupIds?: InlineCompletionProviderGroupId[]; - toString?(): string; - } - - export interface CodeAction { - title: string; - command?: Command; - edit?: WorkspaceEdit; - diagnostics?: editor.IMarkerData[]; - kind?: string; - isPreferred?: boolean; - isAI?: boolean; - disabled?: string; - ranges?: IRange[]; - } - - export enum CodeActionTriggerType { - Invoke = 1, - Auto = 2 - } - - export interface CodeActionList extends IDisposable { - readonly actions: ReadonlyArray; - } - - /** - * Represents a parameter of a callable-signature. A parameter can - * have a label and a doc-comment. - */ - export interface ParameterInformation { - /** - * The label of this signature. Will be shown in - * the UI. - */ - label: string | [number, number]; - /** - * The human-readable doc-comment of this signature. Will be shown - * in the UI but can be omitted. - */ - documentation?: string | IMarkdownString; - } - - /** - * Represents the signature of something callable. A signature - * can have a label, like a function-name, a doc-comment, and - * a set of parameters. - */ - export interface SignatureInformation { - /** - * The label of this signature. Will be shown in - * the UI. - */ - label: string; - /** - * The human-readable doc-comment of this signature. Will be shown - * in the UI but can be omitted. - */ - documentation?: string | IMarkdownString; - /** - * The parameters of this signature. - */ - parameters: ParameterInformation[]; - /** - * Index of the active parameter. - * - * If provided, this is used in place of `SignatureHelp.activeSignature`. - */ - activeParameter?: number; - } - - /** - * Signature help represents the signature of something - * callable. There can be multiple signatures but only one - * active and only one active parameter. - */ - export interface SignatureHelp { - /** - * One or more signatures. - */ - signatures: SignatureInformation[]; - /** - * The active signature. - */ - activeSignature: number; - /** - * The active parameter of the active signature. - */ - activeParameter: number; - } - - export interface SignatureHelpResult extends IDisposable { - value: SignatureHelp; - } - - export enum SignatureHelpTriggerKind { - Invoke = 1, - TriggerCharacter = 2, - ContentChange = 3 - } - - export interface SignatureHelpContext { - readonly triggerKind: SignatureHelpTriggerKind; - readonly triggerCharacter?: string; - readonly isRetrigger: boolean; - readonly activeSignatureHelp?: SignatureHelp; - } - - /** - * The signature help provider interface defines the contract between extensions and - * the [parameter hints](https://code.visualstudio.com/docs/editor/intellisense)-feature. - */ - export interface SignatureHelpProvider { - readonly signatureHelpTriggerCharacters?: ReadonlyArray; - readonly signatureHelpRetriggerCharacters?: ReadonlyArray; - /** - * Provide help for the signature at the given position and document. - */ - provideSignatureHelp(model: editor.ITextModel, position: Position, token: CancellationToken, context: SignatureHelpContext): ProviderResult; - } - - /** - * A document highlight kind. - */ - export enum DocumentHighlightKind { - /** - * A textual occurrence. - */ - Text = 0, - /** - * Read-access of a symbol, like reading a variable. - */ - Read = 1, - /** - * Write-access of a symbol, like writing to a variable. - */ - Write = 2 - } - - /** - * A document highlight is a range inside a text document which deserves - * special attention. Usually a document highlight is visualized by changing - * the background color of its range. - */ - export interface DocumentHighlight { - /** - * The range this highlight applies to. - */ - range: IRange; - /** - * The highlight kind, default is {@link DocumentHighlightKind.Text text}. - */ - kind?: DocumentHighlightKind; - } - - /** - * Represents a set of document highlights for a specific Uri. - */ - export interface MultiDocumentHighlight { - /** - * The Uri of the document that the highlights belong to. - */ - uri: Uri; - /** - * The set of highlights for the document. - */ - highlights: DocumentHighlight[]; - } - - /** - * The document highlight provider interface defines the contract between extensions and - * the word-highlight-feature. - */ - export interface DocumentHighlightProvider { - /** - * Provide a set of document highlights, like all occurrences of a variable or - * all exit-points of a function. - */ - provideDocumentHighlights(model: editor.ITextModel, position: Position, token: CancellationToken): ProviderResult; - } - - /** - * A provider that can provide document highlights across multiple documents. - */ - export interface MultiDocumentHighlightProvider { - readonly selector: LanguageSelector; - /** - * Provide a Map of Uri --> document highlights, like all occurrences of a variable or - * all exit-points of a function. - * - * Used in cases such as split view, notebooks, etc. where there can be multiple documents - * with shared symbols. - * - * @param primaryModel The primary text model. - * @param position The position at which to provide document highlights. - * @param otherModels The other text models to search for document highlights. - * @param token A cancellation token. - * @returns A map of Uri to document highlights. - */ - provideMultiDocumentHighlights(primaryModel: editor.ITextModel, position: Position, otherModels: editor.ITextModel[], token: CancellationToken): ProviderResult>; - } - - /** - * The linked editing range provider interface defines the contract between extensions and - * the linked editing feature. - */ - export interface LinkedEditingRangeProvider { - /** - * Provide a list of ranges that can be edited together. - */ - provideLinkedEditingRanges(model: editor.ITextModel, position: Position, token: CancellationToken): ProviderResult; - } - - /** - * Represents a list of ranges that can be edited together along with a word pattern to describe valid contents. - */ - export interface LinkedEditingRanges { - /** - * A list of ranges that can be edited together. The ranges must have - * identical length and text content. The ranges cannot overlap - */ - ranges: IRange[]; - /** - * An optional word pattern that describes valid contents for the given ranges. - * If no pattern is provided, the language configuration's word pattern will be used. - */ - wordPattern?: RegExp; - } - - /** - * Value-object that contains additional information when - * requesting references. - */ - export interface ReferenceContext { - /** - * Include the declaration of the current symbol. - */ - includeDeclaration: boolean; - } - - /** - * The reference provider interface defines the contract between extensions and - * the [find references](https://code.visualstudio.com/docs/editor/editingevolved#_peek)-feature. - */ - export interface ReferenceProvider { - /** - * Provide a set of project-wide references for the given position and document. - */ - provideReferences(model: editor.ITextModel, position: Position, context: ReferenceContext, token: CancellationToken): ProviderResult; - } - - /** - * Represents a location inside a resource, such as a line - * inside a text file. - */ - export interface Location { - /** - * The resource identifier of this location. - */ - uri: Uri; - /** - * The document range of this locations. - */ - range: IRange; - } - - export interface LocationLink { - /** - * A range to select where this link originates from. - */ - originSelectionRange?: IRange; - /** - * The target uri this link points to. - */ - uri: Uri; - /** - * The full range this link points to. - */ - range: IRange; - /** - * A range to select this link points to. Must be contained - * in `LocationLink.range`. - */ - targetSelectionRange?: IRange; - } - - export type Definition = Location | Location[] | LocationLink[]; - - /** - * The definition provider interface defines the contract between extensions and - * the [go to definition](https://code.visualstudio.com/docs/editor/editingevolved#_go-to-definition) - * and peek definition features. - */ - export interface DefinitionProvider { - /** - * Provide the definition of the symbol at the given position and document. - */ - provideDefinition(model: editor.ITextModel, position: Position, token: CancellationToken): ProviderResult; - } - - /** - * The definition provider interface defines the contract between extensions and - * the [go to definition](https://code.visualstudio.com/docs/editor/editingevolved#_go-to-definition) - * and peek definition features. - */ - export interface DeclarationProvider { - /** - * Provide the declaration of the symbol at the given position and document. - */ - provideDeclaration(model: editor.ITextModel, position: Position, token: CancellationToken): ProviderResult; - } - - /** - * The implementation provider interface defines the contract between extensions and - * the go to implementation feature. - */ - export interface ImplementationProvider { - /** - * Provide the implementation of the symbol at the given position and document. - */ - provideImplementation(model: editor.ITextModel, position: Position, token: CancellationToken): ProviderResult; - } - - /** - * The type definition provider interface defines the contract between extensions and - * the go to type definition feature. - */ - export interface TypeDefinitionProvider { - /** - * Provide the type definition of the symbol at the given position and document. - */ - provideTypeDefinition(model: editor.ITextModel, position: Position, token: CancellationToken): ProviderResult; - } - - /** - * A symbol kind. - */ - export enum SymbolKind { - File = 0, - Module = 1, - Namespace = 2, - Package = 3, - Class = 4, - Method = 5, - Property = 6, - Field = 7, - Constructor = 8, - Enum = 9, - Interface = 10, - Function = 11, - Variable = 12, - Constant = 13, - String = 14, - Number = 15, - Boolean = 16, - Array = 17, - Object = 18, - Key = 19, - Null = 20, - EnumMember = 21, - Struct = 22, - Event = 23, - Operator = 24, - TypeParameter = 25 - } - - export enum SymbolTag { - Deprecated = 1 - } - - export interface DocumentSymbol { - name: string; - detail: string; - kind: SymbolKind; - tags: ReadonlyArray; - containerName?: string; - range: IRange; - selectionRange: IRange; - children?: DocumentSymbol[]; - } - - /** - * The document symbol provider interface defines the contract between extensions and - * the [go to symbol](https://code.visualstudio.com/docs/editor/editingevolved#_go-to-symbol)-feature. - */ - export interface DocumentSymbolProvider { - displayName?: string; - /** - * Provide symbol information for the given document. - */ - provideDocumentSymbols(model: editor.ITextModel, token: CancellationToken): ProviderResult; - } - - export interface TextEdit { - range: IRange; - text: string; - eol?: editor.EndOfLineSequence; - } - - /** - * Interface used to format a model - */ - export interface FormattingOptions { - /** - * Size of a tab in spaces. - */ - tabSize: number; - /** - * Prefer spaces over tabs. - */ - insertSpaces: boolean; - } - - /** - * The document formatting provider interface defines the contract between extensions and - * the formatting-feature. - */ - export interface DocumentFormattingEditProvider { - readonly displayName?: string; - /** - * Provide formatting edits for a whole document. - */ - provideDocumentFormattingEdits(model: editor.ITextModel, options: FormattingOptions, token: CancellationToken): ProviderResult; - } - - /** - * The document formatting provider interface defines the contract between extensions and - * the formatting-feature. - */ - export interface DocumentRangeFormattingEditProvider { - readonly displayName?: string; - /** - * Provide formatting edits for a range in a document. - * - * The given range is a hint and providers can decide to format a smaller - * or larger range. Often this is done by adjusting the start and end - * of the range to full syntax nodes. - */ - provideDocumentRangeFormattingEdits(model: editor.ITextModel, range: Range, options: FormattingOptions, token: CancellationToken): ProviderResult; - provideDocumentRangesFormattingEdits?(model: editor.ITextModel, ranges: Range[], options: FormattingOptions, token: CancellationToken): ProviderResult; - } - - /** - * The document formatting provider interface defines the contract between extensions and - * the formatting-feature. - */ - export interface OnTypeFormattingEditProvider { - autoFormatTriggerCharacters: string[]; - /** - * Provide formatting edits after a character has been typed. - * - * The given position and character should hint to the provider - * what range the position to expand to, like find the matching `{` - * when `}` has been entered. - */ - provideOnTypeFormattingEdits(model: editor.ITextModel, position: Position, ch: string, options: FormattingOptions, token: CancellationToken): ProviderResult; - } - - /** - * A link inside the editor. - */ - export interface ILink { - range: IRange; - url?: Uri | string; - tooltip?: string; - } - - export interface ILinksList { - links: ILink[]; - dispose?(): void; - } - - /** - * A provider of links. - */ - export interface LinkProvider { - provideLinks(model: editor.ITextModel, token: CancellationToken): ProviderResult; - resolveLink?: (link: ILink, token: CancellationToken) => ProviderResult; - } - - /** - * A color in RGBA format. - */ - export interface IColor { - /** - * The red component in the range [0-1]. - */ - readonly red: number; - /** - * The green component in the range [0-1]. - */ - readonly green: number; - /** - * The blue component in the range [0-1]. - */ - readonly blue: number; - /** - * The alpha component in the range [0-1]. - */ - readonly alpha: number; - } - - /** - * String representations for a color - */ - export interface IColorPresentation { - /** - * The label of this color presentation. It will be shown on the color - * picker header. By default this is also the text that is inserted when selecting - * this color presentation. - */ - label: string; - /** - * An {@link TextEdit edit} which is applied to a document when selecting - * this presentation for the color. - */ - textEdit?: TextEdit; - /** - * An optional array of additional {@link TextEdit text edits} that are applied when - * selecting this color presentation. - */ - additionalTextEdits?: TextEdit[]; - } - - /** - * A color range is a range in a text model which represents a color. - */ - export interface IColorInformation { - /** - * The range within the model. - */ - range: IRange; - /** - * The color represented in this range. - */ - color: IColor; - } - - /** - * A provider of colors for editor models. - */ - export interface DocumentColorProvider { - /** - * Provides the color ranges for a specific model. - */ - provideDocumentColors(model: editor.ITextModel, token: CancellationToken): ProviderResult; - /** - * Provide the string representations for a color. - */ - provideColorPresentations(model: editor.ITextModel, colorInfo: IColorInformation, token: CancellationToken): ProviderResult; - } - - export interface SelectionRange { - range: IRange; - } - - export interface SelectionRangeProvider { - /** - * Provide ranges that should be selected from the given position. - */ - provideSelectionRanges(model: editor.ITextModel, positions: Position[], token: CancellationToken): ProviderResult; - } - - export interface FoldingContext { - } - - /** - * A provider of folding ranges for editor models. - */ - export interface FoldingRangeProvider { - /** - * An optional event to signal that the folding ranges from this provider have changed. - */ - onDidChange?: IEvent; - /** - * Provides the folding ranges for a specific model. - */ - provideFoldingRanges(model: editor.ITextModel, context: FoldingContext, token: CancellationToken): ProviderResult; - } - - export interface FoldingRange { - /** - * The one-based start line of the range to fold. The folded area starts after the line's last character. - */ - start: number; - /** - * The one-based end line of the range to fold. The folded area ends with the line's last character. - */ - end: number; - /** - * Describes the {@link FoldingRangeKind Kind} of the folding range such as {@link FoldingRangeKind.Comment Comment} or - * {@link FoldingRangeKind.Region Region}. The kind is used to categorize folding ranges and used by commands - * like 'Fold all comments'. See - * {@link FoldingRangeKind} for an enumeration of standardized kinds. - */ - kind?: FoldingRangeKind; - } - - export class FoldingRangeKind { - value: string; - /** - * Kind for folding range representing a comment. The value of the kind is 'comment'. - */ - static readonly Comment: FoldingRangeKind; - /** - * Kind for folding range representing a import. The value of the kind is 'imports'. - */ - static readonly Imports: FoldingRangeKind; - /** - * Kind for folding range representing regions (for example marked by `#region`, `#endregion`). - * The value of the kind is 'region'. - */ - static readonly Region: FoldingRangeKind; - /** - * Returns a {@link FoldingRangeKind} for the given value. - * - * @param value of the kind. - */ - static fromValue(value: string): FoldingRangeKind; - /** - * Creates a new {@link FoldingRangeKind}. - * - * @param value of the kind. - */ - constructor(value: string); - } - - export interface WorkspaceEditMetadata { - needsConfirmation: boolean; - label: string; - description?: string; - } - - export interface WorkspaceFileEditOptions { - overwrite?: boolean; - ignoreIfNotExists?: boolean; - ignoreIfExists?: boolean; - recursive?: boolean; - copy?: boolean; - folder?: boolean; - skipTrashBin?: boolean; - maxSize?: number; - } - - export interface IWorkspaceFileEdit { - oldResource?: Uri; - newResource?: Uri; - options?: WorkspaceFileEditOptions; - metadata?: WorkspaceEditMetadata; - } - - export interface IWorkspaceTextEdit { - resource: Uri; - textEdit: TextEdit & { - insertAsSnippet?: boolean; - }; - versionId: number | undefined; - metadata?: WorkspaceEditMetadata; - } - - export interface WorkspaceEdit { - edits: Array; - } - - export interface Rejection { - rejectReason?: string; - } - - export interface RenameLocation { - range: IRange; - text: string; - } - - export interface RenameProvider { - provideRenameEdits(model: editor.ITextModel, position: Position, newName: string, token: CancellationToken): ProviderResult; - resolveRenameLocation?(model: editor.ITextModel, position: Position, token: CancellationToken): ProviderResult; - } - - export enum NewSymbolNameTag { - AIGenerated = 1 - } - - export enum NewSymbolNameTriggerKind { - Invoke = 0, - Automatic = 1 - } - - export interface NewSymbolName { - readonly newSymbolName: string; - readonly tags?: readonly NewSymbolNameTag[]; - } - - export interface NewSymbolNamesProvider { - supportsAutomaticNewSymbolNamesTriggerKind?: Promise; - provideNewSymbolNames(model: editor.ITextModel, range: IRange, triggerKind: NewSymbolNameTriggerKind, token: CancellationToken): ProviderResult; - } - - export interface Command { - id: string; - title: string; - tooltip?: string; - arguments?: any[]; - } - - export interface CommentThreadRevealOptions { - preserveFocus: boolean; - focusReply: boolean; - } - - export interface CommentAuthorInformation { - name: string; - iconPath?: UriComponents; - } - - export interface PendingCommentThread { - range: IRange | undefined; - uri: Uri; - uniqueOwner: string; - isReply: boolean; - comment: PendingComment; - } - - export interface PendingComment { - body: string; - cursor: IPosition; - } - - export interface CodeLens { - range: IRange; - id?: string; - command?: Command; - } - - export interface CodeLensList { - lenses: CodeLens[]; - dispose(): void; - } - - export interface CodeLensProvider { - onDidChange?: IEvent; - provideCodeLenses(model: editor.ITextModel, token: CancellationToken): ProviderResult; - resolveCodeLens?(model: editor.ITextModel, codeLens: CodeLens, token: CancellationToken): ProviderResult; - } - - export enum InlayHintKind { - Type = 1, - Parameter = 2 - } - - export interface InlayHintLabelPart { - label: string; - tooltip?: string | IMarkdownString; - command?: Command; - location?: Location; - } - - export interface InlayHint { - label: string | InlayHintLabelPart[]; - tooltip?: string | IMarkdownString; - textEdits?: TextEdit[]; - position: IPosition; - kind?: InlayHintKind; - paddingLeft?: boolean; - paddingRight?: boolean; - } - - export interface InlayHintList { - hints: InlayHint[]; - dispose(): void; - } - - export interface InlayHintsProvider { - displayName?: string; - onDidChangeInlayHints?: IEvent; - provideInlayHints(model: editor.ITextModel, range: Range, token: CancellationToken): ProviderResult; - resolveInlayHint?(hint: InlayHint, token: CancellationToken): ProviderResult; - } - - export interface SemanticTokensLegend { - readonly tokenTypes: string[]; - readonly tokenModifiers: string[]; - } - - export interface SemanticTokens { - readonly resultId?: string; - readonly data: Uint32Array; - } - - export interface SemanticTokensEdit { - readonly start: number; - readonly deleteCount: number; - readonly data?: Uint32Array; - } - - export interface SemanticTokensEdits { - readonly resultId?: string; - readonly edits: SemanticTokensEdit[]; - } - - export interface DocumentSemanticTokensProvider { - onDidChange?: IEvent; - getLegend(): SemanticTokensLegend; - provideDocumentSemanticTokens(model: editor.ITextModel, lastResultId: string | null, token: CancellationToken): ProviderResult; - releaseDocumentSemanticTokens(resultId: string | undefined): void; - } - - export interface DocumentRangeSemanticTokensProvider { - getLegend(): SemanticTokensLegend; - provideDocumentRangeSemanticTokens(model: editor.ITextModel, range: Range, token: CancellationToken): ProviderResult; - } - - export interface DocumentContextItem { - readonly uri: Uri; - readonly version: number; - readonly ranges: IRange[]; - } - - export interface MappedEditsContext { - /** The outer array is sorted by priority - from highest to lowest. The inner arrays contain elements of the same priority. */ - readonly documents: DocumentContextItem[][]; - } - - export interface MappedEditsProvider { - /** - * Provider maps code blocks from the chat into a workspace edit. - * - * @param document The document to provide mapped edits for. - * @param codeBlocks Code blocks that come from an LLM's reply. - * "Apply in Editor" in the panel chat only sends one edit that the user clicks on, but inline chat can send multiple blocks and let the lang server decide what to do with them. - * @param context The context for providing mapped edits. - * @param token A cancellation token. - * @returns A provider result of text edits. - */ - provideMappedEdits(document: editor.ITextModel, codeBlocks: string[], context: MappedEditsContext, token: CancellationToken): Promise; - } - - export interface IInlineEdit { - text: string; - range: IRange; - accepted?: Command; - rejected?: Command; - commands?: Command[]; - } - - export interface IInlineEditContext { - triggerKind: InlineEditTriggerKind; - } - - export enum InlineEditTriggerKind { - Invoke = 0, - Automatic = 1 - } - - export interface InlineEditProvider { - provideInlineEdit(model: editor.ITextModel, context: IInlineEditContext, token: CancellationToken): ProviderResult; - freeInlineEdit(edit: T): void; - } - - export interface ILanguageExtensionPoint { - id: string; - extensions?: string[]; - filenames?: string[]; - filenamePatterns?: string[]; - firstLine?: string; - aliases?: string[]; - mimetypes?: string[]; - configuration?: Uri; - } - /** - * A Monarch language definition - */ - export interface IMonarchLanguage { - /** - * map from string to ILanguageRule[] - */ - tokenizer: { - [name: string]: IMonarchLanguageRule[]; - }; - /** - * is the language case insensitive? - */ - ignoreCase?: boolean; - /** - * is the language unicode-aware? (i.e., /\u{1D306}/) - */ - unicode?: boolean; - /** - * if no match in the tokenizer assign this token class (default 'source') - */ - defaultToken?: string; - /** - * for example [['{','}','delimiter.curly']] - */ - brackets?: IMonarchLanguageBracket[]; - /** - * start symbol in the tokenizer (by default the first entry is used) - */ - start?: string; - /** - * attach this to every token class (by default '.' + name) - */ - tokenPostfix?: string; - /** - * include line feeds (in the form of a \n character) at the end of lines - * Defaults to false - */ - includeLF?: boolean; - /** - * Other keys that can be referred to by the tokenizer. - */ - [key: string]: any; - } - - /** - * A rule is either a regular expression and an action - * shorthands: [reg,act] == { regex: reg, action: act} - * and : [reg,act,nxt] == { regex: reg, action: act{ next: nxt }} - */ - export type IShortMonarchLanguageRule1 = [string | RegExp, IMonarchLanguageAction]; - - export type IShortMonarchLanguageRule2 = [string | RegExp, IMonarchLanguageAction, string]; - - export interface IExpandedMonarchLanguageRule { - /** - * match tokens - */ - regex?: string | RegExp; - /** - * action to take on match - */ - action?: IMonarchLanguageAction; - /** - * or an include rule. include all rules from the included state - */ - include?: string; - } - - export type IMonarchLanguageRule = IShortMonarchLanguageRule1 | IShortMonarchLanguageRule2 | IExpandedMonarchLanguageRule; - - /** - * An action is either an array of actions... - * ... or a case statement with guards... - * ... or a basic action with a token value. - */ - export type IShortMonarchLanguageAction = string; - - export interface IExpandedMonarchLanguageAction { - /** - * array of actions for each parenthesized match group - */ - group?: IMonarchLanguageAction[]; - /** - * map from string to ILanguageAction - */ - cases?: Object; - /** - * token class (ie. css class) (or "@brackets" or "@rematch") - */ - token?: string; - /** - * the next state to push, or "@push", "@pop", "@popall" - */ - next?: string; - /** - * switch to this state - */ - switchTo?: string; - /** - * go back n characters in the stream - */ - goBack?: number; - /** - * @open or @close - */ - bracket?: string; - /** - * switch to embedded language (using the mimetype) or get out using "@pop" - */ - nextEmbedded?: string; - /** - * log a message to the browser console window - */ - log?: string; - } - - export type IMonarchLanguageAction = IShortMonarchLanguageAction | IExpandedMonarchLanguageAction | (IShortMonarchLanguageAction | IExpandedMonarchLanguageAction)[]; - - /** - * This interface can be shortened as an array, ie. ['{','}','delimiter.curly'] - */ - export interface IMonarchLanguageBracket { - /** - * open bracket - */ - open: string; - /** - * closing bracket - */ - close: string; - /** - * token class - */ - token: string; - } - -} - -declare namespace monaco.worker { - - - export interface IMirrorTextModel { - readonly version: number; - } - - export interface IMirrorModel extends IMirrorTextModel { - readonly uri: Uri; - readonly version: number; - getValue(): string; - } - - export interface IWorkerContext { - /** - * A proxy to the main thread host object. - */ - host: H; - /** - * Get all available mirror models in this worker. - */ - getMirrorModels(): IMirrorModel[]; - } - -} - -//dtsv=3 diff --git a/Example/Input/Editor/vs/workbench/contrib/debug/common/debugProtocol.d.ts b/Example/Input/Editor/vs/workbench/contrib/debug/common/debugProtocol.d.ts deleted file mode 100644 index d805b81c..00000000 --- a/Example/Input/Editor/vs/workbench/contrib/debug/common/debugProtocol.d.ts +++ /dev/null @@ -1,2554 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -/** Declaration module describing the VS Code debug protocol. - Auto-generated from json schema. Do not edit manually. -*/ -declare module DebugProtocol { - /** Base class of requests, responses, and events. */ - interface ProtocolMessage { - /** Sequence number of the message (also known as message ID). The `seq` for the first message sent by a client or debug adapter is 1, and for each subsequent message is 1 greater than the previous message sent by that actor. `seq` can be used to order requests, responses, and events, and to associate requests with their corresponding responses. For protocol messages of type `request` the sequence number can be used to cancel the request. */ - seq: number; - /** Message type. - Values: 'request', 'response', 'event', etc. - */ - type: "request" | "response" | "event" | string; - } - - /** A client or debug adapter initiated request. */ - interface Request extends ProtocolMessage { - // type: 'request'; - /** The command to execute. */ - command: string; - /** Object containing arguments for the command. */ - arguments?: any; - } - - /** A debug adapter initiated event. */ - interface Event extends ProtocolMessage { - // type: 'event'; - /** Type of event. */ - event: string; - /** Event-specific information. */ - body?: any; - } - - /** Response for a request. */ - interface Response extends ProtocolMessage { - // type: 'response'; - /** Sequence number of the corresponding request. */ - request_seq: number; - /** Outcome of the request. - If true, the request was successful and the `body` attribute may contain the result of the request. - If the value is false, the attribute `message` contains the error in short form and the `body` may contain additional information (see `ErrorResponse.body.error`). - */ - success: boolean; - /** The command requested. */ - command: string; - /** Contains the raw error in short form if `success` is false. - This raw error might be interpreted by the client and is not shown in the UI. - Some predefined values exist. - Values: - 'cancelled': the request was cancelled. - 'notStopped': the request may be retried once the adapter is in a 'stopped' state. - etc. - */ - message?: "cancelled" | "notStopped" | string; - /** Contains request result if success is true and error details if success is false. */ - body?: any; - } - - /** On error (whenever `success` is false), the body can provide more details. */ - interface ErrorResponse extends Response { - body: { - /** A structured error message. */ - error?: Message; - }; - } - - /** Cancel request; value of command field is 'cancel'. - The `cancel` request is used by the client in two situations: - - to indicate that it is no longer interested in the result produced by a specific request issued earlier - - to cancel a progress sequence. - Clients should only call this request if the corresponding capability `supportsCancelRequest` is true. - This request has a hint characteristic: a debug adapter can only be expected to make a 'best effort' in honoring this request but there are no guarantees. - The `cancel` request may return an error if it could not cancel an operation but a client should refrain from presenting this error to end users. - The request that got cancelled still needs to send a response back. This can either be a normal result (`success` attribute true) or an error response (`success` attribute false and the `message` set to `cancelled`). - Returning partial results from a cancelled request is possible but please note that a client has no generic way for detecting that a response is partial or not. - The progress that got cancelled still needs to send a `progressEnd` event back. - A client should not assume that progress just got cancelled after sending the `cancel` request. - */ - interface CancelRequest extends Request { - // command: 'cancel'; - arguments?: CancelArguments; - } - - /** Arguments for `cancel` request. */ - interface CancelArguments { - /** The ID (attribute `seq`) of the request to cancel. If missing no request is cancelled. - Both a `requestId` and a `progressId` can be specified in one request. - */ - requestId?: number; - /** The ID (attribute `progressId`) of the progress to cancel. If missing no progress is cancelled. - Both a `requestId` and a `progressId` can be specified in one request. - */ - progressId?: string; - } - - /** Response to `cancel` request. This is just an acknowledgement, so no body field is required. */ - interface CancelResponse extends Response {} - - /** Event message for 'initialized' event type. - This event indicates that the debug adapter is ready to accept configuration requests (e.g. `setBreakpoints`, `setExceptionBreakpoints`). - A debug adapter is expected to send this event when it is ready to accept configuration requests (but not before the `initialize` request has finished). - The sequence of events/requests is as follows: - - adapters sends `initialized` event (after the `initialize` request has returned) - - client sends zero or more `setBreakpoints` requests - - client sends one `setFunctionBreakpoints` request (if corresponding capability `supportsFunctionBreakpoints` is true) - - client sends a `setExceptionBreakpoints` request if one or more `exceptionBreakpointFilters` have been defined (or if `supportsConfigurationDoneRequest` is not true) - - client sends other future configuration requests - - client sends one `configurationDone` request to indicate the end of the configuration. - */ - interface InitializedEvent extends Event { - // event: 'initialized'; - } - - /** Event message for 'stopped' event type. - The event indicates that the execution of the debuggee has stopped due to some condition. - This can be caused by a breakpoint previously set, a stepping request has completed, by executing a debugger statement etc. - */ - interface StoppedEvent extends Event { - // event: 'stopped'; - body: { - /** The reason for the event. - For backward compatibility this string is shown in the UI if the `description` attribute is missing (but it must not be translated). - Values: 'step', 'breakpoint', 'exception', 'pause', 'entry', 'goto', 'function breakpoint', 'data breakpoint', 'instruction breakpoint', etc. - */ - reason: - | "step" - | "breakpoint" - | "exception" - | "pause" - | "entry" - | "goto" - | "function breakpoint" - | "data breakpoint" - | "instruction breakpoint" - | string; - /** The full reason for the event, e.g. 'Paused on exception'. This string is shown in the UI as is and can be translated. */ - description?: string; - /** The thread which was stopped. */ - threadId?: number; - /** A value of true hints to the client that this event should not change the focus. */ - preserveFocusHint?: boolean; - /** Additional information. E.g. if reason is `exception`, text contains the exception name. This string is shown in the UI. */ - text?: string; - /** If `allThreadsStopped` is true, a debug adapter can announce that all threads have stopped. - - The client should use this information to enable that all threads can be expanded to access their stacktraces. - - If the attribute is missing or false, only the thread with the given `threadId` can be expanded. - */ - allThreadsStopped?: boolean; - /** Ids of the breakpoints that triggered the event. In most cases there is only a single breakpoint but here are some examples for multiple breakpoints: - - Different types of breakpoints map to the same location. - - Multiple source breakpoints get collapsed to the same instruction by the compiler/runtime. - - Multiple function breakpoints with different function names map to the same location. - */ - hitBreakpointIds?: number[]; - }; - } - - /** Event message for 'continued' event type. - The event indicates that the execution of the debuggee has continued. - Please note: a debug adapter is not expected to send this event in response to a request that implies that execution continues, e.g. `launch` or `continue`. - It is only necessary to send a `continued` event if there was no previous request that implied this. - */ - interface ContinuedEvent extends Event { - // event: 'continued'; - body: { - /** The thread which was continued. */ - threadId: number; - /** If `allThreadsContinued` is true, a debug adapter can announce that all threads have continued. */ - allThreadsContinued?: boolean; - }; - } - - /** Event message for 'exited' event type. - The event indicates that the debuggee has exited and returns its exit code. - */ - interface ExitedEvent extends Event { - // event: 'exited'; - body: { - /** The exit code returned from the debuggee. */ - exitCode: number; - }; - } - - /** Event message for 'terminated' event type. - The event indicates that debugging of the debuggee has terminated. This does **not** mean that the debuggee itself has exited. - */ - interface TerminatedEvent extends Event { - // event: 'terminated'; - body?: { - /** A debug adapter may set `restart` to true (or to an arbitrary object) to request that the client restarts the session. - The value is not interpreted by the client and passed unmodified as an attribute `__restart` to the `launch` and `attach` requests. - */ - restart?: any; - }; - } - - /** Event message for 'thread' event type. - The event indicates that a thread has started or exited. - */ - interface ThreadEvent extends Event { - // event: 'thread'; - body: { - /** The reason for the event. - Values: 'started', 'exited', etc. - */ - reason: "started" | "exited" | string; - /** The identifier of the thread. */ - threadId: number; - }; - } - - /** Event message for 'output' event type. - The event indicates that the target has produced some output. - */ - interface OutputEvent extends Event { - // event: 'output'; - body: { - /** The output category. If not specified or if the category is not understood by the client, `console` is assumed. - Values: - 'console': Show the output in the client's default message UI, e.g. a 'debug console'. This category should only be used for informational output from the debugger (as opposed to the debuggee). - 'important': A hint for the client to show the output in the client's UI for important and highly visible information, e.g. as a popup notification. This category should only be used for important messages from the debugger (as opposed to the debuggee). Since this category value is a hint, clients might ignore the hint and assume the `console` category. - 'stdout': Show the output as normal program output from the debuggee. - 'stderr': Show the output as error program output from the debuggee. - 'telemetry': Send the output to telemetry instead of showing it to the user. - etc. - */ - category?: - | "console" - | "important" - | "stdout" - | "stderr" - | "telemetry" - | string; - /** The output to report. - - ANSI escape sequences may be used to inflience text color and styling if `supportsANSIStyling` is present in both the adapter's `Capabilities` and the client's `InitializeRequestArguments`. A client may strip any unrecognized ANSI sequences. - - If the `supportsANSIStyling` capabilities are not both true, then the client should display the output literally. - */ - output: string; - /** Support for keeping an output log organized by grouping related messages. - 'start': Start a new group in expanded mode. Subsequent output events are members of the group and should be shown indented. - The `output` attribute becomes the name of the group and is not indented. - 'startCollapsed': Start a new group in collapsed mode. Subsequent output events are members of the group and should be shown indented (as soon as the group is expanded). - The `output` attribute becomes the name of the group and is not indented. - 'end': End the current group and decrease the indentation of subsequent output events. - A non-empty `output` attribute is shown as the unindented end of the group. - */ - group?: "start" | "startCollapsed" | "end"; - /** If an attribute `variablesReference` exists and its value is > 0, the output contains objects which can be retrieved by passing `variablesReference` to the `variables` request as long as execution remains suspended. See 'Lifetime of Object References' in the Overview section for details. */ - variablesReference?: number; - /** The source location where the output was produced. */ - source?: Source; - /** The source location's line where the output was produced. */ - line?: number; - /** The position in `line` where the output was produced. It is measured in UTF-16 code units and the client capability `columnsStartAt1` determines whether it is 0- or 1-based. */ - column?: number; - /** Additional data to report. For the `telemetry` category the data is sent to telemetry, for the other categories the data is shown in JSON format. */ - data?: any; - /** A reference that allows the client to request the location where the new value is declared. For example, if the logged value is function pointer, the adapter may be able to look up the function's location. This should be present only if the adapter is likely to be able to resolve the location. - - This reference shares the same lifetime as the `variablesReference`. See 'Lifetime of Object References' in the Overview section for details. - */ - locationReference?: number; - }; - } - - /** Event message for 'breakpoint' event type. - The event indicates that some information about a breakpoint has changed. - */ - interface BreakpointEvent extends Event { - // event: 'breakpoint'; - body: { - /** The reason for the event. - Values: 'changed', 'new', 'removed', etc. - */ - reason: "changed" | "new" | "removed" | string; - /** The `id` attribute is used to find the target breakpoint, the other attributes are used as the new values. */ - breakpoint: Breakpoint; - }; - } - - /** Event message for 'module' event type. - The event indicates that some information about a module has changed. - */ - interface ModuleEvent extends Event { - // event: 'module'; - body: { - /** The reason for the event. */ - reason: "new" | "changed" | "removed"; - /** The new, changed, or removed module. In case of `removed` only the module id is used. */ - module: Module; - }; - } - - /** Event message for 'loadedSource' event type. - The event indicates that some source has been added, changed, or removed from the set of all loaded sources. - */ - interface LoadedSourceEvent extends Event { - // event: 'loadedSource'; - body: { - /** The reason for the event. */ - reason: "new" | "changed" | "removed"; - /** The new, changed, or removed source. */ - source: Source; - }; - } - - /** Event message for 'process' event type. - The event indicates that the debugger has begun debugging a new process. Either one that it has launched, or one that it has attached to. - */ - interface ProcessEvent extends Event { - // event: 'process'; - body: { - /** The logical name of the process. This is usually the full path to process's executable file. Example: /home/example/myproj/program.js. */ - name: string; - /** The process ID of the debugged process, as assigned by the operating system. This property should be omitted for logical processes that do not map to operating system processes on the machine. */ - systemProcessId?: number; - /** If true, the process is running on the same computer as the debug adapter. */ - isLocalProcess?: boolean; - /** Describes how the debug engine started debugging this process. - 'launch': Process was launched under the debugger. - 'attach': Debugger attached to an existing process. - 'attachForSuspendedLaunch': A project launcher component has launched a new process in a suspended state and then asked the debugger to attach. - */ - startMethod?: "launch" | "attach" | "attachForSuspendedLaunch"; - /** The size of a pointer or address for this process, in bits. This value may be used by clients when formatting addresses for display. */ - pointerSize?: number; - }; - } - - /** Event message for 'capabilities' event type. - The event indicates that one or more capabilities have changed. - Since the capabilities are dependent on the client and its UI, it might not be possible to change that at random times (or too late). - Consequently this event has a hint characteristic: a client can only be expected to make a 'best effort' in honoring individual capabilities but there are no guarantees. - Only changed capabilities need to be included, all other capabilities keep their values. - */ - interface CapabilitiesEvent extends Event { - // event: 'capabilities'; - body: { - /** The set of updated capabilities. */ - capabilities: Capabilities; - }; - } - - /** Event message for 'progressStart' event type. - The event signals that a long running operation is about to start and provides additional information for the client to set up a corresponding progress and cancellation UI. - The client is free to delay the showing of the UI in order to reduce flicker. - This event should only be sent if the corresponding capability `supportsProgressReporting` is true. - */ - interface ProgressStartEvent extends Event { - // event: 'progressStart'; - body: { - /** An ID that can be used in subsequent `progressUpdate` and `progressEnd` events to make them refer to the same progress reporting. - IDs must be unique within a debug session. - */ - progressId: string; - /** Short title of the progress reporting. Shown in the UI to describe the long running operation. */ - title: string; - /** The request ID that this progress report is related to. If specified a debug adapter is expected to emit progress events for the long running request until the request has been either completed or cancelled. - If the request ID is omitted, the progress report is assumed to be related to some general activity of the debug adapter. - */ - requestId?: number; - /** If true, the request that reports progress may be cancelled with a `cancel` request. - So this property basically controls whether the client should use UX that supports cancellation. - Clients that don't support cancellation are allowed to ignore the setting. - */ - cancellable?: boolean; - /** More detailed progress message. */ - message?: string; - /** Progress percentage to display (value range: 0 to 100). If omitted no percentage is shown. */ - percentage?: number; - }; - } - - /** Event message for 'progressUpdate' event type. - The event signals that the progress reporting needs to be updated with a new message and/or percentage. - The client does not have to update the UI immediately, but the clients needs to keep track of the message and/or percentage values. - This event should only be sent if the corresponding capability `supportsProgressReporting` is true. - */ - interface ProgressUpdateEvent extends Event { - // event: 'progressUpdate'; - body: { - /** The ID that was introduced in the initial `progressStart` event. */ - progressId: string; - /** More detailed progress message. If omitted, the previous message (if any) is used. */ - message?: string; - /** Progress percentage to display (value range: 0 to 100). If omitted no percentage is shown. */ - percentage?: number; - }; - } - - /** Event message for 'progressEnd' event type. - The event signals the end of the progress reporting with a final message. - This event should only be sent if the corresponding capability `supportsProgressReporting` is true. - */ - interface ProgressEndEvent extends Event { - // event: 'progressEnd'; - body: { - /** The ID that was introduced in the initial `ProgressStartEvent`. */ - progressId: string; - /** More detailed progress message. If omitted, the previous message (if any) is used. */ - message?: string; - }; - } - - /** Event message for 'invalidated' event type. - This event signals that some state in the debug adapter has changed and requires that the client needs to re-render the data snapshot previously requested. - Debug adapters do not have to emit this event for runtime changes like stopped or thread events because in that case the client refetches the new state anyway. But the event can be used for example to refresh the UI after rendering formatting has changed in the debug adapter. - This event should only be sent if the corresponding capability `supportsInvalidatedEvent` is true. - */ - interface InvalidatedEvent extends Event { - // event: 'invalidated'; - body: { - /** Set of logical areas that got invalidated. This property has a hint characteristic: a client can only be expected to make a 'best effort' in honoring the areas but there are no guarantees. If this property is missing, empty, or if values are not understood, the client should assume a single value `all`. */ - areas?: InvalidatedAreas[]; - /** If specified, the client only needs to refetch data related to this thread. */ - threadId?: number; - /** If specified, the client only needs to refetch data related to this stack frame (and the `threadId` is ignored). */ - stackFrameId?: number; - }; - } - - /** Event message for 'memory' event type. - This event indicates that some memory range has been updated. It should only be sent if the corresponding capability `supportsMemoryEvent` is true. - Clients typically react to the event by re-issuing a `readMemory` request if they show the memory identified by the `memoryReference` and if the updated memory range overlaps the displayed range. Clients should not make assumptions how individual memory references relate to each other, so they should not assume that they are part of a single continuous address range and might overlap. - Debug adapters can use this event to indicate that the contents of a memory range has changed due to some other request like `setVariable` or `setExpression`. Debug adapters are not expected to emit this event for each and every memory change of a running program, because that information is typically not available from debuggers and it would flood clients with too many events. - */ - interface MemoryEvent extends Event { - // event: 'memory'; - body: { - /** Memory reference of a memory range that has been updated. */ - memoryReference: string; - /** Starting offset in bytes where memory has been updated. Can be negative. */ - offset: number; - /** Number of bytes updated. */ - count: number; - }; - } - - /** RunInTerminal request; value of command field is 'runInTerminal'. - This request is sent from the debug adapter to the client to run a command in a terminal. - This is typically used to launch the debuggee in a terminal provided by the client. - This request should only be called if the corresponding client capability `supportsRunInTerminalRequest` is true. - Client implementations of `runInTerminal` are free to run the command however they choose including issuing the command to a command line interpreter (aka 'shell'). Argument strings passed to the `runInTerminal` request must arrive verbatim in the command to be run. As a consequence, clients which use a shell are responsible for escaping any special shell characters in the argument strings to prevent them from being interpreted (and modified) by the shell. - Some users may wish to take advantage of shell processing in the argument strings. For clients which implement `runInTerminal` using an intermediary shell, the `argsCanBeInterpretedByShell` property can be set to true. In this case the client is requested not to escape any special shell characters in the argument strings. - */ - interface RunInTerminalRequest extends Request { - // command: 'runInTerminal'; - arguments: RunInTerminalRequestArguments; - } - - /** Arguments for `runInTerminal` request. */ - interface RunInTerminalRequestArguments { - /** What kind of terminal to launch. Defaults to `integrated` if not specified. */ - kind?: "integrated" | "external"; - /** Title of the terminal. */ - title?: string; - /** Working directory for the command. For non-empty, valid paths this typically results in execution of a change directory command. */ - cwd: string; - /** List of arguments. The first argument is the command to run. */ - args: string[]; - /** Environment key-value pairs that are added to or removed from the default environment. */ - env?: { [key: string]: string | null }; - /** This property should only be set if the corresponding capability `supportsArgsCanBeInterpretedByShell` is true. If the client uses an intermediary shell to launch the application, then the client must not attempt to escape characters with special meanings for the shell. The user is fully responsible for escaping as needed and that arguments using special characters may not be portable across shells. */ - argsCanBeInterpretedByShell?: boolean; - } - - /** Response to `runInTerminal` request. */ - interface RunInTerminalResponse extends Response { - body: { - /** The process ID. The value should be less than or equal to 2147483647 (2^31-1). */ - processId?: number; - /** The process ID of the terminal shell. The value should be less than or equal to 2147483647 (2^31-1). */ - shellProcessId?: number; - }; - } - - /** StartDebugging request; value of command field is 'startDebugging'. - This request is sent from the debug adapter to the client to start a new debug session of the same type as the caller. - This request should only be sent if the corresponding client capability `supportsStartDebuggingRequest` is true. - A client implementation of `startDebugging` should start a new debug session (of the same type as the caller) in the same way that the caller's session was started. If the client supports hierarchical debug sessions, the newly created session can be treated as a child of the caller session. - */ - interface StartDebuggingRequest extends Request { - // command: 'startDebugging'; - arguments: StartDebuggingRequestArguments; - } - - /** Arguments for `startDebugging` request. */ - interface StartDebuggingRequestArguments { - /** Arguments passed to the new debug session. The arguments must only contain properties understood by the `launch` or `attach` requests of the debug adapter and they must not contain any client-specific properties (e.g. `type`) or client-specific features (e.g. substitutable 'variables'). */ - configuration: { [key: string]: any }; - /** Indicates whether the new debug session should be started with a `launch` or `attach` request. */ - request: "launch" | "attach"; - } - - /** Response to `startDebugging` request. This is just an acknowledgement, so no body field is required. */ - interface StartDebuggingResponse extends Response {} - - /** Initialize request; value of command field is 'initialize'. - The `initialize` request is sent as the first request from the client to the debug adapter in order to configure it with client capabilities and to retrieve capabilities from the debug adapter. - Until the debug adapter has responded with an `initialize` response, the client must not send any additional requests or events to the debug adapter. - In addition the debug adapter is not allowed to send any requests or events to the client until it has responded with an `initialize` response. - The `initialize` request may only be sent once. - */ - interface InitializeRequest extends Request { - // command: 'initialize'; - arguments: InitializeRequestArguments; - } - - /** Arguments for `initialize` request. */ - interface InitializeRequestArguments { - /** The ID of the client using this adapter. */ - clientID?: string; - /** The human-readable name of the client using this adapter. */ - clientName?: string; - /** The ID of the debug adapter. */ - adapterID: string; - /** The ISO-639 locale of the client using this adapter, e.g. en-US or de-CH. */ - locale?: string; - /** If true all line numbers are 1-based (default). */ - linesStartAt1?: boolean; - /** If true all column numbers are 1-based (default). */ - columnsStartAt1?: boolean; - /** Determines in what format paths are specified. The default is `path`, which is the native format. - Values: 'path', 'uri', etc. - */ - pathFormat?: "path" | "uri" | string; - /** Client supports the `type` attribute for variables. */ - supportsVariableType?: boolean; - /** Client supports the paging of variables. */ - supportsVariablePaging?: boolean; - /** Client supports the `runInTerminal` request. */ - supportsRunInTerminalRequest?: boolean; - /** Client supports memory references. */ - supportsMemoryReferences?: boolean; - /** Client supports progress reporting. */ - supportsProgressReporting?: boolean; - /** Client supports the `invalidated` event. */ - supportsInvalidatedEvent?: boolean; - /** Client supports the `memory` event. */ - supportsMemoryEvent?: boolean; - /** Client supports the `argsCanBeInterpretedByShell` attribute on the `runInTerminal` request. */ - supportsArgsCanBeInterpretedByShell?: boolean; - /** Client supports the `startDebugging` request. */ - supportsStartDebuggingRequest?: boolean; - /** The client will interpret ANSI escape sequences in the display of `OutputEvent.output` and `Variable.value` fields when `Capabilities.supportsANSIStyling` is also enabled. */ - supportsANSIStyling?: boolean; - } - - /** Response to `initialize` request. */ - interface InitializeResponse extends Response { - /** The capabilities of this debug adapter. */ - body?: Capabilities; - } - - /** ConfigurationDone request; value of command field is 'configurationDone'. - This request indicates that the client has finished initialization of the debug adapter. - So it is the last request in the sequence of configuration requests (which was started by the `initialized` event). - Clients should only call this request if the corresponding capability `supportsConfigurationDoneRequest` is true. - */ - interface ConfigurationDoneRequest extends Request { - // command: 'configurationDone'; - arguments?: ConfigurationDoneArguments; - } - - /** Arguments for `configurationDone` request. */ - interface ConfigurationDoneArguments {} - - /** Response to `configurationDone` request. This is just an acknowledgement, so no body field is required. */ - interface ConfigurationDoneResponse extends Response {} - - /** Launch request; value of command field is 'launch'. - This launch request is sent from the client to the debug adapter to start the debuggee with or without debugging (if `noDebug` is true). - Since launching is debugger/runtime specific, the arguments for this request are not part of this specification. - */ - interface LaunchRequest extends Request { - // command: 'launch'; - arguments: LaunchRequestArguments; - } - - /** Arguments for `launch` request. Additional attributes are implementation specific. */ - interface LaunchRequestArguments { - /** If true, the launch request should launch the program without enabling debugging. */ - noDebug?: boolean; - /** Arbitrary data from the previous, restarted session. - The data is sent as the `restart` attribute of the `terminated` event. - The client should leave the data intact. - */ - __restart?: any; - } - - /** Response to `launch` request. This is just an acknowledgement, so no body field is required. */ - interface LaunchResponse extends Response {} - - /** Attach request; value of command field is 'attach'. - The `attach` request is sent from the client to the debug adapter to attach to a debuggee that is already running. - Since attaching is debugger/runtime specific, the arguments for this request are not part of this specification. - */ - interface AttachRequest extends Request { - // command: 'attach'; - arguments: AttachRequestArguments; - } - - /** Arguments for `attach` request. Additional attributes are implementation specific. */ - interface AttachRequestArguments { - /** Arbitrary data from the previous, restarted session. - The data is sent as the `restart` attribute of the `terminated` event. - The client should leave the data intact. - */ - __restart?: any; - } - - /** Response to `attach` request. This is just an acknowledgement, so no body field is required. */ - interface AttachResponse extends Response {} - - /** Restart request; value of command field is 'restart'. - Restarts a debug session. Clients should only call this request if the corresponding capability `supportsRestartRequest` is true. - If the capability is missing or has the value false, a typical client emulates `restart` by terminating the debug adapter first and then launching it anew. - */ - interface RestartRequest extends Request { - // command: 'restart'; - arguments?: RestartArguments; - } - - /** Arguments for `restart` request. */ - interface RestartArguments { - /** The latest version of the `launch` or `attach` configuration. */ - arguments?: LaunchRequestArguments | AttachRequestArguments; - } - - /** Response to `restart` request. This is just an acknowledgement, so no body field is required. */ - interface RestartResponse extends Response {} - - /** Disconnect request; value of command field is 'disconnect'. - The `disconnect` request asks the debug adapter to disconnect from the debuggee (thus ending the debug session) and then to shut down itself (the debug adapter). - In addition, the debug adapter must terminate the debuggee if it was started with the `launch` request. If an `attach` request was used to connect to the debuggee, then the debug adapter must not terminate the debuggee. - This implicit behavior of when to terminate the debuggee can be overridden with the `terminateDebuggee` argument (which is only supported by a debug adapter if the corresponding capability `supportTerminateDebuggee` is true). - */ - interface DisconnectRequest extends Request { - // command: 'disconnect'; - arguments?: DisconnectArguments; - } - - /** Arguments for `disconnect` request. */ - interface DisconnectArguments { - /** A value of true indicates that this `disconnect` request is part of a restart sequence. */ - restart?: boolean; - /** Indicates whether the debuggee should be terminated when the debugger is disconnected. - If unspecified, the debug adapter is free to do whatever it thinks is best. - The attribute is only honored by a debug adapter if the corresponding capability `supportTerminateDebuggee` is true. - */ - terminateDebuggee?: boolean; - /** Indicates whether the debuggee should stay suspended when the debugger is disconnected. - If unspecified, the debuggee should resume execution. - The attribute is only honored by a debug adapter if the corresponding capability `supportSuspendDebuggee` is true. - */ - suspendDebuggee?: boolean; - } - - /** Response to `disconnect` request. This is just an acknowledgement, so no body field is required. */ - interface DisconnectResponse extends Response {} - - /** Terminate request; value of command field is 'terminate'. - The `terminate` request is sent from the client to the debug adapter in order to shut down the debuggee gracefully. Clients should only call this request if the capability `supportsTerminateRequest` is true. - Typically a debug adapter implements `terminate` by sending a software signal which the debuggee intercepts in order to clean things up properly before terminating itself. - Please note that this request does not directly affect the state of the debug session: if the debuggee decides to veto the graceful shutdown for any reason by not terminating itself, then the debug session just continues. - Clients can surface the `terminate` request as an explicit command or they can integrate it into a two stage Stop command that first sends `terminate` to request a graceful shutdown, and if that fails uses `disconnect` for a forceful shutdown. - */ - interface TerminateRequest extends Request { - // command: 'terminate'; - arguments?: TerminateArguments; - } - - /** Arguments for `terminate` request. */ - interface TerminateArguments { - /** A value of true indicates that this `terminate` request is part of a restart sequence. */ - restart?: boolean; - } - - /** Response to `terminate` request. This is just an acknowledgement, so no body field is required. */ - interface TerminateResponse extends Response {} - - /** BreakpointLocations request; value of command field is 'breakpointLocations'. - The `breakpointLocations` request returns all possible locations for source breakpoints in a given range. - Clients should only call this request if the corresponding capability `supportsBreakpointLocationsRequest` is true. - */ - interface BreakpointLocationsRequest extends Request { - // command: 'breakpointLocations'; - arguments?: BreakpointLocationsArguments; - } - - /** Arguments for `breakpointLocations` request. */ - interface BreakpointLocationsArguments { - /** The source location of the breakpoints; either `source.path` or `source.sourceReference` must be specified. */ - source: Source; - /** Start line of range to search possible breakpoint locations in. If only the line is specified, the request returns all possible locations in that line. */ - line: number; - /** Start position within `line` to search possible breakpoint locations in. It is measured in UTF-16 code units and the client capability `columnsStartAt1` determines whether it is 0- or 1-based. If no column is given, the first position in the start line is assumed. */ - column?: number; - /** End line of range to search possible breakpoint locations in. If no end line is given, then the end line is assumed to be the start line. */ - endLine?: number; - /** End position within `endLine` to search possible breakpoint locations in. It is measured in UTF-16 code units and the client capability `columnsStartAt1` determines whether it is 0- or 1-based. If no end column is given, the last position in the end line is assumed. */ - endColumn?: number; - } - - /** Response to `breakpointLocations` request. - Contains possible locations for source breakpoints. - */ - interface BreakpointLocationsResponse extends Response { - body: { - /** Sorted set of possible breakpoint locations. */ - breakpoints: BreakpointLocation[]; - }; - } - - /** SetBreakpoints request; value of command field is 'setBreakpoints'. - Sets multiple breakpoints for a single source and clears all previous breakpoints in that source. - To clear all breakpoint for a source, specify an empty array. - When a breakpoint is hit, a `stopped` event (with reason `breakpoint`) is generated. - */ - interface SetBreakpointsRequest extends Request { - // command: 'setBreakpoints'; - arguments: SetBreakpointsArguments; - } - - /** Arguments for `setBreakpoints` request. */ - interface SetBreakpointsArguments { - /** The source location of the breakpoints; either `source.path` or `source.sourceReference` must be specified. */ - source: Source; - /** The code locations of the breakpoints. */ - breakpoints?: SourceBreakpoint[]; - /** Deprecated: The code locations of the breakpoints. */ - lines?: number[]; - /** A value of true indicates that the underlying source has been modified which results in new breakpoint locations. */ - sourceModified?: boolean; - } - - /** Response to `setBreakpoints` request. - Returned is information about each breakpoint created by this request. - This includes the actual code location and whether the breakpoint could be verified. - The breakpoints returned are in the same order as the elements of the `breakpoints` - (or the deprecated `lines`) array in the arguments. - */ - interface SetBreakpointsResponse extends Response { - body: { - /** Information about the breakpoints. - The array elements are in the same order as the elements of the `breakpoints` (or the deprecated `lines`) array in the arguments. - */ - breakpoints: Breakpoint[]; - }; - } - - /** SetFunctionBreakpoints request; value of command field is 'setFunctionBreakpoints'. - Replaces all existing function breakpoints with new function breakpoints. - To clear all function breakpoints, specify an empty array. - When a function breakpoint is hit, a `stopped` event (with reason `function breakpoint`) is generated. - Clients should only call this request if the corresponding capability `supportsFunctionBreakpoints` is true. - */ - interface SetFunctionBreakpointsRequest extends Request { - // command: 'setFunctionBreakpoints'; - arguments: SetFunctionBreakpointsArguments; - } - - /** Arguments for `setFunctionBreakpoints` request. */ - interface SetFunctionBreakpointsArguments { - /** The function names of the breakpoints. */ - breakpoints: FunctionBreakpoint[]; - } - - /** Response to `setFunctionBreakpoints` request. - Returned is information about each breakpoint created by this request. - */ - interface SetFunctionBreakpointsResponse extends Response { - body: { - /** Information about the breakpoints. The array elements correspond to the elements of the `breakpoints` array. */ - breakpoints: Breakpoint[]; - }; - } - - /** SetExceptionBreakpoints request; value of command field is 'setExceptionBreakpoints'. - The request configures the debugger's response to thrown exceptions. Each of the `filters`, `filterOptions`, and `exceptionOptions` in the request are independent configurations to a debug adapter indicating a kind of exception to catch. An exception thrown in a program should result in a `stopped` event from the debug adapter (with reason `exception`) if any of the configured filters match. - Clients should only call this request if the corresponding capability `exceptionBreakpointFilters` returns one or more filters. - */ - interface SetExceptionBreakpointsRequest extends Request { - // command: 'setExceptionBreakpoints'; - arguments: SetExceptionBreakpointsArguments; - } - - /** Arguments for `setExceptionBreakpoints` request. */ - interface SetExceptionBreakpointsArguments { - /** Set of exception filters specified by their ID. The set of all possible exception filters is defined by the `exceptionBreakpointFilters` capability. The `filter` and `filterOptions` sets are additive. */ - filters: string[]; - /** Set of exception filters and their options. The set of all possible exception filters is defined by the `exceptionBreakpointFilters` capability. This attribute is only honored by a debug adapter if the corresponding capability `supportsExceptionFilterOptions` is true. The `filter` and `filterOptions` sets are additive. */ - filterOptions?: ExceptionFilterOptions[]; - /** Configuration options for selected exceptions. - The attribute is only honored by a debug adapter if the corresponding capability `supportsExceptionOptions` is true. - */ - exceptionOptions?: ExceptionOptions[]; - } - - /** Response to `setExceptionBreakpoints` request. - The response contains an array of `Breakpoint` objects with information about each exception breakpoint or filter. The `Breakpoint` objects are in the same order as the elements of the `filters`, `filterOptions`, `exceptionOptions` arrays given as arguments. If both `filters` and `filterOptions` are given, the returned array must start with `filters` information first, followed by `filterOptions` information. - The `verified` property of a `Breakpoint` object signals whether the exception breakpoint or filter could be successfully created and whether the condition is valid. In case of an error the `message` property explains the problem. The `id` property can be used to introduce a unique ID for the exception breakpoint or filter so that it can be updated subsequently by sending breakpoint events. - For backward compatibility both the `breakpoints` array and the enclosing `body` are optional. If these elements are missing a client is not able to show problems for individual exception breakpoints or filters. - */ - interface SetExceptionBreakpointsResponse extends Response { - body?: { - /** Information about the exception breakpoints or filters. - The breakpoints returned are in the same order as the elements of the `filters`, `filterOptions`, `exceptionOptions` arrays in the arguments. If both `filters` and `filterOptions` are given, the returned array must start with `filters` information first, followed by `filterOptions` information. - */ - breakpoints?: Breakpoint[]; - }; - } - - /** DataBreakpointInfo request; value of command field is 'dataBreakpointInfo'. - Obtains information on a possible data breakpoint that could be set on an expression or variable. - Clients should only call this request if the corresponding capability `supportsDataBreakpoints` is true. - */ - interface DataBreakpointInfoRequest extends Request { - // command: 'dataBreakpointInfo'; - arguments: DataBreakpointInfoArguments; - } - - /** Arguments for `dataBreakpointInfo` request. */ - interface DataBreakpointInfoArguments { - /** Reference to the variable container if the data breakpoint is requested for a child of the container. The `variablesReference` must have been obtained in the current suspended state. See 'Lifetime of Object References' in the Overview section for details. */ - variablesReference?: number; - /** The name of the variable's child to obtain data breakpoint information for. - If `variablesReference` isn't specified, this can be an expression, or an address if `asAddress` is also true. - */ - name: string; - /** When `name` is an expression, evaluate it in the scope of this stack frame. If not specified, the expression is evaluated in the global scope. When `variablesReference` is specified, this property has no effect. */ - frameId?: number; - /** If specified, a debug adapter should return information for the range of memory extending `bytes` number of bytes from the address or variable specified by `name`. Breakpoints set using the resulting data ID should pause on data access anywhere within that range. - - Clients may set this property only if the `supportsDataBreakpointBytes` capability is true. - */ - bytes?: number; - /** If `true`, the `name` is a memory address and the debugger should interpret it as a decimal value, or hex value if it is prefixed with `0x`. - - Clients may set this property only if the `supportsDataBreakpointBytes` - capability is true. - */ - asAddress?: boolean; - /** The mode of the desired breakpoint. If defined, this must be one of the `breakpointModes` the debug adapter advertised in its `Capabilities`. */ - mode?: string; - } - - /** Response to `dataBreakpointInfo` request. */ - interface DataBreakpointInfoResponse extends Response { - body: { - /** An identifier for the data on which a data breakpoint can be registered with the `setDataBreakpoints` request or null if no data breakpoint is available. If a `variablesReference` or `frameId` is passed, the `dataId` is valid in the current suspended state, otherwise it's valid indefinitely. See 'Lifetime of Object References' in the Overview section for details. Breakpoints set using the `dataId` in the `setDataBreakpoints` request may outlive the lifetime of the associated `dataId`. */ - dataId: string | null; - /** UI string that describes on what data the breakpoint is set on or why a data breakpoint is not available. */ - description: string; - /** Attribute lists the available access types for a potential data breakpoint. A UI client could surface this information. */ - accessTypes?: DataBreakpointAccessType[]; - /** Attribute indicates that a potential data breakpoint could be persisted across sessions. */ - canPersist?: boolean; - }; - } - - /** SetDataBreakpoints request; value of command field is 'setDataBreakpoints'. - Replaces all existing data breakpoints with new data breakpoints. - To clear all data breakpoints, specify an empty array. - When a data breakpoint is hit, a `stopped` event (with reason `data breakpoint`) is generated. - Clients should only call this request if the corresponding capability `supportsDataBreakpoints` is true. - */ - interface SetDataBreakpointsRequest extends Request { - // command: 'setDataBreakpoints'; - arguments: SetDataBreakpointsArguments; - } - - /** Arguments for `setDataBreakpoints` request. */ - interface SetDataBreakpointsArguments { - /** The contents of this array replaces all existing data breakpoints. An empty array clears all data breakpoints. */ - breakpoints: DataBreakpoint[]; - } - - /** Response to `setDataBreakpoints` request. - Returned is information about each breakpoint created by this request. - */ - interface SetDataBreakpointsResponse extends Response { - body: { - /** Information about the data breakpoints. The array elements correspond to the elements of the input argument `breakpoints` array. */ - breakpoints: Breakpoint[]; - }; - } - - /** SetInstructionBreakpoints request; value of command field is 'setInstructionBreakpoints'. - Replaces all existing instruction breakpoints. Typically, instruction breakpoints would be set from a disassembly window. - To clear all instruction breakpoints, specify an empty array. - When an instruction breakpoint is hit, a `stopped` event (with reason `instruction breakpoint`) is generated. - Clients should only call this request if the corresponding capability `supportsInstructionBreakpoints` is true. - */ - interface SetInstructionBreakpointsRequest extends Request { - // command: 'setInstructionBreakpoints'; - arguments: SetInstructionBreakpointsArguments; - } - - /** Arguments for `setInstructionBreakpoints` request */ - interface SetInstructionBreakpointsArguments { - /** The instruction references of the breakpoints */ - breakpoints: InstructionBreakpoint[]; - } - - /** Response to `setInstructionBreakpoints` request */ - interface SetInstructionBreakpointsResponse extends Response { - body: { - /** Information about the breakpoints. The array elements correspond to the elements of the `breakpoints` array. */ - breakpoints: Breakpoint[]; - }; - } - - /** Continue request; value of command field is 'continue'. - The request resumes execution of all threads. If the debug adapter supports single thread execution (see capability `supportsSingleThreadExecutionRequests`), setting the `singleThread` argument to true resumes only the specified thread. If not all threads were resumed, the `allThreadsContinued` attribute of the response should be set to false. - */ - interface ContinueRequest extends Request { - // command: 'continue'; - arguments: ContinueArguments; - } - - /** Arguments for `continue` request. */ - interface ContinueArguments { - /** Specifies the active thread. If the debug adapter supports single thread execution (see `supportsSingleThreadExecutionRequests`) and the argument `singleThread` is true, only the thread with this ID is resumed. */ - threadId: number; - /** If this flag is true, execution is resumed only for the thread with given `threadId`. */ - singleThread?: boolean; - } - - /** Response to `continue` request. */ - interface ContinueResponse extends Response { - body: { - /** The value true (or a missing property) signals to the client that all threads have been resumed. The value false indicates that not all threads were resumed. */ - allThreadsContinued?: boolean; - }; - } - - /** Next request; value of command field is 'next'. - The request executes one step (in the given granularity) for the specified thread and allows all other threads to run freely by resuming them. - If the debug adapter supports single thread execution (see capability `supportsSingleThreadExecutionRequests`), setting the `singleThread` argument to true prevents other suspended threads from resuming. - The debug adapter first sends the response and then a `stopped` event (with reason `step`) after the step has completed. - */ - interface NextRequest extends Request { - // command: 'next'; - arguments: NextArguments; - } - - /** Arguments for `next` request. */ - interface NextArguments { - /** Specifies the thread for which to resume execution for one step (of the given granularity). */ - threadId: number; - /** If this flag is true, all other suspended threads are not resumed. */ - singleThread?: boolean; - /** Stepping granularity. If no granularity is specified, a granularity of `statement` is assumed. */ - granularity?: SteppingGranularity; - } - - /** Response to `next` request. This is just an acknowledgement, so no body field is required. */ - interface NextResponse extends Response {} - - /** StepIn request; value of command field is 'stepIn'. - The request resumes the given thread to step into a function/method and allows all other threads to run freely by resuming them. - If the debug adapter supports single thread execution (see capability `supportsSingleThreadExecutionRequests`), setting the `singleThread` argument to true prevents other suspended threads from resuming. - If the request cannot step into a target, `stepIn` behaves like the `next` request. - The debug adapter first sends the response and then a `stopped` event (with reason `step`) after the step has completed. - If there are multiple function/method calls (or other targets) on the source line, - the argument `targetId` can be used to control into which target the `stepIn` should occur. - The list of possible targets for a given source line can be retrieved via the `stepInTargets` request. - */ - interface StepInRequest extends Request { - // command: 'stepIn'; - arguments: StepInArguments; - } - - /** Arguments for `stepIn` request. */ - interface StepInArguments { - /** Specifies the thread for which to resume execution for one step-into (of the given granularity). */ - threadId: number; - /** If this flag is true, all other suspended threads are not resumed. */ - singleThread?: boolean; - /** Id of the target to step into. */ - targetId?: number; - /** Stepping granularity. If no granularity is specified, a granularity of `statement` is assumed. */ - granularity?: SteppingGranularity; - } - - /** Response to `stepIn` request. This is just an acknowledgement, so no body field is required. */ - interface StepInResponse extends Response {} - - /** StepOut request; value of command field is 'stepOut'. - The request resumes the given thread to step out (return) from a function/method and allows all other threads to run freely by resuming them. - If the debug adapter supports single thread execution (see capability `supportsSingleThreadExecutionRequests`), setting the `singleThread` argument to true prevents other suspended threads from resuming. - The debug adapter first sends the response and then a `stopped` event (with reason `step`) after the step has completed. - */ - interface StepOutRequest extends Request { - // command: 'stepOut'; - arguments: StepOutArguments; - } - - /** Arguments for `stepOut` request. */ - interface StepOutArguments { - /** Specifies the thread for which to resume execution for one step-out (of the given granularity). */ - threadId: number; - /** If this flag is true, all other suspended threads are not resumed. */ - singleThread?: boolean; - /** Stepping granularity. If no granularity is specified, a granularity of `statement` is assumed. */ - granularity?: SteppingGranularity; - } - - /** Response to `stepOut` request. This is just an acknowledgement, so no body field is required. */ - interface StepOutResponse extends Response {} - - /** StepBack request; value of command field is 'stepBack'. - The request executes one backward step (in the given granularity) for the specified thread and allows all other threads to run backward freely by resuming them. - If the debug adapter supports single thread execution (see capability `supportsSingleThreadExecutionRequests`), setting the `singleThread` argument to true prevents other suspended threads from resuming. - The debug adapter first sends the response and then a `stopped` event (with reason `step`) after the step has completed. - Clients should only call this request if the corresponding capability `supportsStepBack` is true. - */ - interface StepBackRequest extends Request { - // command: 'stepBack'; - arguments: StepBackArguments; - } - - /** Arguments for `stepBack` request. */ - interface StepBackArguments { - /** Specifies the thread for which to resume execution for one step backwards (of the given granularity). */ - threadId: number; - /** If this flag is true, all other suspended threads are not resumed. */ - singleThread?: boolean; - /** Stepping granularity to step. If no granularity is specified, a granularity of `statement` is assumed. */ - granularity?: SteppingGranularity; - } - - /** Response to `stepBack` request. This is just an acknowledgement, so no body field is required. */ - interface StepBackResponse extends Response {} - - /** ReverseContinue request; value of command field is 'reverseContinue'. - The request resumes backward execution of all threads. If the debug adapter supports single thread execution (see capability `supportsSingleThreadExecutionRequests`), setting the `singleThread` argument to true resumes only the specified thread. If not all threads were resumed, the `allThreadsContinued` attribute of the response should be set to false. - Clients should only call this request if the corresponding capability `supportsStepBack` is true. - */ - interface ReverseContinueRequest extends Request { - // command: 'reverseContinue'; - arguments: ReverseContinueArguments; - } - - /** Arguments for `reverseContinue` request. */ - interface ReverseContinueArguments { - /** Specifies the active thread. If the debug adapter supports single thread execution (see `supportsSingleThreadExecutionRequests`) and the `singleThread` argument is true, only the thread with this ID is resumed. */ - threadId: number; - /** If this flag is true, backward execution is resumed only for the thread with given `threadId`. */ - singleThread?: boolean; - } - - /** Response to `reverseContinue` request. This is just an acknowledgement, so no body field is required. */ - interface ReverseContinueResponse extends Response {} - - /** RestartFrame request; value of command field is 'restartFrame'. - The request restarts execution of the specified stack frame. - The debug adapter first sends the response and then a `stopped` event (with reason `restart`) after the restart has completed. - Clients should only call this request if the corresponding capability `supportsRestartFrame` is true. - */ - interface RestartFrameRequest extends Request { - // command: 'restartFrame'; - arguments: RestartFrameArguments; - } - - /** Arguments for `restartFrame` request. */ - interface RestartFrameArguments { - /** Restart the stack frame identified by `frameId`. The `frameId` must have been obtained in the current suspended state. See 'Lifetime of Object References' in the Overview section for details. */ - frameId: number; - } - - /** Response to `restartFrame` request. This is just an acknowledgement, so no body field is required. */ - interface RestartFrameResponse extends Response {} - - /** Goto request; value of command field is 'goto'. - The request sets the location where the debuggee will continue to run. - This makes it possible to skip the execution of code or to execute code again. - The code between the current location and the goto target is not executed but skipped. - The debug adapter first sends the response and then a `stopped` event with reason `goto`. - Clients should only call this request if the corresponding capability `supportsGotoTargetsRequest` is true (because only then goto targets exist that can be passed as arguments). - */ - interface GotoRequest extends Request { - // command: 'goto'; - arguments: GotoArguments; - } - - /** Arguments for `goto` request. */ - interface GotoArguments { - /** Set the goto target for this thread. */ - threadId: number; - /** The location where the debuggee will continue to run. */ - targetId: number; - } - - /** Response to `goto` request. This is just an acknowledgement, so no body field is required. */ - interface GotoResponse extends Response {} - - /** Pause request; value of command field is 'pause'. - The request suspends the debuggee. - The debug adapter first sends the response and then a `stopped` event (with reason `pause`) after the thread has been paused successfully. - */ - interface PauseRequest extends Request { - // command: 'pause'; - arguments: PauseArguments; - } - - /** Arguments for `pause` request. */ - interface PauseArguments { - /** Pause execution for this thread. */ - threadId: number; - } - - /** Response to `pause` request. This is just an acknowledgement, so no body field is required. */ - interface PauseResponse extends Response {} - - /** StackTrace request; value of command field is 'stackTrace'. - The request returns a stacktrace from the current execution state of a given thread. - A client can request all stack frames by omitting the startFrame and levels arguments. For performance-conscious clients and if the corresponding capability `supportsDelayedStackTraceLoading` is true, stack frames can be retrieved in a piecemeal way with the `startFrame` and `levels` arguments. The response of the `stackTrace` request may contain a `totalFrames` property that hints at the total number of frames in the stack. If a client needs this total number upfront, it can issue a request for a single (first) frame and depending on the value of `totalFrames` decide how to proceed. In any case a client should be prepared to receive fewer frames than requested, which is an indication that the end of the stack has been reached. - */ - interface StackTraceRequest extends Request { - // command: 'stackTrace'; - arguments: StackTraceArguments; - } - - /** Arguments for `stackTrace` request. */ - interface StackTraceArguments { - /** Retrieve the stacktrace for this thread. */ - threadId: number; - /** The index of the first frame to return; if omitted frames start at 0. */ - startFrame?: number; - /** The maximum number of frames to return. If levels is not specified or 0, all frames are returned. */ - levels?: number; - /** Specifies details on how to format the stack frames. - The attribute is only honored by a debug adapter if the corresponding capability `supportsValueFormattingOptions` is true. - */ - format?: StackFrameFormat; - } - - /** Response to `stackTrace` request. */ - interface StackTraceResponse extends Response { - body: { - /** The frames of the stack frame. If the array has length zero, there are no stack frames available. - This means that there is no location information available. - */ - stackFrames: StackFrame[]; - /** The total number of frames available in the stack. If omitted or if `totalFrames` is larger than the available frames, a client is expected to request frames until a request returns less frames than requested (which indicates the end of the stack). Returning monotonically increasing `totalFrames` values for subsequent requests can be used to enforce paging in the client. */ - totalFrames?: number; - }; - } - - /** Scopes request; value of command field is 'scopes'. - The request returns the variable scopes for a given stack frame ID. - */ - interface ScopesRequest extends Request { - // command: 'scopes'; - arguments: ScopesArguments; - } - - /** Arguments for `scopes` request. */ - interface ScopesArguments { - /** Retrieve the scopes for the stack frame identified by `frameId`. The `frameId` must have been obtained in the current suspended state. See 'Lifetime of Object References' in the Overview section for details. */ - frameId: number; - } - - /** Response to `scopes` request. */ - interface ScopesResponse extends Response { - body: { - /** The scopes of the stack frame. If the array has length zero, there are no scopes available. */ - scopes: Scope[]; - }; - } - - /** Variables request; value of command field is 'variables'. - Retrieves all child variables for the given variable reference. - A filter can be used to limit the fetched children to either named or indexed children. - */ - interface VariablesRequest extends Request { - // command: 'variables'; - arguments: VariablesArguments; - } - - /** Arguments for `variables` request. */ - interface VariablesArguments { - /** The variable for which to retrieve its children. The `variablesReference` must have been obtained in the current suspended state. See 'Lifetime of Object References' in the Overview section for details. */ - variablesReference: number; - /** Filter to limit the child variables to either named or indexed. If omitted, both types are fetched. */ - filter?: "indexed" | "named"; - /** The index of the first variable to return; if omitted children start at 0. - The attribute is only honored by a debug adapter if the corresponding capability `supportsVariablePaging` is true. - */ - start?: number; - /** The number of variables to return. If count is missing or 0, all variables are returned. - The attribute is only honored by a debug adapter if the corresponding capability `supportsVariablePaging` is true. - */ - count?: number; - /** Specifies details on how to format the Variable values. - The attribute is only honored by a debug adapter if the corresponding capability `supportsValueFormattingOptions` is true. - */ - format?: ValueFormat; - } - - /** Response to `variables` request. */ - interface VariablesResponse extends Response { - body: { - /** All (or a range) of variables for the given variable reference. */ - variables: Variable[]; - }; - } - - /** SetVariable request; value of command field is 'setVariable'. - Set the variable with the given name in the variable container to a new value. Clients should only call this request if the corresponding capability `supportsSetVariable` is true. - If a debug adapter implements both `setVariable` and `setExpression`, a client will only use `setExpression` if the variable has an `evaluateName` property. - */ - interface SetVariableRequest extends Request { - // command: 'setVariable'; - arguments: SetVariableArguments; - } - - /** Arguments for `setVariable` request. */ - interface SetVariableArguments { - /** The reference of the variable container. The `variablesReference` must have been obtained in the current suspended state. See 'Lifetime of Object References' in the Overview section for details. */ - variablesReference: number; - /** The name of the variable in the container. */ - name: string; - /** The value of the variable. */ - value: string; - /** Specifies details on how to format the response value. */ - format?: ValueFormat; - } - - /** Response to `setVariable` request. */ - interface SetVariableResponse extends Response { - body: { - /** The new value of the variable. */ - value: string; - /** The type of the new value. Typically shown in the UI when hovering over the value. */ - type?: string; - /** If `variablesReference` is > 0, the new value is structured and its children can be retrieved by passing `variablesReference` to the `variables` request as long as execution remains suspended. See 'Lifetime of Object References' in the Overview section for details. - - If this property is included in the response, any `variablesReference` previously associated with the updated variable, and those of its children, are no longer valid. - */ - variablesReference?: number; - /** The number of named child variables. - The client can use this information to present the variables in a paged UI and fetch them in chunks. - The value should be less than or equal to 2147483647 (2^31-1). - */ - namedVariables?: number; - /** The number of indexed child variables. - The client can use this information to present the variables in a paged UI and fetch them in chunks. - The value should be less than or equal to 2147483647 (2^31-1). - */ - indexedVariables?: number; - /** A memory reference to a location appropriate for this result. - For pointer type eval results, this is generally a reference to the memory address contained in the pointer. - This attribute may be returned by a debug adapter if corresponding capability `supportsMemoryReferences` is true. - */ - memoryReference?: string; - /** A reference that allows the client to request the location where the new value is declared. For example, if the new value is function pointer, the adapter may be able to look up the function's location. This should be present only if the adapter is likely to be able to resolve the location. - - This reference shares the same lifetime as the `variablesReference`. See 'Lifetime of Object References' in the Overview section for details. - */ - valueLocationReference?: number; - }; - } - - /** Source request; value of command field is 'source'. - The request retrieves the source code for a given source reference. - */ - interface SourceRequest extends Request { - // command: 'source'; - arguments: SourceArguments; - } - - /** Arguments for `source` request. */ - interface SourceArguments { - /** Specifies the source content to load. Either `source.path` or `source.sourceReference` must be specified. */ - source?: Source; - /** The reference to the source. This is the same as `source.sourceReference`. - This is provided for backward compatibility since old clients do not understand the `source` attribute. - */ - sourceReference: number; - } - - /** Response to `source` request. */ - interface SourceResponse extends Response { - body: { - /** Content of the source reference. */ - content: string; - /** Content type (MIME type) of the source. */ - mimeType?: string; - }; - } - - /** Threads request; value of command field is 'threads'. - The request retrieves a list of all threads. - */ - interface ThreadsRequest extends Request { - // command: 'threads'; - } - - /** Response to `threads` request. */ - interface ThreadsResponse extends Response { - body: { - /** All threads. */ - threads: Thread[]; - }; - } - - /** TerminateThreads request; value of command field is 'terminateThreads'. - The request terminates the threads with the given ids. - Clients should only call this request if the corresponding capability `supportsTerminateThreadsRequest` is true. - */ - interface TerminateThreadsRequest extends Request { - // command: 'terminateThreads'; - arguments: TerminateThreadsArguments; - } - - /** Arguments for `terminateThreads` request. */ - interface TerminateThreadsArguments { - /** Ids of threads to be terminated. */ - threadIds?: number[]; - } - - /** Response to `terminateThreads` request. This is just an acknowledgement, no body field is required. */ - interface TerminateThreadsResponse extends Response {} - - /** Modules request; value of command field is 'modules'. - Modules can be retrieved from the debug adapter with this request which can either return all modules or a range of modules to support paging. - Clients should only call this request if the corresponding capability `supportsModulesRequest` is true. - */ - interface ModulesRequest extends Request { - // command: 'modules'; - arguments: ModulesArguments; - } - - /** Arguments for `modules` request. */ - interface ModulesArguments { - /** The index of the first module to return; if omitted modules start at 0. */ - startModule?: number; - /** The number of modules to return. If `moduleCount` is not specified or 0, all modules are returned. */ - moduleCount?: number; - } - - /** Response to `modules` request. */ - interface ModulesResponse extends Response { - body: { - /** All modules or range of modules. */ - modules: Module[]; - /** The total number of modules available. */ - totalModules?: number; - }; - } - - /** LoadedSources request; value of command field is 'loadedSources'. - Retrieves the set of all sources currently loaded by the debugged process. - Clients should only call this request if the corresponding capability `supportsLoadedSourcesRequest` is true. - */ - interface LoadedSourcesRequest extends Request { - // command: 'loadedSources'; - arguments?: LoadedSourcesArguments; - } - - /** Arguments for `loadedSources` request. */ - interface LoadedSourcesArguments {} - - /** Response to `loadedSources` request. */ - interface LoadedSourcesResponse extends Response { - body: { - /** Set of loaded sources. */ - sources: Source[]; - }; - } - - /** Evaluate request; value of command field is 'evaluate'. - Evaluates the given expression in the context of a stack frame. - The expression has access to any variables and arguments that are in scope. - */ - interface EvaluateRequest extends Request { - // command: 'evaluate'; - arguments: EvaluateArguments; - } - - /** Arguments for `evaluate` request. */ - interface EvaluateArguments { - /** The expression to evaluate. */ - expression: string; - /** Evaluate the expression in the scope of this stack frame. If not specified, the expression is evaluated in the global scope. */ - frameId?: number; - /** The contextual line where the expression should be evaluated. In the 'hover' context, this should be set to the start of the expression being hovered. */ - line?: number; - /** The contextual column where the expression should be evaluated. This may be provided if `line` is also provided. - - It is measured in UTF-16 code units and the client capability `columnsStartAt1` determines whether it is 0- or 1-based. - */ - column?: number; - /** The contextual source in which the `line` is found. This must be provided if `line` is provided. */ - source?: Source; - /** The context in which the evaluate request is used. - Values: - 'watch': evaluate is called from a watch view context. - 'repl': evaluate is called from a REPL context. - 'hover': evaluate is called to generate the debug hover contents. - This value should only be used if the corresponding capability `supportsEvaluateForHovers` is true. - 'clipboard': evaluate is called to generate clipboard contents. - This value should only be used if the corresponding capability `supportsClipboardContext` is true. - 'variables': evaluate is called from a variables view context. - etc. - */ - context?: - | "watch" - | "repl" - | "hover" - | "clipboard" - | "variables" - | string; - /** Specifies details on how to format the result. - The attribute is only honored by a debug adapter if the corresponding capability `supportsValueFormattingOptions` is true. - */ - format?: ValueFormat; - } - - /** Response to `evaluate` request. */ - interface EvaluateResponse extends Response { - body: { - /** The result of the evaluate request. */ - result: string; - /** The type of the evaluate result. - This attribute should only be returned by a debug adapter if the corresponding capability `supportsVariableType` is true. - */ - type?: string; - /** Properties of an evaluate result that can be used to determine how to render the result in the UI. */ - presentationHint?: VariablePresentationHint; - /** If `variablesReference` is > 0, the evaluate result is structured and its children can be retrieved by passing `variablesReference` to the `variables` request as long as execution remains suspended. See 'Lifetime of Object References' in the Overview section for details. */ - variablesReference: number; - /** The number of named child variables. - The client can use this information to present the variables in a paged UI and fetch them in chunks. - The value should be less than or equal to 2147483647 (2^31-1). - */ - namedVariables?: number; - /** The number of indexed child variables. - The client can use this information to present the variables in a paged UI and fetch them in chunks. - The value should be less than or equal to 2147483647 (2^31-1). - */ - indexedVariables?: number; - /** A memory reference to a location appropriate for this result. - For pointer type eval results, this is generally a reference to the memory address contained in the pointer. - This attribute may be returned by a debug adapter if corresponding capability `supportsMemoryReferences` is true. - */ - memoryReference?: string; - /** A reference that allows the client to request the location where the returned value is declared. For example, if a function pointer is returned, the adapter may be able to look up the function's location. This should be present only if the adapter is likely to be able to resolve the location. - - This reference shares the same lifetime as the `variablesReference`. See 'Lifetime of Object References' in the Overview section for details. - */ - valueLocationReference?: number; - }; - } - - /** SetExpression request; value of command field is 'setExpression'. - Evaluates the given `value` expression and assigns it to the `expression` which must be a modifiable l-value. - The expressions have access to any variables and arguments that are in scope of the specified frame. - Clients should only call this request if the corresponding capability `supportsSetExpression` is true. - If a debug adapter implements both `setExpression` and `setVariable`, a client uses `setExpression` if the variable has an `evaluateName` property. - */ - interface SetExpressionRequest extends Request { - // command: 'setExpression'; - arguments: SetExpressionArguments; - } - - /** Arguments for `setExpression` request. */ - interface SetExpressionArguments { - /** The l-value expression to assign to. */ - expression: string; - /** The value expression to assign to the l-value expression. */ - value: string; - /** Evaluate the expressions in the scope of this stack frame. If not specified, the expressions are evaluated in the global scope. */ - frameId?: number; - /** Specifies how the resulting value should be formatted. */ - format?: ValueFormat; - } - - /** Response to `setExpression` request. */ - interface SetExpressionResponse extends Response { - body: { - /** The new value of the expression. */ - value: string; - /** The type of the value. - This attribute should only be returned by a debug adapter if the corresponding capability `supportsVariableType` is true. - */ - type?: string; - /** Properties of a value that can be used to determine how to render the result in the UI. */ - presentationHint?: VariablePresentationHint; - /** If `variablesReference` is > 0, the evaluate result is structured and its children can be retrieved by passing `variablesReference` to the `variables` request as long as execution remains suspended. See 'Lifetime of Object References' in the Overview section for details. */ - variablesReference?: number; - /** The number of named child variables. - The client can use this information to present the variables in a paged UI and fetch them in chunks. - The value should be less than or equal to 2147483647 (2^31-1). - */ - namedVariables?: number; - /** The number of indexed child variables. - The client can use this information to present the variables in a paged UI and fetch them in chunks. - The value should be less than or equal to 2147483647 (2^31-1). - */ - indexedVariables?: number; - /** A memory reference to a location appropriate for this result. - For pointer type eval results, this is generally a reference to the memory address contained in the pointer. - This attribute may be returned by a debug adapter if corresponding capability `supportsMemoryReferences` is true. - */ - memoryReference?: string; - /** A reference that allows the client to request the location where the new value is declared. For example, if the new value is function pointer, the adapter may be able to look up the function's location. This should be present only if the adapter is likely to be able to resolve the location. - - This reference shares the same lifetime as the `variablesReference`. See 'Lifetime of Object References' in the Overview section for details. - */ - valueLocationReference?: number; - }; - } - - /** StepInTargets request; value of command field is 'stepInTargets'. - This request retrieves the possible step-in targets for the specified stack frame. - These targets can be used in the `stepIn` request. - Clients should only call this request if the corresponding capability `supportsStepInTargetsRequest` is true. - */ - interface StepInTargetsRequest extends Request { - // command: 'stepInTargets'; - arguments: StepInTargetsArguments; - } - - /** Arguments for `stepInTargets` request. */ - interface StepInTargetsArguments { - /** The stack frame for which to retrieve the possible step-in targets. */ - frameId: number; - } - - /** Response to `stepInTargets` request. */ - interface StepInTargetsResponse extends Response { - body: { - /** The possible step-in targets of the specified source location. */ - targets: StepInTarget[]; - }; - } - - /** GotoTargets request; value of command field is 'gotoTargets'. - This request retrieves the possible goto targets for the specified source location. - These targets can be used in the `goto` request. - Clients should only call this request if the corresponding capability `supportsGotoTargetsRequest` is true. - */ - interface GotoTargetsRequest extends Request { - // command: 'gotoTargets'; - arguments: GotoTargetsArguments; - } - - /** Arguments for `gotoTargets` request. */ - interface GotoTargetsArguments { - /** The source location for which the goto targets are determined. */ - source: Source; - /** The line location for which the goto targets are determined. */ - line: number; - /** The position within `line` for which the goto targets are determined. It is measured in UTF-16 code units and the client capability `columnsStartAt1` determines whether it is 0- or 1-based. */ - column?: number; - } - - /** Response to `gotoTargets` request. */ - interface GotoTargetsResponse extends Response { - body: { - /** The possible goto targets of the specified location. */ - targets: GotoTarget[]; - }; - } - - /** Completions request; value of command field is 'completions'. - Returns a list of possible completions for a given caret position and text. - Clients should only call this request if the corresponding capability `supportsCompletionsRequest` is true. - */ - interface CompletionsRequest extends Request { - // command: 'completions'; - arguments: CompletionsArguments; - } - - /** Arguments for `completions` request. */ - interface CompletionsArguments { - /** Returns completions in the scope of this stack frame. If not specified, the completions are returned for the global scope. */ - frameId?: number; - /** One or more source lines. Typically this is the text users have typed into the debug console before they asked for completion. */ - text: string; - /** The position within `text` for which to determine the completion proposals. It is measured in UTF-16 code units and the client capability `columnsStartAt1` determines whether it is 0- or 1-based. */ - column: number; - /** A line for which to determine the completion proposals. If missing the first line of the text is assumed. */ - line?: number; - } - - /** Response to `completions` request. */ - interface CompletionsResponse extends Response { - body: { - /** The possible completions for . */ - targets: CompletionItem[]; - }; - } - - /** ExceptionInfo request; value of command field is 'exceptionInfo'. - Retrieves the details of the exception that caused this event to be raised. - Clients should only call this request if the corresponding capability `supportsExceptionInfoRequest` is true. - */ - interface ExceptionInfoRequest extends Request { - // command: 'exceptionInfo'; - arguments: ExceptionInfoArguments; - } - - /** Arguments for `exceptionInfo` request. */ - interface ExceptionInfoArguments { - /** Thread for which exception information should be retrieved. */ - threadId: number; - } - - /** Response to `exceptionInfo` request. */ - interface ExceptionInfoResponse extends Response { - body: { - /** ID of the exception that was thrown. */ - exceptionId: string; - /** Descriptive text for the exception. */ - description?: string; - /** Mode that caused the exception notification to be raised. */ - breakMode: ExceptionBreakMode; - /** Detailed information about the exception. */ - details?: ExceptionDetails; - }; - } - - /** ReadMemory request; value of command field is 'readMemory'. - Reads bytes from memory at the provided location. - Clients should only call this request if the corresponding capability `supportsReadMemoryRequest` is true. - */ - interface ReadMemoryRequest extends Request { - // command: 'readMemory'; - arguments: ReadMemoryArguments; - } - - /** Arguments for `readMemory` request. */ - interface ReadMemoryArguments { - /** Memory reference to the base location from which data should be read. */ - memoryReference: string; - /** Offset (in bytes) to be applied to the reference location before reading data. Can be negative. */ - offset?: number; - /** Number of bytes to read at the specified location and offset. */ - count: number; - } - - /** Response to `readMemory` request. */ - interface ReadMemoryResponse extends Response { - body?: { - /** The address of the first byte of data returned. - Treated as a hex value if prefixed with `0x`, or as a decimal value otherwise. - */ - address: string; - /** The number of unreadable bytes encountered after the last successfully read byte. - This can be used to determine the number of bytes that should be skipped before a subsequent `readMemory` request succeeds. - */ - unreadableBytes?: number; - /** The bytes read from memory, encoded using base64. If the decoded length of `data` is less than the requested `count` in the original `readMemory` request, and `unreadableBytes` is zero or omitted, then the client should assume it's reached the end of readable memory. */ - data?: string; - }; - } - - /** WriteMemory request; value of command field is 'writeMemory'. - Writes bytes to memory at the provided location. - Clients should only call this request if the corresponding capability `supportsWriteMemoryRequest` is true. - */ - interface WriteMemoryRequest extends Request { - // command: 'writeMemory'; - arguments: WriteMemoryArguments; - } - - /** Arguments for `writeMemory` request. */ - interface WriteMemoryArguments { - /** Memory reference to the base location to which data should be written. */ - memoryReference: string; - /** Offset (in bytes) to be applied to the reference location before writing data. Can be negative. */ - offset?: number; - /** Property to control partial writes. If true, the debug adapter should attempt to write memory even if the entire memory region is not writable. In such a case the debug adapter should stop after hitting the first byte of memory that cannot be written and return the number of bytes written in the response via the `offset` and `bytesWritten` properties. - If false or missing, a debug adapter should attempt to verify the region is writable before writing, and fail the response if it is not. - */ - allowPartial?: boolean; - /** Bytes to write, encoded using base64. */ - data: string; - } - - /** Response to `writeMemory` request. */ - interface WriteMemoryResponse extends Response { - body?: { - /** Property that should be returned when `allowPartial` is true to indicate the offset of the first byte of data successfully written. Can be negative. */ - offset?: number; - /** Property that should be returned when `allowPartial` is true to indicate the number of bytes starting from address that were successfully written. */ - bytesWritten?: number; - }; - } - - /** Disassemble request; value of command field is 'disassemble'. - Disassembles code stored at the provided location. - Clients should only call this request if the corresponding capability `supportsDisassembleRequest` is true. - */ - interface DisassembleRequest extends Request { - // command: 'disassemble'; - arguments: DisassembleArguments; - } - - /** Arguments for `disassemble` request. */ - interface DisassembleArguments { - /** Memory reference to the base location containing the instructions to disassemble. */ - memoryReference: string; - /** Offset (in bytes) to be applied to the reference location before disassembling. Can be negative. */ - offset?: number; - /** Offset (in instructions) to be applied after the byte offset (if any) before disassembling. Can be negative. */ - instructionOffset?: number; - /** Number of instructions to disassemble starting at the specified location and offset. - An adapter must return exactly this number of instructions - any unavailable instructions should be replaced with an implementation-defined 'invalid instruction' value. - */ - instructionCount: number; - /** If true, the adapter should attempt to resolve memory addresses and other values to symbolic names. */ - resolveSymbols?: boolean; - } - - /** Response to `disassemble` request. */ - interface DisassembleResponse extends Response { - body?: { - /** The list of disassembled instructions. */ - instructions: DisassembledInstruction[]; - }; - } - - /** Locations request; value of command field is 'locations'. - Looks up information about a location reference previously returned by the debug adapter. - */ - interface LocationsRequest extends Request { - // command: 'locations'; - arguments: LocationsArguments; - } - - /** Arguments for `locations` request. */ - interface LocationsArguments { - /** Location reference to resolve. */ - locationReference: number; - } - - /** Response to `locations` request. */ - interface LocationsResponse extends Response { - body?: { - /** The source containing the location; either `source.path` or `source.sourceReference` must be specified. */ - source: Source; - /** The line number of the location. The client capability `linesStartAt1` determines whether it is 0- or 1-based. */ - line: number; - /** Position of the location within the `line`. It is measured in UTF-16 code units and the client capability `columnsStartAt1` determines whether it is 0- or 1-based. If no column is given, the first position in the start line is assumed. */ - column?: number; - /** End line of the location, present if the location refers to a range. The client capability `linesStartAt1` determines whether it is 0- or 1-based. */ - endLine?: number; - /** End position of the location within `endLine`, present if the location refers to a range. It is measured in UTF-16 code units and the client capability `columnsStartAt1` determines whether it is 0- or 1-based. */ - endColumn?: number; - }; - } - - /** Information about the capabilities of a debug adapter. */ - interface Capabilities { - /** The debug adapter supports the `configurationDone` request. */ - supportsConfigurationDoneRequest?: boolean; - /** The debug adapter supports function breakpoints. */ - supportsFunctionBreakpoints?: boolean; - /** The debug adapter supports conditional breakpoints. */ - supportsConditionalBreakpoints?: boolean; - /** The debug adapter supports breakpoints that break execution after a specified number of hits. */ - supportsHitConditionalBreakpoints?: boolean; - /** The debug adapter supports a (side effect free) `evaluate` request for data hovers. */ - supportsEvaluateForHovers?: boolean; - /** Available exception filter options for the `setExceptionBreakpoints` request. */ - exceptionBreakpointFilters?: ExceptionBreakpointsFilter[]; - /** The debug adapter supports stepping back via the `stepBack` and `reverseContinue` requests. */ - supportsStepBack?: boolean; - /** The debug adapter supports setting a variable to a value. */ - supportsSetVariable?: boolean; - /** The debug adapter supports restarting a frame. */ - supportsRestartFrame?: boolean; - /** The debug adapter supports the `gotoTargets` request. */ - supportsGotoTargetsRequest?: boolean; - /** The debug adapter supports the `stepInTargets` request. */ - supportsStepInTargetsRequest?: boolean; - /** The debug adapter supports the `completions` request. */ - supportsCompletionsRequest?: boolean; - /** The set of characters that should trigger completion in a REPL. If not specified, the UI should assume the `.` character. */ - completionTriggerCharacters?: string[]; - /** The debug adapter supports the `modules` request. */ - supportsModulesRequest?: boolean; - /** The set of additional module information exposed by the debug adapter. */ - additionalModuleColumns?: ColumnDescriptor[]; - /** Checksum algorithms supported by the debug adapter. */ - supportedChecksumAlgorithms?: ChecksumAlgorithm[]; - /** The debug adapter supports the `restart` request. In this case a client should not implement `restart` by terminating and relaunching the adapter but by calling the `restart` request. */ - supportsRestartRequest?: boolean; - /** The debug adapter supports `exceptionOptions` on the `setExceptionBreakpoints` request. */ - supportsExceptionOptions?: boolean; - /** The debug adapter supports a `format` attribute on the `stackTrace`, `variables`, and `evaluate` requests. */ - supportsValueFormattingOptions?: boolean; - /** The debug adapter supports the `exceptionInfo` request. */ - supportsExceptionInfoRequest?: boolean; - /** The debug adapter supports the `terminateDebuggee` attribute on the `disconnect` request. */ - supportTerminateDebuggee?: boolean; - /** The debug adapter supports the `suspendDebuggee` attribute on the `disconnect` request. */ - supportSuspendDebuggee?: boolean; - /** The debug adapter supports the delayed loading of parts of the stack, which requires that both the `startFrame` and `levels` arguments and the `totalFrames` result of the `stackTrace` request are supported. */ - supportsDelayedStackTraceLoading?: boolean; - /** The debug adapter supports the `loadedSources` request. */ - supportsLoadedSourcesRequest?: boolean; - /** The debug adapter supports log points by interpreting the `logMessage` attribute of the `SourceBreakpoint`. */ - supportsLogPoints?: boolean; - /** The debug adapter supports the `terminateThreads` request. */ - supportsTerminateThreadsRequest?: boolean; - /** The debug adapter supports the `setExpression` request. */ - supportsSetExpression?: boolean; - /** The debug adapter supports the `terminate` request. */ - supportsTerminateRequest?: boolean; - /** The debug adapter supports data breakpoints. */ - supportsDataBreakpoints?: boolean; - /** The debug adapter supports the `readMemory` request. */ - supportsReadMemoryRequest?: boolean; - /** The debug adapter supports the `writeMemory` request. */ - supportsWriteMemoryRequest?: boolean; - /** The debug adapter supports the `disassemble` request. */ - supportsDisassembleRequest?: boolean; - /** The debug adapter supports the `cancel` request. */ - supportsCancelRequest?: boolean; - /** The debug adapter supports the `breakpointLocations` request. */ - supportsBreakpointLocationsRequest?: boolean; - /** The debug adapter supports the `clipboard` context value in the `evaluate` request. */ - supportsClipboardContext?: boolean; - /** The debug adapter supports stepping granularities (argument `granularity`) for the stepping requests. */ - supportsSteppingGranularity?: boolean; - /** The debug adapter supports adding breakpoints based on instruction references. */ - supportsInstructionBreakpoints?: boolean; - /** The debug adapter supports `filterOptions` as an argument on the `setExceptionBreakpoints` request. */ - supportsExceptionFilterOptions?: boolean; - /** The debug adapter supports the `singleThread` property on the execution requests (`continue`, `next`, `stepIn`, `stepOut`, `reverseContinue`, `stepBack`). */ - supportsSingleThreadExecutionRequests?: boolean; - /** The debug adapter supports the `asAddress` and `bytes` fields in the `dataBreakpointInfo` request. */ - supportsDataBreakpointBytes?: boolean; - /** Modes of breakpoints supported by the debug adapter, such as 'hardware' or 'software'. If present, the client may allow the user to select a mode and include it in its `setBreakpoints` request. - - Clients may present the first applicable mode in this array as the 'default' mode in gestures that set breakpoints. - */ - breakpointModes?: BreakpointMode[]; - /** The debug adapter supports ANSI escape sequences in styling of `OutputEvent.output` and `Variable.value` fields. */ - supportsANSIStyling?: boolean; - } - - /** An `ExceptionBreakpointsFilter` is shown in the UI as an filter option for configuring how exceptions are dealt with. */ - interface ExceptionBreakpointsFilter { - /** The internal ID of the filter option. This value is passed to the `setExceptionBreakpoints` request. */ - filter: string; - /** The name of the filter option. This is shown in the UI. */ - label: string; - /** A help text providing additional information about the exception filter. This string is typically shown as a hover and can be translated. */ - description?: string; - /** Initial value of the filter option. If not specified a value false is assumed. */ - default?: boolean; - /** Controls whether a condition can be specified for this filter option. If false or missing, a condition can not be set. */ - supportsCondition?: boolean; - /** A help text providing information about the condition. This string is shown as the placeholder text for a text box and can be translated. */ - conditionDescription?: string; - } - - /** A structured message object. Used to return errors from requests. */ - interface Message { - /** Unique (within a debug adapter implementation) identifier for the message. The purpose of these error IDs is to help extension authors that have the requirement that every user visible error message needs a corresponding error number, so that users or customer support can find information about the specific error more easily. */ - id: number; - /** A format string for the message. Embedded variables have the form `{name}`. - If variable name starts with an underscore character, the variable does not contain user data (PII) and can be safely used for telemetry purposes. - */ - format: string; - /** An object used as a dictionary for looking up the variables in the format string. */ - variables?: { [key: string]: string }; - /** If true send to telemetry. */ - sendTelemetry?: boolean; - /** If true show user. */ - showUser?: boolean; - /** A url where additional information about this message can be found. */ - url?: string; - /** A label that is presented to the user as the UI for opening the url. */ - urlLabel?: string; - } - - /** A Module object represents a row in the modules view. - The `id` attribute identifies a module in the modules view and is used in a `module` event for identifying a module for adding, updating or deleting. - The `name` attribute is used to minimally render the module in the UI. - - Additional attributes can be added to the module. They show up in the module view if they have a corresponding `ColumnDescriptor`. - - To avoid an unnecessary proliferation of additional attributes with similar semantics but different names, we recommend to re-use attributes from the 'recommended' list below first, and only introduce new attributes if nothing appropriate could be found. - */ - interface Module { - /** Unique identifier for the module. */ - id: number | string; - /** A name of the module. */ - name: string; - /** Logical full path to the module. The exact definition is implementation defined, but usually this would be a full path to the on-disk file for the module. */ - path?: string; - /** True if the module is optimized. */ - isOptimized?: boolean; - /** True if the module is considered 'user code' by a debugger that supports 'Just My Code'. */ - isUserCode?: boolean; - /** Version of Module. */ - version?: string; - /** User-understandable description of if symbols were found for the module (ex: 'Symbols Loaded', 'Symbols not found', etc.) */ - symbolStatus?: string; - /** Logical full path to the symbol file. The exact definition is implementation defined. */ - symbolFilePath?: string; - /** Module created or modified, encoded as a RFC 3339 timestamp. */ - dateTimeStamp?: string; - /** Address range covered by this module. */ - addressRange?: string; - } - - /** A `ColumnDescriptor` specifies what module attribute to show in a column of the modules view, how to format it, - and what the column's label should be. - It is only used if the underlying UI actually supports this level of customization. - */ - interface ColumnDescriptor { - /** Name of the attribute rendered in this column. */ - attributeName: string; - /** Header UI label of column. */ - label: string; - /** Format to use for the rendered values in this column. TBD how the format strings looks like. */ - format?: string; - /** Datatype of values in this column. Defaults to `string` if not specified. */ - type?: "string" | "number" | "boolean" | "unixTimestampUTC"; - /** Width of this column in characters (hint only). */ - width?: number; - } - - /** A Thread */ - interface Thread { - /** Unique identifier for the thread. */ - id: number; - /** The name of the thread. */ - name: string; - } - - /** A `Source` is a descriptor for source code. - It is returned from the debug adapter as part of a `StackFrame` and it is used by clients when specifying breakpoints. - */ - interface Source { - /** The short name of the source. Every source returned from the debug adapter has a name. - When sending a source to the debug adapter this name is optional. - */ - name?: string; - /** The path of the source to be shown in the UI. - It is only used to locate and load the content of the source if no `sourceReference` is specified (or its value is 0). - */ - path?: string; - /** If the value > 0 the contents of the source must be retrieved through the `source` request (even if a path is specified). - Since a `sourceReference` is only valid for a session, it can not be used to persist a source. - The value should be less than or equal to 2147483647 (2^31-1). - */ - sourceReference?: number; - /** A hint for how to present the source in the UI. - A value of `deemphasize` can be used to indicate that the source is not available or that it is skipped on stepping. - */ - presentationHint?: "normal" | "emphasize" | "deemphasize"; - /** The origin of this source. For example, 'internal module', 'inlined content from source map', etc. */ - origin?: string; - /** A list of sources that are related to this source. These may be the source that generated this source. */ - sources?: Source[]; - /** Additional data that a debug adapter might want to loop through the client. - The client should leave the data intact and persist it across sessions. The client should not interpret the data. - */ - adapterData?: any; - /** The checksums associated with this file. */ - checksums?: Checksum[]; - } - - /** A Stackframe contains the source location. */ - interface StackFrame { - /** An identifier for the stack frame. It must be unique across all threads. - This id can be used to retrieve the scopes of the frame with the `scopes` request or to restart the execution of a stack frame. - */ - id: number; - /** The name of the stack frame, typically a method name. */ - name: string; - /** The source of the frame. */ - source?: Source; - /** The line within the source of the frame. If the source attribute is missing or doesn't exist, `line` is 0 and should be ignored by the client. */ - line: number; - /** Start position of the range covered by the stack frame. It is measured in UTF-16 code units and the client capability `columnsStartAt1` determines whether it is 0- or 1-based. If attribute `source` is missing or doesn't exist, `column` is 0 and should be ignored by the client. */ - column: number; - /** The end line of the range covered by the stack frame. */ - endLine?: number; - /** End position of the range covered by the stack frame. It is measured in UTF-16 code units and the client capability `columnsStartAt1` determines whether it is 0- or 1-based. */ - endColumn?: number; - /** Indicates whether this frame can be restarted with the `restartFrame` request. Clients should only use this if the debug adapter supports the `restart` request and the corresponding capability `supportsRestartFrame` is true. If a debug adapter has this capability, then `canRestart` defaults to `true` if the property is absent. */ - canRestart?: boolean; - /** A memory reference for the current instruction pointer in this frame. */ - instructionPointerReference?: string; - /** The module associated with this frame, if any. */ - moduleId?: number | string; - /** A hint for how to present this frame in the UI. - A value of `label` can be used to indicate that the frame is an artificial frame that is used as a visual label or separator. A value of `subtle` can be used to change the appearance of a frame in a 'subtle' way. - */ - presentationHint?: "normal" | "label" | "subtle"; - } - - /** A `Scope` is a named container for variables. Optionally a scope can map to a source or a range within a source. */ - interface Scope { - /** Name of the scope such as 'Arguments', 'Locals', or 'Registers'. This string is shown in the UI as is and can be translated. */ - name: string; - /** A hint for how to present this scope in the UI. If this attribute is missing, the scope is shown with a generic UI. - Values: - 'arguments': Scope contains method arguments. - 'locals': Scope contains local variables. - 'registers': Scope contains registers. Only a single `registers` scope should be returned from a `scopes` request. - 'returnValue': Scope contains one or more return values. - etc. - */ - presentationHint?: - | "arguments" - | "locals" - | "registers" - | "returnValue" - | string; - /** The variables of this scope can be retrieved by passing the value of `variablesReference` to the `variables` request as long as execution remains suspended. See 'Lifetime of Object References' in the Overview section for details. */ - variablesReference: number; - /** The number of named variables in this scope. - The client can use this information to present the variables in a paged UI and fetch them in chunks. - */ - namedVariables?: number; - /** The number of indexed variables in this scope. - The client can use this information to present the variables in a paged UI and fetch them in chunks. - */ - indexedVariables?: number; - /** If true, the number of variables in this scope is large or expensive to retrieve. */ - expensive: boolean; - /** The source for this scope. */ - source?: Source; - /** The start line of the range covered by this scope. */ - line?: number; - /** Start position of the range covered by the scope. It is measured in UTF-16 code units and the client capability `columnsStartAt1` determines whether it is 0- or 1-based. */ - column?: number; - /** The end line of the range covered by this scope. */ - endLine?: number; - /** End position of the range covered by the scope. It is measured in UTF-16 code units and the client capability `columnsStartAt1` determines whether it is 0- or 1-based. */ - endColumn?: number; - } - - /** A Variable is a name/value pair. - The `type` attribute is shown if space permits or when hovering over the variable's name. - The `kind` attribute is used to render additional properties of the variable, e.g. different icons can be used to indicate that a variable is public or private. - If the value is structured (has children), a handle is provided to retrieve the children with the `variables` request. - If the number of named or indexed children is large, the numbers should be returned via the `namedVariables` and `indexedVariables` attributes. - The client can use this information to present the children in a paged UI and fetch them in chunks. - */ - interface Variable { - /** The variable's name. */ - name: string; - /** The variable's value. - This can be a multi-line text, e.g. for a function the body of a function. - For structured variables (which do not have a simple value), it is recommended to provide a one-line representation of the structured object. This helps to identify the structured object in the collapsed state when its children are not yet visible. - An empty string can be used if no value should be shown in the UI. - */ - value: string; - /** The type of the variable's value. Typically shown in the UI when hovering over the value. - This attribute should only be returned by a debug adapter if the corresponding capability `supportsVariableType` is true. - */ - type?: string; - /** Properties of a variable that can be used to determine how to render the variable in the UI. */ - presentationHint?: VariablePresentationHint; - /** The evaluatable name of this variable which can be passed to the `evaluate` request to fetch the variable's value. */ - evaluateName?: string; - /** If `variablesReference` is > 0, the variable is structured and its children can be retrieved by passing `variablesReference` to the `variables` request as long as execution remains suspended. See 'Lifetime of Object References' in the Overview section for details. */ - variablesReference: number; - /** The number of named child variables. - The client can use this information to present the children in a paged UI and fetch them in chunks. - */ - namedVariables?: number; - /** The number of indexed child variables. - The client can use this information to present the children in a paged UI and fetch them in chunks. - */ - indexedVariables?: number; - /** A memory reference associated with this variable. - For pointer type variables, this is generally a reference to the memory address contained in the pointer. - For executable data, this reference may later be used in a `disassemble` request. - This attribute may be returned by a debug adapter if corresponding capability `supportsMemoryReferences` is true. - */ - memoryReference?: string; - /** A reference that allows the client to request the location where the variable is declared. This should be present only if the adapter is likely to be able to resolve the location. - - This reference shares the same lifetime as the `variablesReference`. See 'Lifetime of Object References' in the Overview section for details. - */ - declarationLocationReference?: number; - /** A reference that allows the client to request the location where the variable's value is declared. For example, if the variable contains a function pointer, the adapter may be able to look up the function's location. This should be present only if the adapter is likely to be able to resolve the location. - - This reference shares the same lifetime as the `variablesReference`. See 'Lifetime of Object References' in the Overview section for details. - */ - valueLocationReference?: number; - } - - /** Properties of a variable that can be used to determine how to render the variable in the UI. */ - interface VariablePresentationHint { - /** The kind of variable. Before introducing additional values, try to use the listed values. - Values: - 'property': Indicates that the object is a property. - 'method': Indicates that the object is a method. - 'class': Indicates that the object is a class. - 'data': Indicates that the object is data. - 'event': Indicates that the object is an event. - 'baseClass': Indicates that the object is a base class. - 'innerClass': Indicates that the object is an inner class. - 'interface': Indicates that the object is an interface. - 'mostDerivedClass': Indicates that the object is the most derived class. - 'virtual': Indicates that the object is virtual, that means it is a synthetic object introduced by the adapter for rendering purposes, e.g. an index range for large arrays. - 'dataBreakpoint': Deprecated: Indicates that a data breakpoint is registered for the object. The `hasDataBreakpoint` attribute should generally be used instead. - etc. - */ - kind?: - | "property" - | "method" - | "class" - | "data" - | "event" - | "baseClass" - | "innerClass" - | "interface" - | "mostDerivedClass" - | "virtual" - | "dataBreakpoint" - | string; - /** Set of attributes represented as an array of strings. Before introducing additional values, try to use the listed values. - Values: - 'static': Indicates that the object is static. - 'constant': Indicates that the object is a constant. - 'readOnly': Indicates that the object is read only. - 'rawString': Indicates that the object is a raw string. - 'hasObjectId': Indicates that the object can have an Object ID created for it. This is a vestigial attribute that is used by some clients; 'Object ID's are not specified in the protocol. - 'canHaveObjectId': Indicates that the object has an Object ID associated with it. This is a vestigial attribute that is used by some clients; 'Object ID's are not specified in the protocol. - 'hasSideEffects': Indicates that the evaluation had side effects. - 'hasDataBreakpoint': Indicates that the object has its value tracked by a data breakpoint. - etc. - */ - attributes?: ( - | "static" - | "constant" - | "readOnly" - | "rawString" - | "hasObjectId" - | "canHaveObjectId" - | "hasSideEffects" - | "hasDataBreakpoint" - | string - )[]; - /** Visibility of variable. Before introducing additional values, try to use the listed values. - Values: 'public', 'private', 'protected', 'internal', 'final', etc. - */ - visibility?: - | "public" - | "private" - | "protected" - | "internal" - | "final" - | string; - /** If true, clients can present the variable with a UI that supports a specific gesture to trigger its evaluation. - This mechanism can be used for properties that require executing code when retrieving their value and where the code execution can be expensive and/or produce side-effects. A typical example are properties based on a getter function. - Please note that in addition to the `lazy` flag, the variable's `variablesReference` is expected to refer to a variable that will provide the value through another `variable` request. - */ - lazy?: boolean; - } - - /** Properties of a breakpoint location returned from the `breakpointLocations` request. */ - interface BreakpointLocation { - /** Start line of breakpoint location. */ - line: number; - /** The start position of a breakpoint location. Position is measured in UTF-16 code units and the client capability `columnsStartAt1` determines whether it is 0- or 1-based. */ - column?: number; - /** The end line of breakpoint location if the location covers a range. */ - endLine?: number; - /** The end position of a breakpoint location (if the location covers a range). Position is measured in UTF-16 code units and the client capability `columnsStartAt1` determines whether it is 0- or 1-based. */ - endColumn?: number; - } - - /** Properties of a breakpoint or logpoint passed to the `setBreakpoints` request. */ - interface SourceBreakpoint { - /** The source line of the breakpoint or logpoint. */ - line: number; - /** Start position within source line of the breakpoint or logpoint. It is measured in UTF-16 code units and the client capability `columnsStartAt1` determines whether it is 0- or 1-based. */ - column?: number; - /** The expression for conditional breakpoints. - It is only honored by a debug adapter if the corresponding capability `supportsConditionalBreakpoints` is true. - */ - condition?: string; - /** The expression that controls how many hits of the breakpoint are ignored. - The debug adapter is expected to interpret the expression as needed. - The attribute is only honored by a debug adapter if the corresponding capability `supportsHitConditionalBreakpoints` is true. - If both this property and `condition` are specified, `hitCondition` should be evaluated only if the `condition` is met, and the debug adapter should stop only if both conditions are met. - */ - hitCondition?: string; - /** If this attribute exists and is non-empty, the debug adapter must not 'break' (stop) - but log the message instead. Expressions within `{}` are interpolated. - The attribute is only honored by a debug adapter if the corresponding capability `supportsLogPoints` is true. - If either `hitCondition` or `condition` is specified, then the message should only be logged if those conditions are met. - */ - logMessage?: string; - /** The mode of this breakpoint. If defined, this must be one of the `breakpointModes` the debug adapter advertised in its `Capabilities`. */ - mode?: string; - } - - /** Properties of a breakpoint passed to the `setFunctionBreakpoints` request. */ - interface FunctionBreakpoint { - /** The name of the function. */ - name: string; - /** An expression for conditional breakpoints. - It is only honored by a debug adapter if the corresponding capability `supportsConditionalBreakpoints` is true. - */ - condition?: string; - /** An expression that controls how many hits of the breakpoint are ignored. - The debug adapter is expected to interpret the expression as needed. - The attribute is only honored by a debug adapter if the corresponding capability `supportsHitConditionalBreakpoints` is true. - */ - hitCondition?: string; - } - - /** This enumeration defines all possible access types for data breakpoints. */ - type DataBreakpointAccessType = "read" | "write" | "readWrite"; - - /** Properties of a data breakpoint passed to the `setDataBreakpoints` request. */ - interface DataBreakpoint { - /** An id representing the data. This id is returned from the `dataBreakpointInfo` request. */ - dataId: string; - /** The access type of the data. */ - accessType?: DataBreakpointAccessType; - /** An expression for conditional breakpoints. */ - condition?: string; - /** An expression that controls how many hits of the breakpoint are ignored. - The debug adapter is expected to interpret the expression as needed. - */ - hitCondition?: string; - } - - /** Properties of a breakpoint passed to the `setInstructionBreakpoints` request */ - interface InstructionBreakpoint { - /** The instruction reference of the breakpoint. - This should be a memory or instruction pointer reference from an `EvaluateResponse`, `Variable`, `StackFrame`, `GotoTarget`, or `Breakpoint`. - */ - instructionReference: string; - /** The offset from the instruction reference in bytes. - This can be negative. - */ - offset?: number; - /** An expression for conditional breakpoints. - It is only honored by a debug adapter if the corresponding capability `supportsConditionalBreakpoints` is true. - */ - condition?: string; - /** An expression that controls how many hits of the breakpoint are ignored. - The debug adapter is expected to interpret the expression as needed. - The attribute is only honored by a debug adapter if the corresponding capability `supportsHitConditionalBreakpoints` is true. - */ - hitCondition?: string; - /** The mode of this breakpoint. If defined, this must be one of the `breakpointModes` the debug adapter advertised in its `Capabilities`. */ - mode?: string; - } - - /** Information about a breakpoint created in `setBreakpoints`, `setFunctionBreakpoints`, `setInstructionBreakpoints`, or `setDataBreakpoints` requests. */ - interface Breakpoint { - /** The identifier for the breakpoint. It is needed if breakpoint events are used to update or remove breakpoints. */ - id?: number; - /** If true, the breakpoint could be set (but not necessarily at the desired location). */ - verified: boolean; - /** A message about the state of the breakpoint. - This is shown to the user and can be used to explain why a breakpoint could not be verified. - */ - message?: string; - /** The source where the breakpoint is located. */ - source?: Source; - /** The start line of the actual range covered by the breakpoint. */ - line?: number; - /** Start position of the source range covered by the breakpoint. It is measured in UTF-16 code units and the client capability `columnsStartAt1` determines whether it is 0- or 1-based. */ - column?: number; - /** The end line of the actual range covered by the breakpoint. */ - endLine?: number; - /** End position of the source range covered by the breakpoint. It is measured in UTF-16 code units and the client capability `columnsStartAt1` determines whether it is 0- or 1-based. - If no end line is given, then the end column is assumed to be in the start line. - */ - endColumn?: number; - /** A memory reference to where the breakpoint is set. */ - instructionReference?: string; - /** The offset from the instruction reference. - This can be negative. - */ - offset?: number; - /** A machine-readable explanation of why a breakpoint may not be verified. If a breakpoint is verified or a specific reason is not known, the adapter should omit this property. Possible values include: - - - `pending`: Indicates a breakpoint might be verified in the future, but the adapter cannot verify it in the current state. - - `failed`: Indicates a breakpoint was not able to be verified, and the adapter does not believe it can be verified without intervention. - */ - reason?: "pending" | "failed"; - } - - /** The granularity of one 'step' in the stepping requests `next`, `stepIn`, `stepOut`, and `stepBack`. - 'statement': The step should allow the program to run until the current statement has finished executing. - The meaning of a statement is determined by the adapter and it may be considered equivalent to a line. - For example 'for(int i = 0; i < 10; i++)' could be considered to have 3 statements 'int i = 0', 'i < 10', and 'i++'. - 'line': The step should allow the program to run until the current source line has executed. - 'instruction': The step should allow one instruction to execute (e.g. one x86 instruction). - */ - type SteppingGranularity = "statement" | "line" | "instruction"; - - /** A `StepInTarget` can be used in the `stepIn` request and determines into which single target the `stepIn` request should step. */ - interface StepInTarget { - /** Unique identifier for a step-in target. */ - id: number; - /** The name of the step-in target (shown in the UI). */ - label: string; - /** The line of the step-in target. */ - line?: number; - /** Start position of the range covered by the step in target. It is measured in UTF-16 code units and the client capability `columnsStartAt1` determines whether it is 0- or 1-based. */ - column?: number; - /** The end line of the range covered by the step-in target. */ - endLine?: number; - /** End position of the range covered by the step in target. It is measured in UTF-16 code units and the client capability `columnsStartAt1` determines whether it is 0- or 1-based. */ - endColumn?: number; - } - - /** A `GotoTarget` describes a code location that can be used as a target in the `goto` request. - The possible goto targets can be determined via the `gotoTargets` request. - */ - interface GotoTarget { - /** Unique identifier for a goto target. This is used in the `goto` request. */ - id: number; - /** The name of the goto target (shown in the UI). */ - label: string; - /** The line of the goto target. */ - line: number; - /** The column of the goto target. */ - column?: number; - /** The end line of the range covered by the goto target. */ - endLine?: number; - /** The end column of the range covered by the goto target. */ - endColumn?: number; - /** A memory reference for the instruction pointer value represented by this target. */ - instructionPointerReference?: string; - } - - /** `CompletionItems` are the suggestions returned from the `completions` request. */ - interface CompletionItem { - /** The label of this completion item. By default this is also the text that is inserted when selecting this completion. */ - label: string; - /** If text is returned and not an empty string, then it is inserted instead of the label. */ - text?: string; - /** A string that should be used when comparing this item with other items. If not returned or an empty string, the `label` is used instead. */ - sortText?: string; - /** A human-readable string with additional information about this item, like type or symbol information. */ - detail?: string; - /** The item's type. Typically the client uses this information to render the item in the UI with an icon. */ - type?: CompletionItemType; - /** Start position (within the `text` attribute of the `completions` request) where the completion text is added. The position is measured in UTF-16 code units and the client capability `columnsStartAt1` determines whether it is 0- or 1-based. If the start position is omitted the text is added at the location specified by the `column` attribute of the `completions` request. */ - start?: number; - /** Length determines how many characters are overwritten by the completion text and it is measured in UTF-16 code units. If missing the value 0 is assumed which results in the completion text being inserted. */ - length?: number; - /** Determines the start of the new selection after the text has been inserted (or replaced). `selectionStart` is measured in UTF-16 code units and must be in the range 0 and length of the completion text. If omitted the selection starts at the end of the completion text. */ - selectionStart?: number; - /** Determines the length of the new selection after the text has been inserted (or replaced) and it is measured in UTF-16 code units. The selection can not extend beyond the bounds of the completion text. If omitted the length is assumed to be 0. */ - selectionLength?: number; - } - - /** Some predefined types for the CompletionItem. Please note that not all clients have specific icons for all of them. */ - type CompletionItemType = - | "method" - | "function" - | "constructor" - | "field" - | "variable" - | "class" - | "interface" - | "module" - | "property" - | "unit" - | "value" - | "enum" - | "keyword" - | "snippet" - | "text" - | "color" - | "file" - | "reference" - | "customcolor"; - - /** Names of checksum algorithms that may be supported by a debug adapter. */ - type ChecksumAlgorithm = "MD5" | "SHA1" | "SHA256" | "timestamp"; - - /** The checksum of an item calculated by the specified algorithm. */ - interface Checksum { - /** The algorithm used to calculate this checksum. */ - algorithm: ChecksumAlgorithm; - /** Value of the checksum, encoded as a hexadecimal value. */ - checksum: string; - } - - /** Provides formatting information for a value. */ - interface ValueFormat { - /** Display the value in hex. */ - hex?: boolean; - } - - /** Provides formatting information for a stack frame. */ - interface StackFrameFormat extends ValueFormat { - /** Displays parameters for the stack frame. */ - parameters?: boolean; - /** Displays the types of parameters for the stack frame. */ - parameterTypes?: boolean; - /** Displays the names of parameters for the stack frame. */ - parameterNames?: boolean; - /** Displays the values of parameters for the stack frame. */ - parameterValues?: boolean; - /** Displays the line number of the stack frame. */ - line?: boolean; - /** Displays the module of the stack frame. */ - module?: boolean; - /** Includes all stack frames, including those the debug adapter might otherwise hide. */ - includeAll?: boolean; - } - - /** An `ExceptionFilterOptions` is used to specify an exception filter together with a condition for the `setExceptionBreakpoints` request. */ - interface ExceptionFilterOptions { - /** ID of an exception filter returned by the `exceptionBreakpointFilters` capability. */ - filterId: string; - /** An expression for conditional exceptions. - The exception breaks into the debugger if the result of the condition is true. - */ - condition?: string; - /** The mode of this exception breakpoint. If defined, this must be one of the `breakpointModes` the debug adapter advertised in its `Capabilities`. */ - mode?: string; - } - - /** An `ExceptionOptions` assigns configuration options to a set of exceptions. */ - interface ExceptionOptions { - /** A path that selects a single or multiple exceptions in a tree. If `path` is missing, the whole tree is selected. - By convention the first segment of the path is a category that is used to group exceptions in the UI. - */ - path?: ExceptionPathSegment[]; - /** Condition when a thrown exception should result in a break. */ - breakMode: ExceptionBreakMode; - } - - /** This enumeration defines all possible conditions when a thrown exception should result in a break. - never: never breaks, - always: always breaks, - unhandled: breaks when exception unhandled, - userUnhandled: breaks if the exception is not handled by user code. - */ - type ExceptionBreakMode = - | "never" - | "always" - | "unhandled" - | "userUnhandled"; - - /** An `ExceptionPathSegment` represents a segment in a path that is used to match leafs or nodes in a tree of exceptions. - If a segment consists of more than one name, it matches the names provided if `negate` is false or missing, or it matches anything except the names provided if `negate` is true. - */ - interface ExceptionPathSegment { - /** If false or missing this segment matches the names provided, otherwise it matches anything except the names provided. */ - negate?: boolean; - /** Depending on the value of `negate` the names that should match or not match. */ - names: string[]; - } - - /** Detailed information about an exception that has occurred. */ - interface ExceptionDetails { - /** Message contained in the exception. */ - message?: string; - /** Short type name of the exception object. */ - typeName?: string; - /** Fully-qualified type name of the exception object. */ - fullTypeName?: string; - /** An expression that can be evaluated in the current scope to obtain the exception object. */ - evaluateName?: string; - /** Stack trace at the time the exception was thrown. */ - stackTrace?: string; - /** Details of the exception contained by this exception, if any. */ - innerException?: ExceptionDetails[]; - } - - /** Represents a single disassembled instruction. */ - interface DisassembledInstruction { - /** The address of the instruction. Treated as a hex value if prefixed with `0x`, or as a decimal value otherwise. */ - address: string; - /** Raw bytes representing the instruction and its operands, in an implementation-defined format. */ - instructionBytes?: string; - /** Text representing the instruction and its operands, in an implementation-defined format. */ - instruction: string; - /** Name of the symbol that corresponds with the location of this instruction, if any. */ - symbol?: string; - /** Source location that corresponds to this instruction, if any. - Should always be set (if available) on the first instruction returned, - but can be omitted afterwards if this instruction maps to the same source file as the previous instruction. - */ - location?: Source; - /** The line within the source location that corresponds to this instruction, if any. */ - line?: number; - /** The column within the line that corresponds to this instruction, if any. */ - column?: number; - /** The end line of the range that corresponds to this instruction, if any. */ - endLine?: number; - /** The end column of the range that corresponds to this instruction, if any. */ - endColumn?: number; - /** A hint for how to present the instruction in the UI. - - A value of `invalid` may be used to indicate this instruction is 'filler' and cannot be reached by the program. For example, unreadable memory addresses may be presented is 'invalid.' - */ - presentationHint?: "normal" | "invalid"; - } - - /** Logical areas that can be invalidated by the `invalidated` event. - Values: - 'all': All previously fetched data has become invalid and needs to be refetched. - 'stacks': Previously fetched stack related data has become invalid and needs to be refetched. - 'threads': Previously fetched thread related data has become invalid and needs to be refetched. - 'variables': Previously fetched variable data has become invalid and needs to be refetched. - etc. - */ - type InvalidatedAreas = "all" | "stacks" | "threads" | "variables" | string; - - /** A `BreakpointMode` is provided as a option when setting breakpoints on sources or instructions. */ - interface BreakpointMode { - /** The internal ID of the mode. This value is passed to the `setBreakpoints` request. */ - mode: string; - /** The name of the breakpoint mode. This is shown in the UI. */ - label: string; - /** A help text providing additional information about the breakpoint mode. This string is typically shown as a hover and can be translated. */ - description?: string; - /** Describes one or more type of breakpoint this mode applies to. */ - appliesTo: BreakpointModeApplicability[]; - } - - /** Describes one or more type of breakpoint a `BreakpointMode` applies to. This is a non-exhaustive enumeration and may expand as future breakpoint types are added. - Values: - 'source': In `SourceBreakpoint`s - 'exception': In exception breakpoints applied in the `ExceptionFilterOptions` - 'data': In data breakpoints requested in the `DataBreakpointInfo` request - 'instruction': In `InstructionBreakpoint`s - etc. - */ - type BreakpointModeApplicability = - | "source" - | "exception" - | "data" - | "instruction" - | string; -} diff --git a/Example/Input/Editor/vs/workbench/contrib/terminal/browser/xterm-private.d.ts b/Example/Input/Editor/vs/workbench/contrib/terminal/browser/xterm-private.d.ts deleted file mode 100644 index 1124a63f..00000000 --- a/Example/Input/Editor/vs/workbench/contrib/terminal/browser/xterm-private.d.ts +++ /dev/null @@ -1,36 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -import { IBufferCell } from "@xterm/xterm"; - -export type XtermAttributes = Omit< - IBufferCell, - "getWidth" | "getChars" | "getCode" -> & { clone?(): XtermAttributes }; - -export interface IXtermCore { - viewport?: { - readonly scrollBarWidth: number; - _innerRefresh(): void; - }; - - _inputHandler: { - _curAttrData: XtermAttributes; - }; - - _renderService: { - dimensions: { - css: { - cell: { - width: number; - height: number; - }; - }; - }; - _renderer: { - value?: unknown; - }; - }; -} diff --git a/Example/Input/Editor/vs/workbench/contrib/webview/browser/webviewMessages.d.ts b/Example/Input/Editor/vs/workbench/contrib/webview/browser/webviewMessages.d.ts deleted file mode 100644 index 85fbcba3..00000000 --- a/Example/Input/Editor/vs/workbench/contrib/webview/browser/webviewMessages.d.ts +++ /dev/null @@ -1,125 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -import type { IMouseWheelEvent } from "vs/base/browser/mouseEvent"; -import type { WebviewStyles } from "vs/workbench/contrib/webview/browser/webview"; - -type KeyEvent = { - key: string; - keyCode: number; - code: string; - shiftKey: boolean; - altKey: boolean; - ctrlKey: boolean; - metaKey: boolean; - repeat: boolean; -}; - -type WebViewDragEvent = { - shiftKey: boolean; -}; - -export type FromWebviewMessage = { - "onmessage": { message: any; transfer?: ArrayBuffer[] }; - "did-click-link": { uri: string }; - "did-scroll": { scrollYPercentage: number }; - "did-focus": void; - "did-blur": void; - "did-load": void; - "did-find": { didFind: boolean }; - "do-update-state": string; - "do-reload": void; - "load-resource": { - id: number; - path: string; - query: string; - scheme: string; - authority: string; - ifNoneMatch?: string; - }; - "load-localhost": { id: string; origin: string }; - "did-scroll-wheel": IMouseWheelEvent; - "fatal-error": { message: string }; - "no-csp-found": void; - "did-keydown": KeyEvent; - "did-keyup": KeyEvent; - "did-context-menu": { - clientX: number; - clientY: number; - context: { [key: string]: unknown }; - }; - "drag-start": void; - "drag": WebViewDragEvent; -}; - -interface UpdateContentEvent { - contents: string; - title: string | undefined; - options: { - allowMultipleAPIAcquire: boolean; - allowScripts: boolean; - allowForms: boolean; - }; - state: any; - cspSource: string; - confirmBeforeClose: string; -} - -export type ToWebviewMessage = { - "focus": void; - "message": { message: any; transfer?: ArrayBuffer[] }; - "execCommand": string; - "did-load-resource": - | { id: number; status: 401 | 404; path: string } - | { - id: number; - status: 304; - path: string; - mime: string; - mtime: number | undefined; - } - | { - id: number; - status: 200; - path: string; - mime: string; - data: any; - etag: string | undefined; - mtime: number | undefined; - }; - "did-load-localhost": { - id: string; - origin: string; - location: string | undefined; - }; - "set-confirm-before-close": string; - "set-context-menu-visible": { visible: boolean }; - "initial-scroll-position": number; - "content": UpdateContentEvent; - "set-title": string | undefined; - "styles": { - styles: WebviewStyles; - activeTheme: string; - themeId: string; - themeLabel: string; - reduceMotion: boolean; - screenReader: boolean; - }; - "find": { value: string; previous?: boolean }; - "find-stop": { clearSelection?: boolean }; -}; - -export interface WebviewHostMessaging { - postMessage( - channel: K, - data: FromWebviewMessage[K], - transfer?: [], - ): void; - - onMessage( - channel: K, - handler: (e: Event, data: ToWebviewMessage[K]) => void, - ): void; -} diff --git a/Example/Input/Editor/vscode-dts/vscode.d.ts b/Example/Input/Editor/vscode-dts/vscode.d.ts deleted file mode 100644 index 7671ead0..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.d.ts +++ /dev/null @@ -1,21097 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module "vscode" { - /** - * The version of the editor. - */ - export const version: string; - - /** - * Represents a reference to a command. Provides a title which - * will be used to represent a command in the UI and, optionally, - * an array of arguments which will be passed to the command handler - * function when invoked. - */ - export interface Command { - /** - * Title of the command, like `save`. - */ - title: string; - - /** - * The identifier of the actual command handler. - * @see {@link commands.registerCommand} - */ - command: string; - - /** - * A tooltip for the command, when represented in the UI. - */ - tooltip?: string; - - /** - * Arguments that the command handler should be - * invoked with. - */ - arguments?: any[]; - } - - /** - * Represents a line of text, such as a line of source code. - * - * TextLine objects are __immutable__. When a {@link TextDocument document} changes, - * previously retrieved lines will not represent the latest state. - */ - export interface TextLine { - /** - * The zero-based line number. - */ - readonly lineNumber: number; - - /** - * The text of this line without the line separator characters. - */ - readonly text: string; - - /** - * The range this line covers without the line separator characters. - */ - readonly range: Range; - - /** - * The range this line covers with the line separator characters. - */ - readonly rangeIncludingLineBreak: Range; - - /** - * The offset of the first character which is not a whitespace character as defined - * by `/\s/`. **Note** that if a line is all whitespace the length of the line is returned. - */ - readonly firstNonWhitespaceCharacterIndex: number; - - /** - * Whether this line is whitespace only, shorthand - * for {@link TextLine.firstNonWhitespaceCharacterIndex} === {@link TextLine.text TextLine.text.length}. - */ - readonly isEmptyOrWhitespace: boolean; - } - - /** - * Represents a text document, such as a source file. Text documents have - * {@link TextLine lines} and knowledge about an underlying resource like a file. - */ - export interface TextDocument { - /** - * The associated uri for this document. - * - * *Note* that most documents use the `file`-scheme, which means they are files on disk. However, **not** all documents are - * saved on disk and therefore the `scheme` must be checked before trying to access the underlying file or siblings on disk. - * - * @see {@link FileSystemProvider} - * @see {@link TextDocumentContentProvider} - */ - readonly uri: Uri; - - /** - * The file system path of the associated resource. Shorthand - * notation for {@link TextDocument.uri TextDocument.uri.fsPath}. Independent of the uri scheme. - */ - readonly fileName: string; - - /** - * Is this document representing an untitled file which has never been saved yet. *Note* that - * this does not mean the document will be saved to disk, use {@linkcode Uri.scheme} - * to figure out where a document will be {@link FileSystemProvider saved}, e.g. `file`, `ftp` etc. - */ - readonly isUntitled: boolean; - - /** - * The identifier of the language associated with this document. - */ - readonly languageId: string; - - /** - * The version number of this document (it will strictly increase after each - * change, including undo/redo). - */ - readonly version: number; - - /** - * `true` if there are unpersisted changes. - */ - readonly isDirty: boolean; - - /** - * `true` if the document has been closed. A closed document isn't synchronized anymore - * and won't be re-used when the same resource is opened again. - */ - readonly isClosed: boolean; - - /** - * Save the underlying file. - * - * @returns A promise that will resolve to `true` when the file - * has been saved. If the save failed, will return `false`. - */ - save(): Thenable; - - /** - * The {@link EndOfLine end of line} sequence that is predominately - * used in this document. - */ - readonly eol: EndOfLine; - - /** - * The number of lines in this document. - */ - readonly lineCount: number; - - /** - * Returns a text line denoted by the line number. Note - * that the returned object is *not* live and changes to the - * document are not reflected. - * - * @param line A line number in `[0, lineCount)`. - * @returns A {@link TextLine line}. - */ - lineAt(line: number): TextLine; - - /** - * Returns a text line denoted by the position. Note - * that the returned object is *not* live and changes to the - * document are not reflected. - * - * The position will be {@link TextDocument.validatePosition adjusted}. - * - * @see {@link TextDocument.lineAt} - * - * @param position A position. - * @returns A {@link TextLine line}. - */ - lineAt(position: Position): TextLine; - - /** - * Converts the position to a zero-based offset. - * - * The position will be {@link TextDocument.validatePosition adjusted}. - * - * @param position A position. - * @returns A valid zero-based offset. - */ - offsetAt(position: Position): number; - - /** - * Converts a zero-based offset to a position. - * - * @param offset A zero-based offset. - * @returns A valid {@link Position}. - */ - positionAt(offset: number): Position; - - /** - * Get the text of this document. A substring can be retrieved by providing - * a range. The range will be {@link TextDocument.validateRange adjusted}. - * - * @param range Include only the text included by the range. - * @returns The text inside the provided range or the entire text. - */ - getText(range?: Range): string; - - /** - * Get a word-range at the given position. By default words are defined by - * common separators, like space, -, _, etc. In addition, per language custom - * [word definitions] can be defined. It - * is also possible to provide a custom regular expression. - * - * * *Note 1:* A custom regular expression must not match the empty string and - * if it does, it will be ignored. - * * *Note 2:* A custom regular expression will fail to match multiline strings - * and in the name of speed regular expressions should not match words with - * spaces. Use {@linkcode TextLine.text} for more complex, non-wordy, scenarios. - * - * The position will be {@link TextDocument.validatePosition adjusted}. - * - * @param position A position. - * @param regex Optional regular expression that describes what a word is. - * @returns A range spanning a word, or `undefined`. - */ - getWordRangeAtPosition( - position: Position, - regex?: RegExp, - ): Range | undefined; - - /** - * Ensure a range is completely contained in this document. - * - * @param range A range. - * @returns The given range or a new, adjusted range. - */ - validateRange(range: Range): Range; - - /** - * Ensure a position is contained in the range of this document. - * - * @param position A position. - * @returns The given position or a new, adjusted position. - */ - validatePosition(position: Position): Position; - } - - /** - * Represents a line and character position, such as - * the position of the cursor. - * - * Position objects are __immutable__. Use the {@link Position.with with} or - * {@link Position.translate translate} methods to derive new positions - * from an existing position. - */ - export class Position { - /** - * The zero-based line value. - */ - readonly line: number; - - /** - * The zero-based character value. - */ - readonly character: number; - - /** - * @param line A zero-based line value. - * @param character A zero-based character value. - */ - constructor(line: number, character: number); - - /** - * Check if this position is before `other`. - * - * @param other A position. - * @returns `true` if position is on a smaller line - * or on the same line on a smaller character. - */ - isBefore(other: Position): boolean; - - /** - * Check if this position is before or equal to `other`. - * - * @param other A position. - * @returns `true` if position is on a smaller line - * or on the same line on a smaller or equal character. - */ - isBeforeOrEqual(other: Position): boolean; - - /** - * Check if this position is after `other`. - * - * @param other A position. - * @returns `true` if position is on a greater line - * or on the same line on a greater character. - */ - isAfter(other: Position): boolean; - - /** - * Check if this position is after or equal to `other`. - * - * @param other A position. - * @returns `true` if position is on a greater line - * or on the same line on a greater or equal character. - */ - isAfterOrEqual(other: Position): boolean; - - /** - * Check if this position is equal to `other`. - * - * @param other A position. - * @returns `true` if the line and character of the given position are equal to - * the line and character of this position. - */ - isEqual(other: Position): boolean; - - /** - * Compare this to `other`. - * - * @param other A position. - * @returns A number smaller than zero if this position is before the given position, - * a number greater than zero if this position is after the given position, or zero when - * this and the given position are equal. - */ - compareTo(other: Position): number; - - /** - * Create a new position relative to this position. - * - * @param lineDelta Delta value for the line value, default is `0`. - * @param characterDelta Delta value for the character value, default is `0`. - * @returns A position which line and character is the sum of the current line and - * character and the corresponding deltas. - */ - translate(lineDelta?: number, characterDelta?: number): Position; - - /** - * Derived a new position relative to this position. - * - * @param change An object that describes a delta to this position. - * @returns A position that reflects the given delta. Will return `this` position if the change - * is not changing anything. - */ - translate(change: { - /** - * Delta value for the line value, default is `0`. - */ - lineDelta?: number; - /** - * Delta value for the character value, default is `0`. - */ - characterDelta?: number; - }): Position; - - /** - * Create a new position derived from this position. - * - * @param line Value that should be used as line value, default is the {@link Position.line existing value} - * @param character Value that should be used as character value, default is the {@link Position.character existing value} - * @returns A position where line and character are replaced by the given values. - */ - with(line?: number, character?: number): Position; - - /** - * Derived a new position from this position. - * - * @param change An object that describes a change to this position. - * @returns A position that reflects the given change. Will return `this` position if the change - * is not changing anything. - */ - with(change: { - /** - * New line value, defaults the line value of `this`. - */ - line?: number; - /** - * New character value, defaults the character value of `this`. - */ - character?: number; - }): Position; - } - - /** - * A range represents an ordered pair of two positions. - * It is guaranteed that {@link Range.start start}.isBeforeOrEqual({@link Range.end end}) - * - * Range objects are __immutable__. Use the {@link Range.with with}, - * {@link Range.intersection intersection}, or {@link Range.union union} methods - * to derive new ranges from an existing range. - */ - export class Range { - /** - * The start position. It is before or equal to {@link Range.end end}. - */ - readonly start: Position; - - /** - * The end position. It is after or equal to {@link Range.start start}. - */ - readonly end: Position; - - /** - * Create a new range from two positions. If `start` is not - * before or equal to `end`, the values will be swapped. - * - * @param start A position. - * @param end A position. - */ - constructor(start: Position, end: Position); - - /** - * Create a new range from number coordinates. It is a shorter equivalent of - * using `new Range(new Position(startLine, startCharacter), new Position(endLine, endCharacter))` - * - * @param startLine A zero-based line value. - * @param startCharacter A zero-based character value. - * @param endLine A zero-based line value. - * @param endCharacter A zero-based character value. - */ - constructor( - startLine: number, - startCharacter: number, - endLine: number, - endCharacter: number, - ); - - /** - * `true` if `start` and `end` are equal. - */ - isEmpty: boolean; - - /** - * `true` if `start.line` and `end.line` are equal. - */ - isSingleLine: boolean; - - /** - * Check if a position or a range is contained in this range. - * - * @param positionOrRange A position or a range. - * @returns `true` if the position or range is inside or equal - * to this range. - */ - contains(positionOrRange: Position | Range): boolean; - - /** - * Check if `other` equals this range. - * - * @param other A range. - * @returns `true` when start and end are {@link Position.isEqual equal} to - * start and end of this range. - */ - isEqual(other: Range): boolean; - - /** - * Intersect `range` with this range and returns a new range or `undefined` - * if the ranges have no overlap. - * - * @param range A range. - * @returns A range of the greater start and smaller end positions. Will - * return undefined when there is no overlap. - */ - intersection(range: Range): Range | undefined; - - /** - * Compute the union of `other` with this range. - * - * @param other A range. - * @returns A range of smaller start position and the greater end position. - */ - union(other: Range): Range; - - /** - * Derived a new range from this range. - * - * @param start A position that should be used as start. The default value is the {@link Range.start current start}. - * @param end A position that should be used as end. The default value is the {@link Range.end current end}. - * @returns A range derived from this range with the given start and end position. - * If start and end are not different `this` range will be returned. - */ - with(start?: Position, end?: Position): Range; - - /** - * Derived a new range from this range. - * - * @param change An object that describes a change to this range. - * @returns A range that reflects the given change. Will return `this` range if the change - * is not changing anything. - */ - with(change: { - /** - * New start position, defaults to {@link Range.start current start} - */ - start?: Position; - /** - * New end position, defaults to {@link Range.end current end} - */ - end?: Position; - }): Range; - } - - /** - * Represents a text selection in an editor. - */ - export class Selection extends Range { - /** - * The position at which the selection starts. - * This position might be before or after {@link Selection.active active}. - */ - anchor: Position; - - /** - * The position of the cursor. - * This position might be before or after {@link Selection.anchor anchor}. - */ - active: Position; - - /** - * Create a selection from two positions. - * - * @param anchor A position. - * @param active A position. - */ - constructor(anchor: Position, active: Position); - - /** - * Create a selection from four coordinates. - * - * @param anchorLine A zero-based line value. - * @param anchorCharacter A zero-based character value. - * @param activeLine A zero-based line value. - * @param activeCharacter A zero-based character value. - */ - constructor( - anchorLine: number, - anchorCharacter: number, - activeLine: number, - activeCharacter: number, - ); - - /** - * A selection is reversed if its {@link Selection.anchor anchor} is the {@link Selection.end end} position. - */ - isReversed: boolean; - } - - /** - * Represents sources that can cause {@link window.onDidChangeTextEditorSelection selection change events}. - */ - export enum TextEditorSelectionChangeKind { - /** - * Selection changed due to typing in the editor. - */ - Keyboard = 1, - /** - * Selection change due to clicking in the editor. - */ - Mouse = 2, - /** - * Selection changed because a command ran. - */ - Command = 3, - } - - /** - * Represents an event describing the change in a {@link TextEditor.selections text editor's selections}. - */ - export interface TextEditorSelectionChangeEvent { - /** - * The {@link TextEditor text editor} for which the selections have changed. - */ - readonly textEditor: TextEditor; - /** - * The new value for the {@link TextEditor.selections text editor's selections}. - */ - readonly selections: readonly Selection[]; - /** - * The {@link TextEditorSelectionChangeKind change kind} which has triggered this - * event. Can be `undefined`. - */ - readonly kind: TextEditorSelectionChangeKind | undefined; - } - - /** - * Represents an event describing the change in a {@link TextEditor.visibleRanges text editor's visible ranges}. - */ - export interface TextEditorVisibleRangesChangeEvent { - /** - * The {@link TextEditor text editor} for which the visible ranges have changed. - */ - readonly textEditor: TextEditor; - /** - * The new value for the {@link TextEditor.visibleRanges text editor's visible ranges}. - */ - readonly visibleRanges: readonly Range[]; - } - - /** - * Represents an event describing the change in a {@link TextEditor.options text editor's options}. - */ - export interface TextEditorOptionsChangeEvent { - /** - * The {@link TextEditor text editor} for which the options have changed. - */ - readonly textEditor: TextEditor; - /** - * The new value for the {@link TextEditor.options text editor's options}. - */ - readonly options: TextEditorOptions; - } - - /** - * Represents an event describing the change of a {@link TextEditor.viewColumn text editor's view column}. - */ - export interface TextEditorViewColumnChangeEvent { - /** - * The {@link TextEditor text editor} for which the view column has changed. - */ - readonly textEditor: TextEditor; - /** - * The new value for the {@link TextEditor.viewColumn text editor's view column}. - */ - readonly viewColumn: ViewColumn; - } - - /** - * Rendering style of the cursor. - */ - export enum TextEditorCursorStyle { - /** - * Render the cursor as a vertical thick line. - */ - Line = 1, - /** - * Render the cursor as a block filled. - */ - Block = 2, - /** - * Render the cursor as a thick horizontal line. - */ - Underline = 3, - /** - * Render the cursor as a vertical thin line. - */ - LineThin = 4, - /** - * Render the cursor as a block outlined. - */ - BlockOutline = 5, - /** - * Render the cursor as a thin horizontal line. - */ - UnderlineThin = 6, - } - - /** - * Rendering style of the line numbers. - */ - export enum TextEditorLineNumbersStyle { - /** - * Do not render the line numbers. - */ - Off = 0, - /** - * Render the line numbers. - */ - On = 1, - /** - * Render the line numbers with values relative to the primary cursor location. - */ - Relative = 2, - /** - * Render the line numbers on every 10th line number. - */ - Interval = 3, - } - - /** - * Represents a {@link TextEditor text editor}'s {@link TextEditor.options options}. - */ - export interface TextEditorOptions { - /** - * The size in spaces a tab takes. This is used for two purposes: - * - the rendering width of a tab character; - * - the number of spaces to insert when {@link TextEditorOptions.insertSpaces insertSpaces} is true - * and `indentSize` is set to `"tabSize"`. - * - * When getting a text editor's options, this property will always be a number (resolved). - * When setting a text editor's options, this property is optional and it can be a number or `"auto"`. - */ - tabSize?: number | string; - - /** - * The number of spaces to insert when {@link TextEditorOptions.insertSpaces insertSpaces} is true. - * - * When getting a text editor's options, this property will always be a number (resolved). - * When setting a text editor's options, this property is optional and it can be a number or `"tabSize"`. - */ - indentSize?: number | string; - - /** - * When pressing Tab insert {@link TextEditorOptions.tabSize n} spaces. - * When getting a text editor's options, this property will always be a boolean (resolved). - * When setting a text editor's options, this property is optional and it can be a boolean or `"auto"`. - */ - insertSpaces?: boolean | string; - - /** - * The rendering style of the cursor in this editor. - * When getting a text editor's options, this property will always be present. - * When setting a text editor's options, this property is optional. - */ - cursorStyle?: TextEditorCursorStyle; - - /** - * Render relative line numbers w.r.t. the current line number. - * When getting a text editor's options, this property will always be present. - * When setting a text editor's options, this property is optional. - */ - lineNumbers?: TextEditorLineNumbersStyle; - } - - /** - * Represents a handle to a set of decorations - * sharing the same {@link DecorationRenderOptions styling options} in a {@link TextEditor text editor}. - * - * To get an instance of a `TextEditorDecorationType` use - * {@link window.createTextEditorDecorationType createTextEditorDecorationType}. - */ - export interface TextEditorDecorationType { - /** - * Internal representation of the handle. - */ - readonly key: string; - - /** - * Remove this decoration type and all decorations on all text editors using it. - */ - dispose(): void; - } - - /** - * Represents different {@link TextEditor.revealRange reveal} strategies in a text editor. - */ - export enum TextEditorRevealType { - /** - * The range will be revealed with as little scrolling as possible. - */ - Default = 0, - /** - * The range will always be revealed in the center of the viewport. - */ - InCenter = 1, - /** - * If the range is outside the viewport, it will be revealed in the center of the viewport. - * Otherwise, it will be revealed with as little scrolling as possible. - */ - InCenterIfOutsideViewport = 2, - /** - * The range will always be revealed at the top of the viewport. - */ - AtTop = 3, - } - - /** - * Represents different positions for rendering a decoration in an {@link DecorationRenderOptions.overviewRulerLane overview ruler}. - * The overview ruler supports three lanes. - */ - export enum OverviewRulerLane { - /** - * The left lane of the overview ruler. - */ - Left = 1, - /** - * The center lane of the overview ruler. - */ - Center = 2, - /** - * The right lane of the overview ruler. - */ - Right = 4, - /** - * All lanes of the overview ruler. - */ - Full = 7, - } - - /** - * Describes the behavior of decorations when typing/editing at their edges. - */ - export enum DecorationRangeBehavior { - /** - * The decoration's range will widen when edits occur at the start or end. - */ - OpenOpen = 0, - /** - * The decoration's range will not widen when edits occur at the start or end. - */ - ClosedClosed = 1, - /** - * The decoration's range will widen when edits occur at the start, but not at the end. - */ - OpenClosed = 2, - /** - * The decoration's range will widen when edits occur at the end, but not at the start. - */ - ClosedOpen = 3, - } - - /** - * Represents options to configure the behavior of showing a {@link TextDocument document} in an {@link TextEditor editor}. - */ - export interface TextDocumentShowOptions { - /** - * An optional view column in which the {@link TextEditor editor} should be shown. - * The default is the {@link ViewColumn.Active active}. Columns that do not exist - * will be created as needed up to the maximum of {@linkcode ViewColumn.Nine}. - * Use {@linkcode ViewColumn.Beside} to open the editor to the side of the currently - * active one. - */ - viewColumn?: ViewColumn; - - /** - * An optional flag that when `true` will stop the {@link TextEditor editor} from taking focus. - */ - preserveFocus?: boolean; - - /** - * An optional flag that controls if an {@link TextEditor editor}-tab shows as preview. Preview tabs will - * be replaced and reused until set to stay - either explicitly or through editing. - * - * *Note* that the flag is ignored if a user has disabled preview editors in settings. - */ - preview?: boolean; - - /** - * An optional selection to apply for the document in the {@link TextEditor editor}. - */ - selection?: Range; - } - - /** - * Represents an event describing the change in a {@link NotebookEditor.selections notebook editor's selections}. - */ - export interface NotebookEditorSelectionChangeEvent { - /** - * The {@link NotebookEditor notebook editor} for which the selections have changed. - */ - readonly notebookEditor: NotebookEditor; - - /** - * The new value for the {@link NotebookEditor.selections notebook editor's selections}. - */ - readonly selections: readonly NotebookRange[]; - } - - /** - * Represents an event describing the change in a {@link NotebookEditor.visibleRanges notebook editor's visibleRanges}. - */ - export interface NotebookEditorVisibleRangesChangeEvent { - /** - * The {@link NotebookEditor notebook editor} for which the visible ranges have changed. - */ - readonly notebookEditor: NotebookEditor; - - /** - * The new value for the {@link NotebookEditor.visibleRanges notebook editor's visibleRanges}. - */ - readonly visibleRanges: readonly NotebookRange[]; - } - - /** - * Represents options to configure the behavior of showing a {@link NotebookDocument notebook document} in an {@link NotebookEditor notebook editor}. - */ - export interface NotebookDocumentShowOptions { - /** - * An optional view column in which the {@link NotebookEditor notebook editor} should be shown. - * The default is the {@link ViewColumn.Active active}. Columns that do not exist - * will be created as needed up to the maximum of {@linkcode ViewColumn.Nine}. - * Use {@linkcode ViewColumn.Beside} to open the editor to the side of the currently - * active one. - */ - readonly viewColumn?: ViewColumn; - - /** - * An optional flag that when `true` will stop the {@link NotebookEditor notebook editor} from taking focus. - */ - readonly preserveFocus?: boolean; - - /** - * An optional flag that controls if an {@link NotebookEditor notebook editor}-tab shows as preview. Preview tabs will - * be replaced and reused until set to stay - either explicitly or through editing. The default behaviour depends - * on the `workbench.editor.enablePreview`-setting. - */ - readonly preview?: boolean; - - /** - * An optional selection to apply for the document in the {@link NotebookEditor notebook editor}. - */ - readonly selections?: readonly NotebookRange[]; - } - - /** - * A reference to one of the workbench colors as defined in https://code.visualstudio.com/api/references/theme-color. - * Using a theme color is preferred over a custom color as it gives theme authors and users the possibility to change the color. - */ - export class ThemeColor { - /** - * The id of this color. - */ - readonly id: string; - - /** - * Creates a reference to a theme color. - * @param id of the color. The available colors are listed in https://code.visualstudio.com/api/references/theme-color. - */ - constructor(id: string); - } - - /** - * A reference to a named icon. Currently, {@link ThemeIcon.File File}, {@link ThemeIcon.Folder Folder}, - * and [ThemeIcon ids](https://code.visualstudio.com/api/references/icons-in-labels#icon-listing) are supported. - * Using a theme icon is preferred over a custom icon as it gives product theme authors the possibility to change the icons. - * - * *Note* that theme icons can also be rendered inside labels and descriptions. Places that support theme icons spell this out - * and they use the `$()`-syntax, for instance `quickPick.label = "Hello World $(globe)"`. - */ - export class ThemeIcon { - /** - * Reference to an icon representing a file. The icon is taken from the current file icon theme or a placeholder icon is used. - */ - static readonly File: ThemeIcon; - - /** - * Reference to an icon representing a folder. The icon is taken from the current file icon theme or a placeholder icon is used. - */ - static readonly Folder: ThemeIcon; - - /** - * The id of the icon. The available icons are listed in https://code.visualstudio.com/api/references/icons-in-labels#icon-listing. - */ - readonly id: string; - - /** - * The optional ThemeColor of the icon. The color is currently only used in {@link TreeItem}. - */ - readonly color?: ThemeColor | undefined; - - /** - * Creates a reference to a theme icon. - * @param id id of the icon. The available icons are listed in https://code.visualstudio.com/api/references/icons-in-labels#icon-listing. - * @param color optional `ThemeColor` for the icon. The color is currently only used in {@link TreeItem}. - */ - constructor(id: string, color?: ThemeColor); - } - - /** - * Represents an icon in the UI. This is either an uri, separate uris for the light- and dark-themes, - * or a {@link ThemeIcon theme icon}. - */ - export type IconPath = - | Uri - | { - /** - * The icon path for the light theme. - */ - light: Uri; - /** - * The icon path for the dark theme. - */ - dark: Uri; - } - | ThemeIcon; - - /** - * Represents theme specific rendering styles for a {@link TextEditorDecorationType text editor decoration}. - */ - export interface ThemableDecorationRenderOptions { - /** - * Background color of the decoration. Use rgba() and define transparent background colors to play well with other decorations. - * Alternatively a color from the color registry can be {@link ThemeColor referenced}. - */ - backgroundColor?: string | ThemeColor; - - /** - * CSS styling property that will be applied to text enclosed by a decoration. - */ - outline?: string; - - /** - * CSS styling property that will be applied to text enclosed by a decoration. - * Better use 'outline' for setting one or more of the individual outline properties. - */ - outlineColor?: string | ThemeColor; - - /** - * CSS styling property that will be applied to text enclosed by a decoration. - * Better use 'outline' for setting one or more of the individual outline properties. - */ - outlineStyle?: string; - - /** - * CSS styling property that will be applied to text enclosed by a decoration. - * Better use 'outline' for setting one or more of the individual outline properties. - */ - outlineWidth?: string; - - /** - * CSS styling property that will be applied to text enclosed by a decoration. - */ - border?: string; - - /** - * CSS styling property that will be applied to text enclosed by a decoration. - * Better use 'border' for setting one or more of the individual border properties. - */ - borderColor?: string | ThemeColor; - - /** - * CSS styling property that will be applied to text enclosed by a decoration. - * Better use 'border' for setting one or more of the individual border properties. - */ - borderRadius?: string; - - /** - * CSS styling property that will be applied to text enclosed by a decoration. - * Better use 'border' for setting one or more of the individual border properties. - */ - borderSpacing?: string; - - /** - * CSS styling property that will be applied to text enclosed by a decoration. - * Better use 'border' for setting one or more of the individual border properties. - */ - borderStyle?: string; - - /** - * CSS styling property that will be applied to text enclosed by a decoration. - * Better use 'border' for setting one or more of the individual border properties. - */ - borderWidth?: string; - - /** - * CSS styling property that will be applied to text enclosed by a decoration. - */ - fontStyle?: string; - - /** - * CSS styling property that will be applied to text enclosed by a decoration. - */ - fontWeight?: string; - - /** - * CSS styling property that will be applied to text enclosed by a decoration. - */ - textDecoration?: string; - - /** - * CSS styling property that will be applied to text enclosed by a decoration. - */ - cursor?: string; - - /** - * CSS styling property that will be applied to text enclosed by a decoration. - */ - color?: string | ThemeColor; - - /** - * CSS styling property that will be applied to text enclosed by a decoration. - */ - opacity?: string; - - /** - * CSS styling property that will be applied to text enclosed by a decoration. - */ - letterSpacing?: string; - - /** - * An **absolute path** or an URI to an image to be rendered in the gutter. - */ - gutterIconPath?: string | Uri; - - /** - * Specifies the size of the gutter icon. - * Available values are 'auto', 'contain', 'cover' and any percentage value. - * For further information: https://msdn.microsoft.com/en-us/library/jj127316(v=vs.85).aspx - */ - gutterIconSize?: string; - - /** - * The color of the decoration in the overview ruler. Use rgba() and define transparent colors to play well with other decorations. - */ - overviewRulerColor?: string | ThemeColor; - - /** - * Defines the rendering options of the attachment that is inserted before the decorated text. - */ - before?: ThemableDecorationAttachmentRenderOptions; - - /** - * Defines the rendering options of the attachment that is inserted after the decorated text. - */ - after?: ThemableDecorationAttachmentRenderOptions; - } - - /** - * Represents theme specific rendering styles for {@link ThemableDecorationRenderOptions.before before} and - * {@link ThemableDecorationRenderOptions.after after} the content of text decorations. - */ - export interface ThemableDecorationAttachmentRenderOptions { - /** - * Defines a text content that is shown in the attachment. Either an icon or a text can be shown, but not both. - */ - contentText?: string; - /** - * An **absolute path** or an URI to an image to be rendered in the attachment. Either an icon - * or a text can be shown, but not both. - */ - contentIconPath?: string | Uri; - /** - * CSS styling property that will be applied to the decoration attachment. - */ - border?: string; - /** - * CSS styling property that will be applied to text enclosed by a decoration. - */ - borderColor?: string | ThemeColor; - /** - * CSS styling property that will be applied to the decoration attachment. - */ - fontStyle?: string; - /** - * CSS styling property that will be applied to the decoration attachment. - */ - fontWeight?: string; - /** - * CSS styling property that will be applied to the decoration attachment. - */ - textDecoration?: string; - /** - * CSS styling property that will be applied to the decoration attachment. - */ - color?: string | ThemeColor; - /** - * CSS styling property that will be applied to the decoration attachment. - */ - backgroundColor?: string | ThemeColor; - /** - * CSS styling property that will be applied to the decoration attachment. - */ - margin?: string; - /** - * CSS styling property that will be applied to the decoration attachment. - */ - width?: string; - /** - * CSS styling property that will be applied to the decoration attachment. - */ - height?: string; - } - - /** - * Represents rendering styles for a {@link TextEditorDecorationType text editor decoration}. - */ - export interface DecorationRenderOptions - extends ThemableDecorationRenderOptions { - /** - * Should the decoration be rendered also on the whitespace after the line text. - * Defaults to `false`. - */ - isWholeLine?: boolean; - - /** - * Customize the growing behavior of the decoration when edits occur at the edges of the decoration's range. - * Defaults to `DecorationRangeBehavior.OpenOpen`. - */ - rangeBehavior?: DecorationRangeBehavior; - - /** - * The position in the overview ruler where the decoration should be rendered. - */ - overviewRulerLane?: OverviewRulerLane; - - /** - * Overwrite options for light themes. - */ - light?: ThemableDecorationRenderOptions; - - /** - * Overwrite options for dark themes. - */ - dark?: ThemableDecorationRenderOptions; - } - - /** - * Represents options for a specific decoration in a {@link TextEditorDecorationType decoration set}. - */ - export interface DecorationOptions { - /** - * Range to which this decoration is applied. The range must not be empty. - */ - range: Range; - - /** - * A message that should be rendered when hovering over the decoration. - */ - hoverMessage?: - | MarkdownString - | MarkedString - | Array; - - /** - * Render options applied to the current decoration. For performance reasons, keep the - * number of decoration specific options small, and use decoration types wherever possible. - */ - renderOptions?: DecorationInstanceRenderOptions; - } - - /** - * Represents themable render options for decoration instances. - */ - export interface ThemableDecorationInstanceRenderOptions { - /** - * Defines the rendering options of the attachment that is inserted before the decorated text. - */ - before?: ThemableDecorationAttachmentRenderOptions; - - /** - * Defines the rendering options of the attachment that is inserted after the decorated text. - */ - after?: ThemableDecorationAttachmentRenderOptions; - } - - /** - * Represents render options for decoration instances. See {@link DecorationOptions.renderOptions}. - */ - export interface DecorationInstanceRenderOptions - extends ThemableDecorationInstanceRenderOptions { - /** - * Overwrite options for light themes. - */ - light?: ThemableDecorationInstanceRenderOptions; - - /** - * Overwrite options for dark themes. - */ - dark?: ThemableDecorationInstanceRenderOptions; - } - - /** - * Represents an editor that is attached to a {@link TextDocument document}. - */ - export interface TextEditor { - /** - * The document associated with this text editor. The document will be the same for the entire lifetime of this text editor. - */ - readonly document: TextDocument; - - /** - * The primary selection on this text editor. Shorthand for `TextEditor.selections[0]`. - */ - selection: Selection; - - /** - * The selections in this text editor. The primary selection is always at index 0. - */ - selections: readonly Selection[]; - - /** - * The current visible ranges in the editor (vertically). - * This accounts only for vertical scrolling, and not for horizontal scrolling. - */ - readonly visibleRanges: readonly Range[]; - - /** - * Text editor options. - */ - options: TextEditorOptions; - - /** - * The column in which this editor shows. Will be `undefined` in case this - * isn't one of the main editors, e.g. an embedded editor, or when the editor - * column is larger than three. - */ - readonly viewColumn: ViewColumn | undefined; - - /** - * Perform an edit on the document associated with this text editor. - * - * The given callback-function is invoked with an {@link TextEditorEdit edit-builder} which must - * be used to make edits. Note that the edit-builder is only valid while the - * callback executes. - * - * @param callback A function which can create edits using an {@link TextEditorEdit edit-builder}. - * @param options The undo/redo behavior around this edit. By default, undo stops will be created before and after this edit. - * @returns A promise that resolves with a value indicating if the edits could be applied. - */ - edit( - callback: (editBuilder: TextEditorEdit) => void, - options?: { - /** - * Add undo stop before making the edits. - */ - readonly undoStopBefore: boolean; - /** - * Add undo stop after making the edits. - */ - readonly undoStopAfter: boolean; - }, - ): Thenable; - - /** - * Insert a {@link SnippetString snippet} and put the editor into snippet mode. "Snippet mode" - * means the editor adds placeholders and additional cursors so that the user can complete - * or accept the snippet. - * - * @param snippet The snippet to insert in this edit. - * @param location Position or range at which to insert the snippet, defaults to the current editor selection or selections. - * @param options The undo/redo behavior around this edit. By default, undo stops will be created before and after this edit. - * @returns A promise that resolves with a value indicating if the snippet could be inserted. Note that the promise does not signal - * that the snippet is completely filled-in or accepted. - */ - insertSnippet( - snippet: SnippetString, - location?: - | Position - | Range - | readonly Position[] - | readonly Range[], - options?: { - /** - * Add undo stop before making the edits. - */ - readonly undoStopBefore: boolean; - /** - * Add undo stop after making the edits. - */ - readonly undoStopAfter: boolean; - }, - ): Thenable; - - /** - * Adds a set of decorations to the text editor. If a set of decorations already exists with - * the given {@link TextEditorDecorationType decoration type}, they will be replaced. If - * `rangesOrOptions` is empty, the existing decorations with the given {@link TextEditorDecorationType decoration type} - * will be removed. - * - * @see {@link window.createTextEditorDecorationType createTextEditorDecorationType}. - * - * @param decorationType A decoration type. - * @param rangesOrOptions Either {@link Range ranges} or more detailed {@link DecorationOptions options}. - */ - setDecorations( - decorationType: TextEditorDecorationType, - rangesOrOptions: readonly Range[] | readonly DecorationOptions[], - ): void; - - /** - * Scroll as indicated by `revealType` in order to reveal the given range. - * - * @param range A range. - * @param revealType The scrolling strategy for revealing `range`. - */ - revealRange(range: Range, revealType?: TextEditorRevealType): void; - - /** - * Show the text editor. - * - * @deprecated Use {@link window.showTextDocument} instead. - * - * @param column The {@link ViewColumn column} in which to show this editor. - * This method shows unexpected behavior and will be removed in the next major update. - */ - show(column?: ViewColumn): void; - - /** - * Hide the text editor. - * - * @deprecated Use the command `workbench.action.closeActiveEditor` instead. - * This method shows unexpected behavior and will be removed in the next major update. - */ - hide(): void; - } - - /** - * Represents an end of line character sequence in a {@link TextDocument document}. - */ - export enum EndOfLine { - /** - * The line feed `\n` character. - */ - LF = 1, - /** - * The carriage return line feed `\r\n` sequence. - */ - CRLF = 2, - } - - /** - * A complex edit that will be applied in one transaction on a TextEditor. - * This holds a description of the edits and if the edits are valid (i.e. no overlapping regions, document was not changed in the meantime, etc.) - * they can be applied on a {@link TextDocument document} associated with a {@link TextEditor text editor}. - */ - export interface TextEditorEdit { - /** - * Replace a certain text region with a new value. - * You can use `\r\n` or `\n` in `value` and they will be normalized to the current {@link TextDocument document}. - * - * @param location The range this operation should remove. - * @param value The new text this operation should insert after removing `location`. - */ - replace(location: Position | Range | Selection, value: string): void; - - /** - * Insert text at a location. - * You can use `\r\n` or `\n` in `value` and they will be normalized to the current {@link TextDocument document}. - * Although the equivalent text edit can be made with {@link TextEditorEdit.replace replace}, `insert` will produce a different resulting selection (it will get moved). - * - * @param location The position where the new text should be inserted. - * @param value The new text this operation should insert. - */ - insert(location: Position, value: string): void; - - /** - * Delete a certain text region. - * - * @param location The range this operation should remove. - */ - delete(location: Range | Selection): void; - - /** - * Set the end of line sequence. - * - * @param endOfLine The new end of line for the {@link TextDocument document}. - */ - setEndOfLine(endOfLine: EndOfLine): void; - } - - /** - * A universal resource identifier representing either a file on disk - * or another resource, like untitled resources. - */ - export class Uri { - /** - * Create an URI from a string, e.g. `http://www.example.com/some/path`, - * `file:///usr/home`, or `scheme:with/path`. - * - * *Note* that for a while uris without a `scheme` were accepted. That is not correct - * as all uris should have a scheme. To avoid breakage of existing code the optional - * `strict`-argument has been added. We *strongly* advise to use it, e.g. `Uri.parse('my:uri', true)` - * - * @see {@link Uri.toString} - * @param value The string value of an Uri. - * @param strict Throw an error when `value` is empty or when no `scheme` can be parsed. - * @returns A new Uri instance. - */ - static parse(value: string, strict?: boolean): Uri; - - /** - * Create an URI from a file system path. The {@link Uri.scheme scheme} - * will be `file`. - * - * The *difference* between {@link Uri.parse} and {@link Uri.file} is that the latter treats the argument - * as path, not as stringified-uri. E.g. `Uri.file(path)` is *not* the same as - * `Uri.parse('file://' + path)` because the path might contain characters that are - * interpreted (# and ?). See the following sample: - * ```ts - * const good = URI.file('/coding/c#/project1'); - * good.scheme === 'file'; - * good.path === '/coding/c#/project1'; - * good.fragment === ''; - * - * const bad = URI.parse('file://' + '/coding/c#/project1'); - * bad.scheme === 'file'; - * bad.path === '/coding/c'; // path is now broken - * bad.fragment === '/project1'; - * ``` - * - * @param path A file system or UNC path. - * @returns A new Uri instance. - */ - static file(path: string): Uri; - - /** - * Create a new uri which path is the result of joining - * the path of the base uri with the provided path segments. - * - * - Note 1: `joinPath` only affects the path component - * and all other components (scheme, authority, query, and fragment) are - * left as they are. - * - Note 2: The base uri must have a path; an error is thrown otherwise. - * - * The path segments are normalized in the following ways: - * - sequences of path separators (`/` or `\`) are replaced with a single separator - * - for `file`-uris on windows, the backslash-character (`\`) is considered a path-separator - * - the `..`-segment denotes the parent segment, the `.` denotes the current segment - * - paths have a root which always remains, for instance on windows drive-letters are roots - * so that is true: `joinPath(Uri.file('file:///c:/root'), '../../other').fsPath === 'c:/other'` - * - * @param base An uri. Must have a path. - * @param pathSegments One more more path fragments - * @returns A new uri which path is joined with the given fragments - */ - static joinPath(base: Uri, ...pathSegments: string[]): Uri; - - /** - * Create an URI from its component parts - * - * @see {@link Uri.toString} - * @param components The component parts of an Uri. - * @returns A new Uri instance. - */ - static from(components: { - /** - * The scheme of the uri - */ - readonly scheme: string; - /** - * The authority of the uri - */ - readonly authority?: string; - /** - * The path of the uri - */ - readonly path?: string; - /** - * The query string of the uri - */ - readonly query?: string; - /** - * The fragment identifier of the uri - */ - readonly fragment?: string; - }): Uri; - - /** - * Use the `file` and `parse` factory functions to create new `Uri` objects. - */ - private constructor( - scheme: string, - authority: string, - path: string, - query: string, - fragment: string, - ); - - /** - * Scheme is the `http` part of `http://www.example.com/some/path?query#fragment`. - * The part before the first colon. - */ - readonly scheme: string; - - /** - * Authority is the `www.example.com` part of `http://www.example.com/some/path?query#fragment`. - * The part between the first double slashes and the next slash. - */ - readonly authority: string; - - /** - * Path is the `/some/path` part of `http://www.example.com/some/path?query#fragment`. - */ - readonly path: string; - - /** - * Query is the `query` part of `http://www.example.com/some/path?query#fragment`. - */ - readonly query: string; - - /** - * Fragment is the `fragment` part of `http://www.example.com/some/path?query#fragment`. - */ - readonly fragment: string; - - /** - * The string representing the corresponding file system path of this Uri. - * - * Will handle UNC paths and normalize windows drive letters to lower-case. Also - * uses the platform specific path separator. - * - * * Will *not* validate the path for invalid characters and semantics. - * * Will *not* look at the scheme of this Uri. - * * The resulting string shall *not* be used for display purposes but - * for disk operations, like `readFile` et al. - * - * The *difference* to the {@linkcode Uri.path path}-property is the use of the platform specific - * path separator and the handling of UNC paths. The sample below outlines the difference: - * ```ts - * const u = URI.parse('file://server/c$/folder/file.txt') - * u.authority === 'server' - * u.path === '/c$/folder/file.txt' - * u.fsPath === '\\server\c$\folder\file.txt' - * ``` - */ - readonly fsPath: string; - - /** - * Derive a new Uri from this Uri. - * - * ```ts - * let file = Uri.parse('before:some/file/path'); - * let other = file.with({ scheme: 'after' }); - * assert.ok(other.toString() === 'after:some/file/path'); - * ``` - * - * @param change An object that describes a change to this Uri. To unset components use `null` or - * the empty string. - * @returns A new Uri that reflects the given change. Will return `this` Uri if the change - * is not changing anything. - */ - with(change: { - /** - * The new scheme, defaults to this Uri's scheme. - */ - scheme?: string; - /** - * The new authority, defaults to this Uri's authority. - */ - authority?: string; - /** - * The new path, defaults to this Uri's path. - */ - path?: string; - /** - * The new query, defaults to this Uri's query. - */ - query?: string; - /** - * The new fragment, defaults to this Uri's fragment. - */ - fragment?: string; - }): Uri; - - /** - * Returns a string representation of this Uri. The representation and normalization - * of a URI depends on the scheme. - * - * * The resulting string can be safely used with {@link Uri.parse}. - * * The resulting string shall *not* be used for display purposes. - * - * *Note* that the implementation will encode _aggressive_ which often leads to unexpected, - * but not incorrect, results. For instance, colons are encoded to `%3A` which might be unexpected - * in file-uri. Also `&` and `=` will be encoded which might be unexpected for http-uris. For stability - * reasons this cannot be changed anymore. If you suffer from too aggressive encoding you should use - * the `skipEncoding`-argument: `uri.toString(true)`. - * - * @param skipEncoding Do not percentage-encode the result, defaults to `false`. Note that - * the `#` and `?` characters occurring in the path will always be encoded. - * @returns A string representation of this Uri. - */ - toString(skipEncoding?: boolean): string; - - /** - * Returns a JSON representation of this Uri. - * - * @returns An object. - */ - toJSON(): any; - } - - /** - * A cancellation token is passed to an asynchronous or long running - * operation to request cancellation, like cancelling a request - * for completion items because the user continued to type. - * - * To get an instance of a `CancellationToken` use a - * {@link CancellationTokenSource}. - */ - export interface CancellationToken { - /** - * Is `true` when the token has been cancelled, `false` otherwise. - */ - isCancellationRequested: boolean; - - /** - * An {@link Event} which fires upon cancellation. - */ - onCancellationRequested: Event; - } - - /** - * A cancellation source creates and controls a {@link CancellationToken cancellation token}. - */ - export class CancellationTokenSource { - /** - * The cancellation token of this source. - */ - token: CancellationToken; - - /** - * Signal cancellation on the token. - */ - cancel(): void; - - /** - * Dispose object and free resources. - */ - dispose(): void; - } - - /** - * An error type that should be used to signal cancellation of an operation. - * - * This type can be used in response to a {@link CancellationToken cancellation token} - * being cancelled or when an operation is being cancelled by the - * executor of that operation. - */ - export class CancellationError extends Error { - /** - * Creates a new cancellation error. - */ - constructor(); - } - - /** - * Represents a type which can release resources, such - * as event listening or a timer. - */ - export class Disposable { - /** - * Combine many disposable-likes into one. You can use this method when having objects with - * a dispose function which aren't instances of `Disposable`. - * - * @param disposableLikes Objects that have at least a `dispose`-function member. Note that asynchronous - * dispose-functions aren't awaited. - * @returns Returns a new disposable which, upon dispose, will - * dispose all provided disposables. - */ - static from( - ...disposableLikes: { - /** - * Function to clean up resources. - */ - dispose: () => any; - }[] - ): Disposable; - - /** - * Creates a new disposable that calls the provided function - * on dispose. - * - * *Note* that an asynchronous function is not awaited. - * - * @param callOnDispose Function that disposes something. - */ - constructor(callOnDispose: () => any); - - /** - * Dispose this object. - */ - dispose(): any; - } - - /** - * Represents a typed event. - * - * A function that represents an event to which you subscribe by calling it with - * a listener function as argument. - * - * @example - * item.onDidChange(function(event) { console.log("Event happened: " + event); }); - */ - export interface Event { - /** - * A function that represents an event to which you subscribe by calling it with - * a listener function as argument. - * - * @param listener The listener function will be called when the event happens. - * @param thisArgs The `this`-argument which will be used when calling the event listener. - * @param disposables An array to which a {@link Disposable} will be added. - * @returns A disposable which unsubscribes the event listener. - */ - ( - listener: (e: T) => any, - thisArgs?: any, - disposables?: Disposable[], - ): Disposable; - } - - /** - * An event emitter can be used to create and manage an {@link Event} for others - * to subscribe to. One emitter always owns one event. - * - * Use this class if you want to provide event from within your extension, for instance - * inside a {@link TextDocumentContentProvider} or when providing - * API to other extensions. - */ - export class EventEmitter { - /** - * The event listeners can subscribe to. - */ - event: Event; - - /** - * Notify all subscribers of the {@link EventEmitter.event event}. Failure - * of one or more listener will not fail this function call. - * - * @param data The event object. - */ - fire(data: T): void; - - /** - * Dispose this object and free resources. - */ - dispose(): void; - } - - /** - * A file system watcher notifies about changes to files and folders - * on disk or from other {@link FileSystemProvider FileSystemProviders}. - * - * To get an instance of a `FileSystemWatcher` use - * {@link workspace.createFileSystemWatcher createFileSystemWatcher}. - */ - export interface FileSystemWatcher extends Disposable { - /** - * true if this file system watcher has been created such that - * it ignores creation file system events. - */ - readonly ignoreCreateEvents: boolean; - - /** - * true if this file system watcher has been created such that - * it ignores change file system events. - */ - readonly ignoreChangeEvents: boolean; - - /** - * true if this file system watcher has been created such that - * it ignores delete file system events. - */ - readonly ignoreDeleteEvents: boolean; - - /** - * An event which fires on file/folder creation. - */ - readonly onDidCreate: Event; - - /** - * An event which fires on file/folder change. - */ - readonly onDidChange: Event; - - /** - * An event which fires on file/folder deletion. - */ - readonly onDidDelete: Event; - } - - /** - * A text document content provider allows to add readonly documents - * to the editor, such as source from a dll or generated html from md. - * - * Content providers are {@link workspace.registerTextDocumentContentProvider registered} - * for a {@link Uri.scheme uri-scheme}. When a uri with that scheme is to - * be {@link workspace.openTextDocument loaded} the content provider is - * asked. - */ - export interface TextDocumentContentProvider { - /** - * An event to signal a resource has changed. - */ - onDidChange?: Event; - - /** - * Provide textual content for a given uri. - * - * The editor will use the returned string-content to create a readonly - * {@link TextDocument document}. Resources allocated should be released when - * the corresponding document has been {@link workspace.onDidCloseTextDocument closed}. - * - * **Note**: The contents of the created {@link TextDocument document} might not be - * identical to the provided text due to end-of-line-sequence normalization. - * - * @param uri An uri which scheme matches the scheme this provider was {@link workspace.registerTextDocumentContentProvider registered} for. - * @param token A cancellation token. - * @returns A string or a thenable that resolves to such. - */ - provideTextDocumentContent( - uri: Uri, - token: CancellationToken, - ): ProviderResult; - } - - /** - * The kind of {@link QuickPickItem quick pick item}. - */ - export enum QuickPickItemKind { - /** - * When a {@link QuickPickItem} has a kind of {@link Separator}, the item is just a visual separator and does not represent a real item. - * The only property that applies is {@link QuickPickItem.label label }. All other properties on {@link QuickPickItem} will be ignored and have no effect. - */ - Separator = -1, - /** - * The default {@link QuickPickItem.kind} is an item that can be selected in the quick pick. - */ - Default = 0, - } - - /** - * Represents an item that can be selected from - * a list of items. - */ - export interface QuickPickItem { - /** - * A human-readable string which is rendered prominent. Supports rendering of {@link ThemeIcon theme icons} via - * the `$()`-syntax. - */ - label: string; - - /** - * The kind of QuickPickItem that will determine how this item is rendered in the quick pick. When not specified, - * the default is {@link QuickPickItemKind.Default}. - */ - kind?: QuickPickItemKind; - - /** - * The icon path or {@link ThemeIcon} for the QuickPickItem. - */ - iconPath?: IconPath; - - /** - * A human-readable string which is rendered less prominent in the same line. Supports rendering of - * {@link ThemeIcon theme icons} via the `$()`-syntax. - * - * Note: this property is ignored when {@link QuickPickItem.kind kind} is set to {@link QuickPickItemKind.Separator} - */ - description?: string; - - /** - * A human-readable string which is rendered less prominent in a separate line. Supports rendering of - * {@link ThemeIcon theme icons} via the `$()`-syntax. - * - * Note: this property is ignored when {@link QuickPickItem.kind kind} is set to {@link QuickPickItemKind.Separator} - */ - detail?: string; - - /** - * Optional flag indicating if this item is picked initially. This is only honored when using - * the {@link window.showQuickPick showQuickPick()} API. To do the same thing with - * the {@link window.createQuickPick createQuickPick()} API, simply set the {@link QuickPick.selectedItems} - * to the items you want picked initially. - * (*Note:* This is only honored when the picker allows multiple selections.) - * - * @see {@link QuickPickOptions.canPickMany} - * - * Note: this property is ignored when {@link QuickPickItem.kind kind} is set to {@link QuickPickItemKind.Separator} - */ - picked?: boolean; - - /** - * Always show this item. - * - * Note: this property is ignored when {@link QuickPickItem.kind kind} is set to {@link QuickPickItemKind.Separator} - */ - alwaysShow?: boolean; - - /** - * Optional buttons that will be rendered on this particular item. These buttons will trigger - * an {@link QuickPickItemButtonEvent} when clicked. Buttons are only rendered when using a quickpick - * created by the {@link window.createQuickPick createQuickPick()} API. Buttons are not rendered when using - * the {@link window.showQuickPick showQuickPick()} API. - * - * Note: this property is ignored when {@link QuickPickItem.kind kind} is set to {@link QuickPickItemKind.Separator} - */ - buttons?: readonly QuickInputButton[]; - } - - /** - * Options to configure the behavior of the quick pick UI. - */ - export interface QuickPickOptions { - /** - * An optional string that represents the title of the quick pick. - */ - title?: string; - - /** - * An optional flag to include the description when filtering the picks. - */ - matchOnDescription?: boolean; - - /** - * An optional flag to include the detail when filtering the picks. - */ - matchOnDetail?: boolean; - - /** - * An optional string to show as placeholder in the input box to guide the user what to pick on. - */ - placeHolder?: string; - - /** - * Set to `true` to keep the picker open when focus moves to another part of the editor or to another window. - * This setting is ignored on iPad and is always false. - */ - ignoreFocusOut?: boolean; - - /** - * An optional flag to make the picker accept multiple selections, if true the result is an array of picks. - */ - canPickMany?: boolean; - - /** - * An optional function that is invoked whenever an item is selected. - */ - onDidSelectItem?(item: QuickPickItem | string): any; - } - - /** - * Options to configure the behaviour of the {@link WorkspaceFolder workspace folder} pick UI. - */ - export interface WorkspaceFolderPickOptions { - /** - * An optional string to show as placeholder in the input box to guide the user what to pick on. - */ - placeHolder?: string; - - /** - * Set to `true` to keep the picker open when focus moves to another part of the editor or to another window. - * This setting is ignored on iPad and is always false. - */ - ignoreFocusOut?: boolean; - } - - /** - * Options to configure the behaviour of a file open dialog. - * - * * Note 1: On Windows and Linux, a file dialog cannot be both a file selector and a folder selector, so if you - * set both `canSelectFiles` and `canSelectFolders` to `true` on these platforms, a folder selector will be shown. - * * Note 2: Explicitly setting `canSelectFiles` and `canSelectFolders` to `false` is futile - * and the editor then silently adjusts the options to select files. - */ - export interface OpenDialogOptions { - /** - * The resource the dialog shows when opened. - */ - defaultUri?: Uri; - - /** - * A human-readable string for the open button. - */ - openLabel?: string; - - /** - * Allow to select files, defaults to `true`. - */ - canSelectFiles?: boolean; - - /** - * Allow to select folders, defaults to `false`. - */ - canSelectFolders?: boolean; - - /** - * Allow to select many files or folders. - */ - canSelectMany?: boolean; - - /** - * A set of file filters that are used by the dialog. Each entry is a human-readable label, - * like "TypeScript", and an array of extensions, for example: - * ```ts - * { - * 'Images': ['png', 'jpg'], - * 'TypeScript': ['ts', 'tsx'] - * } - * ``` - */ - filters?: { [name: string]: string[] }; - - /** - * Dialog title. - * - * This parameter might be ignored, as not all operating systems display a title on open dialogs - * (for example, macOS). - */ - title?: string; - } - - /** - * Options to configure the behaviour of a file save dialog. - */ - export interface SaveDialogOptions { - /** - * The resource the dialog shows when opened. - */ - defaultUri?: Uri; - - /** - * A human-readable string for the save button. - */ - saveLabel?: string; - - /** - * A set of file filters that are used by the dialog. Each entry is a human-readable label, - * like "TypeScript", and an array of extensions, for example: - * ```ts - * { - * 'Images': ['png', 'jpg'], - * 'TypeScript': ['ts', 'tsx'] - * } - * ``` - */ - filters?: { [name: string]: string[] }; - - /** - * Dialog title. - * - * This parameter might be ignored, as not all operating systems display a title on save dialogs - * (for example, macOS). - */ - title?: string; - } - - /** - * Represents an action that is shown with an information, warning, or - * error message. - * - * @see {@link window.showInformationMessage showInformationMessage} - * @see {@link window.showWarningMessage showWarningMessage} - * @see {@link window.showErrorMessage showErrorMessage} - */ - export interface MessageItem { - /** - * A short title like 'Retry', 'Open Log' etc. - */ - title: string; - - /** - * A hint for modal dialogs that the item should be triggered - * when the user cancels the dialog (e.g. by pressing the ESC - * key). - * - * Note: this option is ignored for non-modal messages. - */ - isCloseAffordance?: boolean; - } - - /** - * Options to configure the behavior of the message. - * - * @see {@link window.showInformationMessage showInformationMessage} - * @see {@link window.showWarningMessage showWarningMessage} - * @see {@link window.showErrorMessage showErrorMessage} - */ - export interface MessageOptions { - /** - * Indicates that this message should be modal. - */ - modal?: boolean; - - /** - * Human-readable detail message that is rendered less prominent. _Note_ that detail - * is only shown for {@link MessageOptions.modal modal} messages. - */ - detail?: string; - } - - /** - * Impacts the behavior and appearance of the validation message. - */ - /** - * The severity level for input box validation. - */ - export enum InputBoxValidationSeverity { - /** - * Informational severity level. - */ - Info = 1, - /** - * Warning severity level. - */ - Warning = 2, - /** - * Error severity level. - */ - Error = 3, - } - - /** - * Object to configure the behavior of the validation message. - */ - export interface InputBoxValidationMessage { - /** - * The validation message to display. - */ - readonly message: string; - - /** - * The severity of the validation message. - * NOTE: When using `InputBoxValidationSeverity.Error`, the user will not be allowed to accept (hit ENTER) the input. - * `Info` and `Warning` will still allow the InputBox to accept the input. - */ - readonly severity: InputBoxValidationSeverity; - } - - /** - * Options to configure the behavior of the input box UI. - */ - export interface InputBoxOptions { - /** - * An optional string that represents the title of the input box. - */ - title?: string; - - /** - * The value to pre-fill in the input box. - */ - value?: string; - - /** - * Selection of the pre-filled {@linkcode InputBoxOptions.value value}. Defined as tuple of two number where the - * first is the inclusive start index and the second the exclusive end index. When `undefined` the whole - * pre-filled value will be selected, when empty (start equals end) only the cursor will be set, - * otherwise the defined range will be selected. - */ - valueSelection?: [number, number]; - - /** - * The text to display underneath the input box. - */ - prompt?: string; - - /** - * An optional string to show as placeholder in the input box to guide the user what to type. - */ - placeHolder?: string; - - /** - * Controls if a password input is shown. Password input hides the typed text. - */ - password?: boolean; - - /** - * Set to `true` to keep the input box open when focus moves to another part of the editor or to another window. - * This setting is ignored on iPad and is always false. - */ - ignoreFocusOut?: boolean; - - /** - * An optional function that will be called to validate input and to give a hint - * to the user. - * - * @param value The current value of the input box. - * @returns Either a human-readable string which is presented as an error message or an {@link InputBoxValidationMessage} - * which can provide a specific message severity. Return `undefined`, `null`, or the empty string when 'value' is valid. - */ - validateInput?( - value: string, - ): - | string - | InputBoxValidationMessage - | undefined - | null - | Thenable; - } - - /** - * A relative pattern is a helper to construct glob patterns that are matched - * relatively to a base file path. The base path can either be an absolute file - * path as string or uri or a {@link WorkspaceFolder workspace folder}, which is the - * preferred way of creating the relative pattern. - */ - export class RelativePattern { - /** - * A base file path to which this pattern will be matched against relatively. The - * file path must be absolute, should not have any trailing path separators and - * not include any relative segments (`.` or `..`). - */ - baseUri: Uri; - - /** - * A base file path to which this pattern will be matched against relatively. - * - * This matches the `fsPath` value of {@link RelativePattern.baseUri}. - * - * *Note:* updating this value will update {@link RelativePattern.baseUri} to - * be a uri with `file` scheme. - * - * @deprecated This property is deprecated, please use {@link RelativePattern.baseUri} instead. - */ - base: string; - - /** - * A file glob pattern like `*.{ts,js}` that will be matched on file paths - * relative to the base path. - * - * Example: Given a base of `/home/work/folder` and a file path of `/home/work/folder/index.js`, - * the file glob pattern will match on `index.js`. - */ - pattern: string; - - /** - * Creates a new relative pattern object with a base file path and pattern to match. This pattern - * will be matched on file paths relative to the base. - * - * Example: - * ```ts - * const folder = vscode.workspace.workspaceFolders?.[0]; - * if (folder) { - * - * // Match any TypeScript file in the root of this workspace folder - * const pattern1 = new vscode.RelativePattern(folder, '*.ts'); - * - * // Match any TypeScript file in `someFolder` inside this workspace folder - * const pattern2 = new vscode.RelativePattern(folder, 'someFolder/*.ts'); - * } - * ``` - * - * @param base A base to which this pattern will be matched against relatively. It is recommended - * to pass in a {@link WorkspaceFolder workspace folder} if the pattern should match inside the workspace. - * Otherwise, a uri or string should only be used if the pattern is for a file path outside the workspace. - * @param pattern A file glob pattern like `*.{ts,js}` that will be matched on paths relative to the base. - */ - constructor(base: WorkspaceFolder | Uri | string, pattern: string); - } - - /** - * A file glob pattern to match file paths against. This can either be a glob pattern string - * (like `**​/*.{ts,js}` or `*.{ts,js}`) or a {@link RelativePattern relative pattern}. - * - * Glob patterns can have the following syntax: - * * `*` to match zero or more characters in a path segment - * * `?` to match on one character in a path segment - * * `**` to match any number of path segments, including none - * * `{}` to group conditions (e.g. `**​/*.{ts,js}` matches all TypeScript and JavaScript files) - * * `[]` to declare a range of characters to match in a path segment (e.g., `example.[0-9]` to match on `example.0`, `example.1`, …) - * * `[!...]` to negate a range of characters to match in a path segment (e.g., `example.[!0-9]` to match on `example.a`, `example.b`, but not `example.0`) - * - * Note: a backslash (`\`) is not valid within a glob pattern. If you have an existing file - * path to match against, consider to use the {@link RelativePattern relative pattern} support - * that takes care of converting any backslash into slash. Otherwise, make sure to convert - * any backslash to slash when creating the glob pattern. - */ - export type GlobPattern = string | RelativePattern; - - /** - * A document filter denotes a document by different properties like - * the {@link TextDocument.languageId language}, the {@link Uri.scheme scheme} of - * its resource, or a glob-pattern that is applied to the {@link TextDocument.fileName path}. - * - * @example A language filter that applies to typescript files on disk - * { language: 'typescript', scheme: 'file' } - * - * @example A language filter that applies to all package.json paths - * { language: 'json', pattern: '**​/package.json' } - */ - export interface DocumentFilter { - /** - * A language id, like `typescript`. - */ - readonly language?: string; - - /** - * The {@link NotebookDocument.notebookType type} of a notebook, like `jupyter-notebook`. This allows - * to narrow down on the type of a notebook that a {@link NotebookCell.document cell document} belongs to. - * - * *Note* that setting the `notebookType`-property changes how `scheme` and `pattern` are interpreted. When set - * they are evaluated against the {@link NotebookDocument.uri notebook uri}, not the document uri. - * - * @example Match python document inside jupyter notebook that aren't stored yet (`untitled`) - * { language: 'python', notebookType: 'jupyter-notebook', scheme: 'untitled' } - */ - readonly notebookType?: string; - - /** - * A Uri {@link Uri.scheme scheme}, like `file` or `untitled`. - */ - readonly scheme?: string; - - /** - * A {@link GlobPattern glob pattern} that is matched on the absolute path of the document. Use a {@link RelativePattern relative pattern} - * to filter documents to a {@link WorkspaceFolder workspace folder}. - */ - readonly pattern?: GlobPattern; - } - - /** - * A language selector is the combination of one or many language identifiers - * and {@link DocumentFilter language filters}. - * - * *Note* that a document selector that is just a language identifier selects *all* - * documents, even those that are not saved on disk. Only use such selectors when - * a feature works without further context, e.g. without the need to resolve related - * 'files'. - * - * @example - * let sel:DocumentSelector = { scheme: 'file', language: 'typescript' }; - */ - export type DocumentSelector = - | DocumentFilter - | string - | ReadonlyArray; - - /** - * A provider result represents the values a provider, like the {@linkcode HoverProvider}, - * may return. For once this is the actual result type `T`, like `Hover`, or a thenable that resolves - * to that type `T`. In addition, `null` and `undefined` can be returned - either directly or from a - * thenable. - * - * The snippets below are all valid implementations of the {@linkcode HoverProvider}: - * - * ```ts - * let a: HoverProvider = { - * provideHover(doc, pos, token): ProviderResult { - * return new Hover('Hello World'); - * } - * } - * - * let b: HoverProvider = { - * provideHover(doc, pos, token): ProviderResult { - * return new Promise(resolve => { - * resolve(new Hover('Hello World')); - * }); - * } - * } - * - * let c: HoverProvider = { - * provideHover(doc, pos, token): ProviderResult { - * return; // undefined - * } - * } - * ``` - */ - export type ProviderResult = - | T - | undefined - | null - | Thenable; - - /** - * Kind of a code action. - * - * Kinds are a hierarchical list of identifiers separated by `.`, e.g. `"refactor.extract.function"`. - * - * Code action kinds are used by the editor for UI elements such as the refactoring context menu. Users - * can also trigger code actions with a specific kind with the `editor.action.codeAction` command. - */ - export class CodeActionKind { - /** - * Empty kind. - */ - static readonly Empty: CodeActionKind; - - /** - * Base kind for quickfix actions: `quickfix`. - * - * Quick fix actions address a problem in the code and are shown in the normal code action context menu. - */ - static readonly QuickFix: CodeActionKind; - - /** - * Base kind for refactoring actions: `refactor` - * - * Refactoring actions are shown in the refactoring context menu. - */ - static readonly Refactor: CodeActionKind; - - /** - * Base kind for refactoring extraction actions: `refactor.extract` - * - * Example extract actions: - * - * - Extract method - * - Extract function - * - Extract variable - * - Extract interface from class - * - ... - */ - static readonly RefactorExtract: CodeActionKind; - - /** - * Base kind for refactoring inline actions: `refactor.inline` - * - * Example inline actions: - * - * - Inline function - * - Inline variable - * - Inline constant - * - ... - */ - static readonly RefactorInline: CodeActionKind; - - /** - * Base kind for refactoring move actions: `refactor.move` - * - * Example move actions: - * - * - Move a function to a new file - * - Move a property between classes - * - Move method to base class - * - ... - */ - static readonly RefactorMove: CodeActionKind; - - /** - * Base kind for refactoring rewrite actions: `refactor.rewrite` - * - * Example rewrite actions: - * - * - Convert JavaScript function to class - * - Add or remove parameter - * - Encapsulate field - * - Make method static - * - ... - */ - static readonly RefactorRewrite: CodeActionKind; - - /** - * Base kind for source actions: `source` - * - * Source code actions apply to the entire file. They must be explicitly requested and will not show in the - * normal [lightbulb](https://code.visualstudio.com/docs/editor/editingevolved#_code-action) menu. Source actions - * can be run on save using `editor.codeActionsOnSave` and are also shown in the `source` context menu. - */ - static readonly Source: CodeActionKind; - - /** - * Base kind for an organize imports source action: `source.organizeImports`. - */ - static readonly SourceOrganizeImports: CodeActionKind; - - /** - * Base kind for auto-fix source actions: `source.fixAll`. - * - * Fix all actions automatically fix errors that have a clear fix that do not require user input. - * They should not suppress errors or perform unsafe fixes such as generating new types or classes. - */ - static readonly SourceFixAll: CodeActionKind; - - /** - * Base kind for all code actions applying to the entire notebook's scope. CodeActionKinds using - * this should always begin with `notebook.` - * - * This requires that new CodeActions be created for it and contributed via extensions. - * Pre-existing kinds can not just have the new `notebook.` prefix added to them, as the functionality - * is unique to the full-notebook scope. - * - * Notebook CodeActionKinds can be initialized as either of the following (both resulting in `notebook.source.xyz`): - * - `const newKind = CodeActionKind.Notebook.append(CodeActionKind.Source.append('xyz').value)` - * - `const newKind = CodeActionKind.Notebook.append('source.xyz')` - * - * Example Kinds/Actions: - * - `notebook.source.organizeImports` (might move all imports to a new top cell) - * - `notebook.source.normalizeVariableNames` (might rename all variables to a standardized casing format) - */ - static readonly Notebook: CodeActionKind; - - /** - * Private constructor, use static `CodeActionKind.XYZ` to derive from an existing code action kind. - * - * @param value The value of the kind, such as `refactor.extract.function`. - */ - private constructor(value: string); - - /** - * String value of the kind, e.g. `"refactor.extract.function"`. - */ - readonly value: string; - - /** - * Create a new kind by appending a more specific selector to the current kind. - * - * Does not modify the current kind. - */ - append(parts: string): CodeActionKind; - - /** - * Checks if this code action kind intersects `other`. - * - * The kind `"refactor.extract"` for example intersects `refactor`, `"refactor.extract"` and `"refactor.extract.function"`, - * but not `"unicorn.refactor.extract"`, or `"refactor.extractAll"`. - * - * @param other Kind to check. - */ - intersects(other: CodeActionKind): boolean; - - /** - * Checks if `other` is a sub-kind of this `CodeActionKind`. - * - * The kind `"refactor.extract"` for example contains `"refactor.extract"` and ``"refactor.extract.function"`, - * but not `"unicorn.refactor.extract"`, or `"refactor.extractAll"` or `refactor`. - * - * @param other Kind to check. - */ - contains(other: CodeActionKind): boolean; - } - - /** - * The reason why code actions were requested. - */ - export enum CodeActionTriggerKind { - /** - * Code actions were explicitly requested by the user or by an extension. - */ - Invoke = 1, - - /** - * Code actions were requested automatically. - * - * This typically happens when current selection in a file changes, but can - * also be triggered when file content changes. - */ - Automatic = 2, - } - - /** - * Contains additional diagnostic information about the context in which - * a {@link CodeActionProvider.provideCodeActions code action} is run. - */ - export interface CodeActionContext { - /** - * The reason why code actions were requested. - */ - readonly triggerKind: CodeActionTriggerKind; - - /** - * An array of diagnostics. - */ - readonly diagnostics: readonly Diagnostic[]; - - /** - * Requested kind of actions to return. - * - * Actions not of this kind are filtered out before being shown by the [lightbulb](https://code.visualstudio.com/docs/editor/editingevolved#_code-action). - */ - readonly only: CodeActionKind | undefined; - } - - /** - * A code action represents a change that can be performed in code, e.g. to fix a problem or - * to refactor code. - * - * A CodeAction must set either {@linkcode CodeAction.edit edit} and/or a {@linkcode CodeAction.command command}. If both are supplied, the `edit` is applied first, then the command is executed. - */ - export class CodeAction { - /** - * A short, human-readable, title for this code action. - */ - title: string; - - /** - * A {@link WorkspaceEdit workspace edit} this code action performs. - */ - edit?: WorkspaceEdit; - - /** - * {@link Diagnostic Diagnostics} that this code action resolves. - */ - diagnostics?: Diagnostic[]; - - /** - * A {@link Command} this code action executes. - * - * If this command throws an exception, the editor displays the exception message to users in the editor at the - * current cursor position. - */ - command?: Command; - - /** - * {@link CodeActionKind Kind} of the code action. - * - * Used to filter code actions. - */ - kind?: CodeActionKind; - - /** - * Marks this as a preferred action. Preferred actions are used by the `auto fix` command and can be targeted - * by keybindings. - * - * A quick fix should be marked preferred if it properly addresses the underlying error. - * A refactoring should be marked preferred if it is the most reasonable choice of actions to take. - */ - isPreferred?: boolean; - - /** - * Marks that the code action cannot currently be applied. - * - * - Disabled code actions are not shown in automatic [lightbulb](https://code.visualstudio.com/docs/editor/editingevolved#_code-action) - * code action menu. - * - * - Disabled actions are shown as faded out in the code action menu when the user request a more specific type - * of code action, such as refactorings. - * - * - If the user has a [keybinding](https://code.visualstudio.com/docs/editor/refactoring#_keybindings-for-code-actions) - * that auto applies a code action and only a disabled code actions are returned, the editor will show the user an - * error message with `reason` in the editor. - */ - disabled?: { - /** - * Human readable description of why the code action is currently disabled. - * - * This is displayed in the code actions UI. - */ - readonly reason: string; - }; - - /** - * Creates a new code action. - * - * A code action must have at least a {@link CodeAction.title title} and {@link CodeAction.edit edits} - * and/or a {@link CodeAction.command command}. - * - * @param title The title of the code action. - * @param kind The kind of the code action. - */ - constructor(title: string, kind?: CodeActionKind); - } - - /** - * Provides contextual actions for code. Code actions typically either fix problems or beautify/refactor code. - * - * Code actions are surfaced to users in a few different ways: - * - * - The [lightbulb](https://code.visualstudio.com/docs/editor/editingevolved#_code-action) feature, which shows - * a list of code actions at the current cursor position. The lightbulb's list of actions includes both quick fixes - * and refactorings. - * - As commands that users can run, such as `Refactor`. Users can run these from the command palette or with keybindings. - * - As source actions, such `Organize Imports`. - * - {@link CodeActionKind.QuickFix Quick fixes} are shown in the problems view. - * - Change applied on save by the `editor.codeActionsOnSave` setting. - */ - export interface CodeActionProvider { - /** - * Get code actions for a given range in a document. - * - * Only return code actions that are relevant to user for the requested range. Also keep in mind how the - * returned code actions will appear in the UI. The lightbulb widget and `Refactor` commands for instance show - * returned code actions as a list, so do not return a large number of code actions that will overwhelm the user. - * - * @param document The document in which the command was invoked. - * @param range The selector or range for which the command was invoked. This will always be a - * {@link Selection selection} if the actions are being requested in the currently active editor. - * @param context Provides additional information about what code actions are being requested. You can use this - * to see what specific type of code actions are being requested by the editor in order to return more relevant - * actions and avoid returning irrelevant code actions that the editor will discard. - * @param token A cancellation token. - * - * @returns An array of code actions, such as quick fixes or refactorings. The lack of a result can be signaled - * by returning `undefined`, `null`, or an empty array. - * - * We also support returning `Command` for legacy reasons, however all new extensions should return - * `CodeAction` object instead. - */ - provideCodeActions( - document: TextDocument, - range: Range | Selection, - context: CodeActionContext, - token: CancellationToken, - ): ProviderResult>; - - /** - * Given a code action fill in its {@linkcode CodeAction.edit edit}-property. Changes to - * all other properties, like title, are ignored. A code action that has an edit - * will not be resolved. - * - * *Note* that a code action provider that returns commands, not code actions, cannot successfully - * implement this function. Returning commands is deprecated and instead code actions should be - * returned. - * - * @param codeAction A code action. - * @param token A cancellation token. - * @returns The resolved code action or a thenable that resolves to such. It is OK to return the given - * `item`. When no result is returned, the given `item` will be used. - */ - resolveCodeAction?( - codeAction: T, - token: CancellationToken, - ): ProviderResult; - } - - /** - * Metadata about the type of code actions that a {@link CodeActionProvider} provides. - */ - export interface CodeActionProviderMetadata { - /** - * List of {@link CodeActionKind CodeActionKinds} that a {@link CodeActionProvider} may return. - * - * This list is used to determine if a given `CodeActionProvider` should be invoked or not. - * To avoid unnecessary computation, every `CodeActionProvider` should list use `providedCodeActionKinds`. The - * list of kinds may either be generic, such as `[CodeActionKind.Refactor]`, or list out every kind provided, - * such as `[CodeActionKind.Refactor.Extract.append('function'), CodeActionKind.Refactor.Extract.append('constant'), ...]`. - */ - readonly providedCodeActionKinds?: readonly CodeActionKind[]; - - /** - * Static documentation for a class of code actions. - * - * Documentation from the provider is shown in the code actions menu if either: - * - * - Code actions of `kind` are requested by the editor. In this case, the editor will show the documentation that - * most closely matches the requested code action kind. For example, if a provider has documentation for - * both `Refactor` and `RefactorExtract`, when the user requests code actions for `RefactorExtract`, - * the editor will use the documentation for `RefactorExtract` instead of the documentation for `Refactor`. - * - * - Any code actions of `kind` are returned by the provider. - * - * At most one documentation entry will be shown per provider. - */ - readonly documentation?: ReadonlyArray<{ - /** - * The kind of the code action being documented. - * - * If the kind is generic, such as `CodeActionKind.Refactor`, the documentation will be shown whenever any - * refactorings are returned. If the kind if more specific, such as `CodeActionKind.RefactorExtract`, the - * documentation will only be shown when extract refactoring code actions are returned. - */ - readonly kind: CodeActionKind; - - /** - * Command that displays the documentation to the user. - * - * This can display the documentation directly in the editor or open a website using {@linkcode env.openExternal}; - * - * The title of this documentation code action is taken from {@linkcode Command.title} - */ - readonly command: Command; - }>; - } - - /** - * A code lens represents a {@link Command} that should be shown along with - * source text, like the number of references, a way to run tests, etc. - * - * A code lens is _unresolved_ when no command is associated to it. For performance - * reasons the creation of a code lens and resolving should be done to two stages. - * - * @see {@link CodeLensProvider.provideCodeLenses} - * @see {@link CodeLensProvider.resolveCodeLens} - */ - export class CodeLens { - /** - * The range in which this code lens is valid. Should only span a single line. - */ - range: Range; - - /** - * The command this code lens represents. - */ - command?: Command; - - /** - * `true` when there is a command associated. - */ - readonly isResolved: boolean; - - /** - * Creates a new code lens object. - * - * @param range The range to which this code lens applies. - * @param command The command associated to this code lens. - */ - constructor(range: Range, command?: Command); - } - - /** - * A code lens provider adds {@link Command commands} to source text. The commands will be shown - * as dedicated horizontal lines in between the source text. - */ - export interface CodeLensProvider { - /** - * An optional event to signal that the code lenses from this provider have changed. - */ - onDidChangeCodeLenses?: Event; - - /** - * Compute a list of {@link CodeLens lenses}. This call should return as fast as possible and if - * computing the commands is expensive implementors should only return code lens objects with the - * range set and implement {@link CodeLensProvider.resolveCodeLens resolve}. - * - * @param document The document in which the command was invoked. - * @param token A cancellation token. - * @returns An array of code lenses or a thenable that resolves to such. The lack of a result can be - * signaled by returning `undefined`, `null`, or an empty array. - */ - provideCodeLenses( - document: TextDocument, - token: CancellationToken, - ): ProviderResult; - - /** - * This function will be called for each visible code lens, usually when scrolling and after - * calls to {@link CodeLensProvider.provideCodeLenses compute}-lenses. - * - * @param codeLens Code lens that must be resolved. - * @param token A cancellation token. - * @returns The given, resolved code lens or thenable that resolves to such. - */ - resolveCodeLens?( - codeLens: T, - token: CancellationToken, - ): ProviderResult; - } - - /** - * Information about where a symbol is defined. - * - * Provides additional metadata over normal {@link Location} definitions, including the range of - * the defining symbol - */ - export type DefinitionLink = LocationLink; - - /** - * The definition of a symbol represented as one or many {@link Location locations}. - * For most programming languages there is only one location at which a symbol is - * defined. - */ - export type Definition = Location | Location[]; - - /** - * The definition provider interface defines the contract between extensions and - * the [go to definition](https://code.visualstudio.com/docs/editor/editingevolved#_go-to-definition) - * and peek definition features. - */ - export interface DefinitionProvider { - /** - * Provide the definition of the symbol at the given position and document. - * - * @param document The document in which the command was invoked. - * @param position The position at which the command was invoked. - * @param token A cancellation token. - * @returns A definition or a thenable that resolves to such. The lack of a result can be - * signaled by returning `undefined` or `null`. - */ - provideDefinition( - document: TextDocument, - position: Position, - token: CancellationToken, - ): ProviderResult; - } - - /** - * The implementation provider interface defines the contract between extensions and - * the go to implementation feature. - */ - export interface ImplementationProvider { - /** - * Provide the implementations of the symbol at the given position and document. - * - * @param document The document in which the command was invoked. - * @param position The position at which the command was invoked. - * @param token A cancellation token. - * @returns A definition or a thenable that resolves to such. The lack of a result can be - * signaled by returning `undefined` or `null`. - */ - provideImplementation( - document: TextDocument, - position: Position, - token: CancellationToken, - ): ProviderResult; - } - - /** - * The type definition provider defines the contract between extensions and - * the go to type definition feature. - */ - export interface TypeDefinitionProvider { - /** - * Provide the type definition of the symbol at the given position and document. - * - * @param document The document in which the command was invoked. - * @param position The position at which the command was invoked. - * @param token A cancellation token. - * @returns A definition or a thenable that resolves to such. The lack of a result can be - * signaled by returning `undefined` or `null`. - */ - provideTypeDefinition( - document: TextDocument, - position: Position, - token: CancellationToken, - ): ProviderResult; - } - - /** - * The declaration of a symbol representation as one or many {@link Location locations} - * or {@link LocationLink location links}. - */ - export type Declaration = Location | Location[] | LocationLink[]; - - /** - * The declaration provider interface defines the contract between extensions and - * the go to declaration feature. - */ - export interface DeclarationProvider { - /** - * Provide the declaration of the symbol at the given position and document. - * - * @param document The document in which the command was invoked. - * @param position The position at which the command was invoked. - * @param token A cancellation token. - * @returns A declaration or a thenable that resolves to such. The lack of a result can be - * signaled by returning `undefined` or `null`. - */ - provideDeclaration( - document: TextDocument, - position: Position, - token: CancellationToken, - ): ProviderResult; - } - - /** - * Human-readable text that supports formatting via the [markdown syntax](https://commonmark.org). - * - * Rendering of {@link ThemeIcon theme icons} via the `$()`-syntax is supported - * when the {@linkcode supportThemeIcons} is set to `true`. - * - * Rendering of embedded html is supported when {@linkcode supportHtml} is set to `true`. - */ - export class MarkdownString { - /** - * The markdown string. - */ - value: string; - - /** - * Indicates that this markdown string is from a trusted source. Only *trusted* - * markdown supports links that execute commands, e.g. `[Run it](command:myCommandId)`. - * - * Defaults to `false` (commands are disabled). - */ - isTrusted?: - | boolean - | { - /** - * A set of commend ids that are allowed to be executed by this markdown string. - */ - readonly enabledCommands: readonly string[]; - }; - - /** - * Indicates that this markdown string can contain {@link ThemeIcon ThemeIcons}, e.g. `$(zap)`. - */ - supportThemeIcons?: boolean; - - /** - * Indicates that this markdown string can contain raw html tags. Defaults to `false`. - * - * When `supportHtml` is false, the markdown renderer will strip out any raw html tags - * that appear in the markdown text. This means you can only use markdown syntax for rendering. - * - * When `supportHtml` is true, the markdown render will also allow a safe subset of html tags - * and attributes to be rendered. See https://github.com/microsoft/vscode/blob/6d2920473c6f13759c978dd89104c4270a83422d/src/vs/base/browser/markdownRenderer.ts#L296 - * for a list of all supported tags and attributes. - */ - supportHtml?: boolean; - - /** - * Uri that relative paths are resolved relative to. - * - * If the `baseUri` ends with `/`, it is considered a directory and relative paths in the markdown are resolved relative to that directory: - * - * ```ts - * const md = new vscode.MarkdownString(`[link](./file.js)`); - * md.baseUri = vscode.Uri.file('/path/to/dir/'); - * // Here 'link' in the rendered markdown resolves to '/path/to/dir/file.js' - * ``` - * - * If the `baseUri` is a file, relative paths in the markdown are resolved relative to the parent dir of that file: - * - * ```ts - * const md = new vscode.MarkdownString(`[link](./file.js)`); - * md.baseUri = vscode.Uri.file('/path/to/otherFile.js'); - * // Here 'link' in the rendered markdown resolves to '/path/to/file.js' - * ``` - */ - baseUri?: Uri; - - /** - * Creates a new markdown string with the given value. - * - * @param value Optional, initial value. - * @param supportThemeIcons Optional, Specifies whether {@link ThemeIcon ThemeIcons} are supported within the {@linkcode MarkdownString}. - */ - constructor(value?: string, supportThemeIcons?: boolean); - - /** - * Appends and escapes the given string to this markdown string. - * @param value Plain text. - */ - appendText(value: string): MarkdownString; - - /** - * Appends the given string 'as is' to this markdown string. When {@linkcode MarkdownString.supportThemeIcons supportThemeIcons} is `true`, {@link ThemeIcon ThemeIcons} in the `value` will be iconified. - * @param value Markdown string. - */ - appendMarkdown(value: string): MarkdownString; - - /** - * Appends the given string as codeblock using the provided language. - * @param value A code snippet. - * @param language An optional {@link languages.getLanguages language identifier}. - */ - appendCodeblock(value: string, language?: string): MarkdownString; - } - - /** - * MarkedString can be used to render human-readable text. It is either a markdown string - * or a code-block that provides a language and a code snippet. Note that - * markdown strings will be sanitized - that means html will be escaped. - * - * @deprecated This type is deprecated, please use {@linkcode MarkdownString} instead. - */ - export type MarkedString = - | string - | { - /** - * The language of a markdown code block - * @deprecated please use {@linkcode MarkdownString} instead - */ - language: string; - /** - * The code snippet of a markdown code block. - * @deprecated please use {@linkcode MarkdownString} instead - */ - value: string; - }; - - /** - * A hover represents additional information for a symbol or word. Hovers are - * rendered in a tooltip-like widget. - */ - export class Hover { - /** - * The contents of this hover. - */ - contents: Array; - - /** - * The range to which this hover applies. When missing, the - * editor will use the range at the current position or the - * current position itself. - */ - range?: Range; - - /** - * Creates a new hover object. - * - * @param contents The contents of the hover. - * @param range The range to which the hover applies. - */ - constructor( - contents: - | MarkdownString - | MarkedString - | Array, - range?: Range, - ); - } - - /** - * The hover provider interface defines the contract between extensions and - * the [hover](https://code.visualstudio.com/docs/editor/intellisense)-feature. - */ - export interface HoverProvider { - /** - * Provide a hover for the given position and document. Multiple hovers at the same - * position will be merged by the editor. A hover can have a range which defaults - * to the word range at the position when omitted. - * - * @param document The document in which the command was invoked. - * @param position The position at which the command was invoked. - * @param token A cancellation token. - * @returns A hover or a thenable that resolves to such. The lack of a result can be - * signaled by returning `undefined` or `null`. - */ - provideHover( - document: TextDocument, - position: Position, - token: CancellationToken, - ): ProviderResult; - } - - /** - * An EvaluatableExpression represents an expression in a document that can be evaluated by an active debugger or runtime. - * The result of this evaluation is shown in a tooltip-like widget. - * If only a range is specified, the expression will be extracted from the underlying document. - * An optional expression can be used to override the extracted expression. - * In this case the range is still used to highlight the range in the document. - */ - export class EvaluatableExpression { - /* - * The range is used to extract the evaluatable expression from the underlying document and to highlight it. - */ - readonly range: Range; - - /* - * If specified the expression overrides the extracted expression. - */ - readonly expression?: string | undefined; - - /** - * Creates a new evaluatable expression object. - * - * @param range The range in the underlying document from which the evaluatable expression is extracted. - * @param expression If specified overrides the extracted expression. - */ - constructor(range: Range, expression?: string); - } - - /** - * The evaluatable expression provider interface defines the contract between extensions and - * the debug hover. In this contract the provider returns an evaluatable expression for a given position - * in a document and the editor evaluates this expression in the active debug session and shows the result in a debug hover. - */ - export interface EvaluatableExpressionProvider { - /** - * Provide an evaluatable expression for the given document and position. - * The editor will evaluate this expression in the active debug session and will show the result in the debug hover. - * The expression can be implicitly specified by the range in the underlying document or by explicitly returning an expression. - * - * @param document The document for which the debug hover is about to appear. - * @param position The line and character position in the document where the debug hover is about to appear. - * @param token A cancellation token. - * @returns An EvaluatableExpression or a thenable that resolves to such. The lack of a result can be - * signaled by returning `undefined` or `null`. - */ - provideEvaluatableExpression( - document: TextDocument, - position: Position, - token: CancellationToken, - ): ProviderResult; - } - - /** - * Provide inline value as text. - */ - export class InlineValueText { - /** - * The document range for which the inline value applies. - */ - readonly range: Range; - /** - * The text of the inline value. - */ - readonly text: string; - /** - * Creates a new InlineValueText object. - * - * @param range The document line where to show the inline value. - * @param text The value to be shown for the line. - */ - constructor(range: Range, text: string); - } - - /** - * Provide inline value through a variable lookup. - * If only a range is specified, the variable name will be extracted from the underlying document. - * An optional variable name can be used to override the extracted name. - */ - export class InlineValueVariableLookup { - /** - * The document range for which the inline value applies. - * The range is used to extract the variable name from the underlying document. - */ - readonly range: Range; - /** - * If specified the name of the variable to look up. - */ - readonly variableName?: string | undefined; - /** - * How to perform the lookup. - */ - readonly caseSensitiveLookup: boolean; - /** - * Creates a new InlineValueVariableLookup object. - * - * @param range The document line where to show the inline value. - * @param variableName The name of the variable to look up. - * @param caseSensitiveLookup How to perform the lookup. If missing lookup is case sensitive. - */ - constructor( - range: Range, - variableName?: string, - caseSensitiveLookup?: boolean, - ); - } - - /** - * Provide an inline value through an expression evaluation. - * If only a range is specified, the expression will be extracted from the underlying document. - * An optional expression can be used to override the extracted expression. - */ - export class InlineValueEvaluatableExpression { - /** - * The document range for which the inline value applies. - * The range is used to extract the evaluatable expression from the underlying document. - */ - readonly range: Range; - /** - * If specified the expression overrides the extracted expression. - */ - readonly expression?: string | undefined; - /** - * Creates a new InlineValueEvaluatableExpression object. - * - * @param range The range in the underlying document from which the evaluatable expression is extracted. - * @param expression If specified overrides the extracted expression. - */ - constructor(range: Range, expression?: string); - } - - /** - * Inline value information can be provided by different means: - * - directly as a text value (class InlineValueText). - * - as a name to use for a variable lookup (class InlineValueVariableLookup) - * - as an evaluatable expression (class InlineValueEvaluatableExpression) - * The InlineValue types combines all inline value types into one type. - */ - export type InlineValue = - | InlineValueText - | InlineValueVariableLookup - | InlineValueEvaluatableExpression; - - /** - * A value-object that contains contextual information when requesting inline values from a InlineValuesProvider. - */ - export interface InlineValueContext { - /** - * The stack frame (as a DAP Id) where the execution has stopped. - */ - readonly frameId: number; - - /** - * The document range where execution has stopped. - * Typically the end position of the range denotes the line where the inline values are shown. - */ - readonly stoppedLocation: Range; - } - - /** - * The inline values provider interface defines the contract between extensions and the editor's debugger inline values feature. - * In this contract the provider returns inline value information for a given document range - * and the editor shows this information in the editor at the end of lines. - */ - export interface InlineValuesProvider { - /** - * An optional event to signal that inline values have changed. - * @see {@link EventEmitter} - */ - onDidChangeInlineValues?: Event | undefined; - - /** - * Provide "inline value" information for a given document and range. - * The editor calls this method whenever debugging stops in the given document. - * The returned inline values information is rendered in the editor at the end of lines. - * - * @param document The document for which the inline values information is needed. - * @param viewPort The visible document range for which inline values should be computed. - * @param context A bag containing contextual information like the current location. - * @param token A cancellation token. - * @returns An array of InlineValueDescriptors or a thenable that resolves to such. The lack of a result can be - * signaled by returning `undefined` or `null`. - */ - provideInlineValues( - document: TextDocument, - viewPort: Range, - context: InlineValueContext, - token: CancellationToken, - ): ProviderResult; - } - - /** - * A document highlight kind. - */ - export enum DocumentHighlightKind { - /** - * A textual occurrence. - */ - Text = 0, - - /** - * Read-access of a symbol, like reading a variable. - */ - Read = 1, - - /** - * Write-access of a symbol, like writing to a variable. - */ - Write = 2, - } - - /** - * A document highlight is a range inside a text document which deserves - * special attention. Usually a document highlight is visualized by changing - * the background color of its range. - */ - export class DocumentHighlight { - /** - * The range this highlight applies to. - */ - range: Range; - - /** - * The highlight kind, default is {@link DocumentHighlightKind.Text text}. - */ - kind?: DocumentHighlightKind; - - /** - * Creates a new document highlight object. - * - * @param range The range the highlight applies to. - * @param kind The highlight kind, default is {@link DocumentHighlightKind.Text text}. - */ - constructor(range: Range, kind?: DocumentHighlightKind); - } - - /** - * The document highlight provider interface defines the contract between extensions and - * the word-highlight-feature. - */ - export interface DocumentHighlightProvider { - /** - * Provide a set of document highlights, like all occurrences of a variable or - * all exit-points of a function. - * - * @param document The document in which the command was invoked. - * @param position The position at which the command was invoked. - * @param token A cancellation token. - * @returns An array of document highlights or a thenable that resolves to such. The lack of a result can be - * signaled by returning `undefined`, `null`, or an empty array. - */ - provideDocumentHighlights( - document: TextDocument, - position: Position, - token: CancellationToken, - ): ProviderResult; - } - - /** - * A symbol kind. - */ - export enum SymbolKind { - /** - * The `File` symbol kind. - */ - File = 0, - /** - * The `Module` symbol kind. - */ - Module = 1, - /** - * The `Namespace` symbol kind. - */ - Namespace = 2, - /** - * The `Package` symbol kind. - */ - Package = 3, - /** - * The `Class` symbol kind. - */ - Class = 4, - /** - * The `Method` symbol kind. - */ - Method = 5, - /** - * The `Property` symbol kind. - */ - Property = 6, - /** - * The `Field` symbol kind. - */ - Field = 7, - /** - * The `Constructor` symbol kind. - */ - Constructor = 8, - /** - * The `Enum` symbol kind. - */ - Enum = 9, - /** - * The `Interface` symbol kind. - */ - Interface = 10, - /** - * The `Function` symbol kind. - */ - Function = 11, - /** - * The `Variable` symbol kind. - */ - Variable = 12, - /** - * The `Constant` symbol kind. - */ - Constant = 13, - /** - * The `String` symbol kind. - */ - String = 14, - /** - * The `Number` symbol kind. - */ - Number = 15, - /** - * The `Boolean` symbol kind. - */ - Boolean = 16, - /** - * The `Array` symbol kind. - */ - Array = 17, - /** - * The `Object` symbol kind. - */ - Object = 18, - /** - * The `Key` symbol kind. - */ - Key = 19, - /** - * The `Null` symbol kind. - */ - Null = 20, - /** - * The `EnumMember` symbol kind. - */ - EnumMember = 21, - /** - * The `Struct` symbol kind. - */ - Struct = 22, - /** - * The `Event` symbol kind. - */ - Event = 23, - /** - * The `Operator` symbol kind. - */ - Operator = 24, - /** - * The `TypeParameter` symbol kind. - */ - TypeParameter = 25, - } - - /** - * Symbol tags are extra annotations that tweak the rendering of a symbol. - */ - export enum SymbolTag { - /** - * Render a symbol as obsolete, usually using a strike-out. - */ - Deprecated = 1, - } - - /** - * Represents information about programming constructs like variables, classes, - * interfaces etc. - */ - export class SymbolInformation { - /** - * The name of this symbol. - */ - name: string; - - /** - * The name of the symbol containing this symbol. - */ - containerName: string; - - /** - * The kind of this symbol. - */ - kind: SymbolKind; - - /** - * Tags for this symbol. - */ - tags?: readonly SymbolTag[]; - - /** - * The location of this symbol. - */ - location: Location; - - /** - * Creates a new symbol information object. - * - * @param name The name of the symbol. - * @param kind The kind of the symbol. - * @param containerName The name of the symbol containing the symbol. - * @param location The location of the symbol. - */ - constructor( - name: string, - kind: SymbolKind, - containerName: string, - location: Location, - ); - - /** - * Creates a new symbol information object. - * - * @deprecated Please use the constructor taking a {@link Location} object. - * - * @param name The name of the symbol. - * @param kind The kind of the symbol. - * @param range The range of the location of the symbol. - * @param uri The resource of the location of symbol, defaults to the current document. - * @param containerName The name of the symbol containing the symbol. - */ - constructor( - name: string, - kind: SymbolKind, - range: Range, - uri?: Uri, - containerName?: string, - ); - } - - /** - * Represents programming constructs like variables, classes, interfaces etc. that appear in a document. Document - * symbols can be hierarchical and they have two ranges: one that encloses its definition and one that points to - * its most interesting range, e.g. the range of an identifier. - */ - export class DocumentSymbol { - /** - * The name of this symbol. - */ - name: string; - - /** - * More detail for this symbol, e.g. the signature of a function. - */ - detail: string; - - /** - * The kind of this symbol. - */ - kind: SymbolKind; - - /** - * Tags for this symbol. - */ - tags?: readonly SymbolTag[]; - - /** - * The range enclosing this symbol not including leading/trailing whitespace but everything else, e.g. comments and code. - */ - range: Range; - - /** - * The range that should be selected and reveal when this symbol is being picked, e.g. the name of a function. - * Must be contained by the {@linkcode DocumentSymbol.range range}. - */ - selectionRange: Range; - - /** - * Children of this symbol, e.g. properties of a class. - */ - children: DocumentSymbol[]; - - /** - * Creates a new document symbol. - * - * @param name The name of the symbol. - * @param detail Details for the symbol. - * @param kind The kind of the symbol. - * @param range The full range of the symbol. - * @param selectionRange The range that should be reveal. - */ - constructor( - name: string, - detail: string, - kind: SymbolKind, - range: Range, - selectionRange: Range, - ); - } - - /** - * The document symbol provider interface defines the contract between extensions and - * the [go to symbol](https://code.visualstudio.com/docs/editor/editingevolved#_go-to-symbol)-feature. - */ - export interface DocumentSymbolProvider { - /** - * Provide symbol information for the given document. - * - * @param document The document in which the command was invoked. - * @param token A cancellation token. - * @returns An array of document highlights or a thenable that resolves to such. The lack of a result can be - * signaled by returning `undefined`, `null`, or an empty array. - */ - provideDocumentSymbols( - document: TextDocument, - token: CancellationToken, - ): ProviderResult; - } - - /** - * Metadata about a document symbol provider. - */ - export interface DocumentSymbolProviderMetadata { - /** - * A human-readable string that is shown when multiple outlines trees show for one document. - */ - label?: string; - } - - /** - * The workspace symbol provider interface defines the contract between extensions and - * the [symbol search](https://code.visualstudio.com/docs/editor/editingevolved#_open-symbol-by-name)-feature. - */ - export interface WorkspaceSymbolProvider< - T extends SymbolInformation = SymbolInformation, - > { - /** - * Project-wide search for a symbol matching the given query string. - * - * The `query`-parameter should be interpreted in a *relaxed way* as the editor will apply its own highlighting - * and scoring on the results. A good rule of thumb is to match case-insensitive and to simply check that the - * characters of *query* appear in their order in a candidate symbol. Don't use prefix, substring, or similar - * strict matching. - * - * To improve performance implementors can implement `resolveWorkspaceSymbol` and then provide symbols with partial - * {@link SymbolInformation.location location}-objects, without a `range` defined. The editor will then call - * `resolveWorkspaceSymbol` for selected symbols only, e.g. when opening a workspace symbol. - * - * @param query A query string, can be the empty string in which case all symbols should be returned. - * @param token A cancellation token. - * @returns An array of document highlights or a thenable that resolves to such. The lack of a result can be - * signaled by returning `undefined`, `null`, or an empty array. - */ - provideWorkspaceSymbols( - query: string, - token: CancellationToken, - ): ProviderResult; - - /** - * Given a symbol fill in its {@link SymbolInformation.location location}. This method is called whenever a symbol - * is selected in the UI. Providers can implement this method and return incomplete symbols from - * {@linkcode WorkspaceSymbolProvider.provideWorkspaceSymbols provideWorkspaceSymbols} which often helps to improve - * performance. - * - * @param symbol The symbol that is to be resolved. Guaranteed to be an instance of an object returned from an - * earlier call to `provideWorkspaceSymbols`. - * @param token A cancellation token. - * @returns The resolved symbol or a thenable that resolves to that. When no result is returned, - * the given `symbol` is used. - */ - resolveWorkspaceSymbol?( - symbol: T, - token: CancellationToken, - ): ProviderResult; - } - - /** - * Value-object that contains additional information when - * requesting references. - */ - export interface ReferenceContext { - /** - * Include the declaration of the current symbol. - */ - readonly includeDeclaration: boolean; - } - - /** - * The reference provider interface defines the contract between extensions and - * the [find references](https://code.visualstudio.com/docs/editor/editingevolved#_peek)-feature. - */ - export interface ReferenceProvider { - /** - * Provide a set of project-wide references for the given position and document. - * - * @param document The document in which the command was invoked. - * @param position The position at which the command was invoked. - * @param context Additional information about the references request. - * @param token A cancellation token. - * - * @returns An array of locations or a thenable that resolves to such. The lack of a result can be - * signaled by returning `undefined`, `null`, or an empty array. - */ - provideReferences( - document: TextDocument, - position: Position, - context: ReferenceContext, - token: CancellationToken, - ): ProviderResult; - } - - /** - * A text edit represents edits that should be applied - * to a document. - */ - export class TextEdit { - /** - * Utility to create a replace edit. - * - * @param range A range. - * @param newText A string. - * @returns A new text edit object. - */ - static replace(range: Range, newText: string): TextEdit; - - /** - * Utility to create an insert edit. - * - * @param position A position, will become an empty range. - * @param newText A string. - * @returns A new text edit object. - */ - static insert(position: Position, newText: string): TextEdit; - - /** - * Utility to create a delete edit. - * - * @param range A range. - * @returns A new text edit object. - */ - static delete(range: Range): TextEdit; - - /** - * Utility to create an eol-edit. - * - * @param eol An eol-sequence - * @returns A new text edit object. - */ - static setEndOfLine(eol: EndOfLine): TextEdit; - - /** - * The range this edit applies to. - */ - range: Range; - - /** - * The string this edit will insert. - */ - newText: string; - - /** - * The eol-sequence used in the document. - * - * *Note* that the eol-sequence will be applied to the - * whole document. - */ - newEol?: EndOfLine; - - /** - * Create a new TextEdit. - * - * @param range A range. - * @param newText A string. - */ - constructor(range: Range, newText: string); - } - - /** - * A snippet edit represents an interactive edit that is performed by - * the editor. - * - * *Note* that a snippet edit can always be performed as a normal {@link TextEdit text edit}. - * This will happen when no matching editor is open or when a {@link WorkspaceEdit workspace edit} - * contains snippet edits for multiple files. In that case only those that match the active editor - * will be performed as snippet edits and the others as normal text edits. - */ - export class SnippetTextEdit { - /** - * Utility to create a replace snippet edit. - * - * @param range A range. - * @param snippet A snippet string. - * @returns A new snippet edit object. - */ - static replace(range: Range, snippet: SnippetString): SnippetTextEdit; - - /** - * Utility to create an insert snippet edit. - * - * @param position A position, will become an empty range. - * @param snippet A snippet string. - * @returns A new snippet edit object. - */ - static insert( - position: Position, - snippet: SnippetString, - ): SnippetTextEdit; - - /** - * The range this edit applies to. - */ - range: Range; - - /** - * The {@link SnippetString snippet} this edit will perform. - */ - snippet: SnippetString; - - /** - * Create a new snippet edit. - * - * @param range A range. - * @param snippet A snippet string. - */ - constructor(range: Range, snippet: SnippetString); - } - - /** - * A notebook edit represents edits that should be applied to the contents of a notebook. - */ - export class NotebookEdit { - /** - * Utility to create a edit that replaces cells in a notebook. - * - * @param range The range of cells to replace - * @param newCells The new notebook cells. - */ - static replaceCells( - range: NotebookRange, - newCells: NotebookCellData[], - ): NotebookEdit; - - /** - * Utility to create an edit that replaces cells in a notebook. - * - * @param index The index to insert cells at. - * @param newCells The new notebook cells. - */ - static insertCells( - index: number, - newCells: NotebookCellData[], - ): NotebookEdit; - - /** - * Utility to create an edit that deletes cells in a notebook. - * - * @param range The range of cells to delete. - */ - static deleteCells(range: NotebookRange): NotebookEdit; - - /** - * Utility to create an edit that update a cell's metadata. - * - * @param index The index of the cell to update. - * @param newCellMetadata The new metadata for the cell. - */ - static updateCellMetadata( - index: number, - newCellMetadata: { [key: string]: any }, - ): NotebookEdit; - - /** - * Utility to create an edit that updates the notebook's metadata. - * - * @param newNotebookMetadata The new metadata for the notebook. - */ - static updateNotebookMetadata(newNotebookMetadata: { - [key: string]: any; - }): NotebookEdit; - - /** - * Range of the cells being edited. May be empty. - */ - range: NotebookRange; - - /** - * New cells being inserted. May be empty. - */ - newCells: NotebookCellData[]; - - /** - * Optional new metadata for the cells. - */ - newCellMetadata?: { [key: string]: any }; - - /** - * Optional new metadata for the notebook. - */ - newNotebookMetadata?: { [key: string]: any }; - - /** - * Create a new notebook edit. - * - * @param range A notebook range. - * @param newCells An array of new cell data. - */ - constructor(range: NotebookRange, newCells: NotebookCellData[]); - } - - /** - * Additional data for entries of a workspace edit. Supports to label entries and marks entries - * as needing confirmation by the user. The editor groups edits with equal labels into tree nodes, - * for instance all edits labelled with "Changes in Strings" would be a tree node. - */ - export interface WorkspaceEditEntryMetadata { - /** - * A flag which indicates that user confirmation is needed. - */ - needsConfirmation: boolean; - - /** - * A human-readable string which is rendered prominent. - */ - label: string; - - /** - * A human-readable string which is rendered less prominent on the same line. - */ - description?: string; - - /** - * The icon path or {@link ThemeIcon} for the edit. - */ - iconPath?: IconPath; - } - - /** - * Additional data about a workspace edit. - */ - export interface WorkspaceEditMetadata { - /** - * Signal to the editor that this edit is a refactoring. - */ - isRefactoring?: boolean; - } - - /** - * A workspace edit is a collection of textual and files changes for - * multiple resources and documents. - * - * Use the {@link workspace.applyEdit applyEdit}-function to apply a workspace edit. - */ - export class WorkspaceEdit { - /** - * The number of affected resources of textual or resource changes. - */ - readonly size: number; - - /** - * Replace the given range with given text for the given resource. - * - * @param uri A resource identifier. - * @param range A range. - * @param newText A string. - * @param metadata Optional metadata for the entry. - */ - replace( - uri: Uri, - range: Range, - newText: string, - metadata?: WorkspaceEditEntryMetadata, - ): void; - - /** - * Insert the given text at the given position. - * - * @param uri A resource identifier. - * @param position A position. - * @param newText A string. - * @param metadata Optional metadata for the entry. - */ - insert( - uri: Uri, - position: Position, - newText: string, - metadata?: WorkspaceEditEntryMetadata, - ): void; - - /** - * Delete the text at the given range. - * - * @param uri A resource identifier. - * @param range A range. - * @param metadata Optional metadata for the entry. - */ - delete( - uri: Uri, - range: Range, - metadata?: WorkspaceEditEntryMetadata, - ): void; - - /** - * Check if a text edit for a resource exists. - * - * @param uri A resource identifier. - * @returns `true` if the given resource will be touched by this edit. - */ - has(uri: Uri): boolean; - - /** - * Set (and replace) text edits or snippet edits for a resource. - * - * @param uri A resource identifier. - * @param edits An array of edits. - */ - set(uri: Uri, edits: ReadonlyArray): void; - - /** - * Set (and replace) text edits or snippet edits with metadata for a resource. - * - * @param uri A resource identifier. - * @param edits An array of edits. - */ - set( - uri: Uri, - edits: ReadonlyArray< - [ - TextEdit | SnippetTextEdit, - WorkspaceEditEntryMetadata | undefined, - ] - >, - ): void; - - /** - * Set (and replace) notebook edits for a resource. - * - * @param uri A resource identifier. - * @param edits An array of edits. - */ - set(uri: Uri, edits: readonly NotebookEdit[]): void; - - /** - * Set (and replace) notebook edits with metadata for a resource. - * - * @param uri A resource identifier. - * @param edits An array of edits. - */ - set( - uri: Uri, - edits: ReadonlyArray< - [NotebookEdit, WorkspaceEditEntryMetadata | undefined] - >, - ): void; - - /** - * Get the text edits for a resource. - * - * @param uri A resource identifier. - * @returns An array of text edits. - */ - get(uri: Uri): TextEdit[]; - - /** - * Create a regular file. - * - * @param uri Uri of the new file. - * @param options Defines if an existing file should be overwritten or be - * ignored. When `overwrite` and `ignoreIfExists` are both set `overwrite` wins. - * When both are unset and when the file already exists then the edit cannot - * be applied successfully. The `content`-property allows to set the initial contents - * the file is being created with. - * @param metadata Optional metadata for the entry. - */ - createFile( - uri: Uri, - options?: { - /** - * Overwrite existing file. Overwrite wins over `ignoreIfExists` - */ - readonly overwrite?: boolean; - /** - * Do nothing if a file with `uri` exists already. - */ - readonly ignoreIfExists?: boolean; - /** - * The initial contents of the new file. - * - * If creating a file from a {@link DocumentDropEditProvider drop operation}, you can - * pass in a {@link DataTransferFile} to improve performance by avoiding extra data copying. - */ - readonly contents?: Uint8Array | DataTransferFile; - }, - metadata?: WorkspaceEditEntryMetadata, - ): void; - - /** - * Delete a file or folder. - * - * @param uri The uri of the file that is to be deleted. - * @param metadata Optional metadata for the entry. - */ - deleteFile( - uri: Uri, - options?: { - /** - * Delete the content recursively if a folder is denoted. - */ - readonly recursive?: boolean; - /** - * Do nothing if a file with `uri` exists already. - */ - readonly ignoreIfNotExists?: boolean; - }, - metadata?: WorkspaceEditEntryMetadata, - ): void; - - /** - * Rename a file or folder. - * - * @param oldUri The existing file. - * @param newUri The new location. - * @param options Defines if existing files should be overwritten or be - * ignored. When overwrite and ignoreIfExists are both set overwrite wins. - * @param metadata Optional metadata for the entry. - */ - renameFile( - oldUri: Uri, - newUri: Uri, - options?: { - /** - * Overwrite existing file. Overwrite wins over `ignoreIfExists` - */ - readonly overwrite?: boolean; - /** - * Do nothing if a file with `uri` exists already. - */ - readonly ignoreIfExists?: boolean; - }, - metadata?: WorkspaceEditEntryMetadata, - ): void; - - /** - * Get all text edits grouped by resource. - * - * @returns A shallow copy of `[Uri, TextEdit[]]`-tuples. - */ - entries(): [Uri, TextEdit[]][]; - } - - /** - * A snippet string is a template which allows to insert text - * and to control the editor cursor when insertion happens. - * - * A snippet can define tab stops and placeholders with `$1`, `$2` - * and `${3:foo}`. `$0` defines the final tab stop, it defaults to - * the end of the snippet. Variables are defined with `$name` and - * `${name:default value}`. Also see - * [the full snippet syntax](https://code.visualstudio.com/docs/editor/userdefinedsnippets#_create-your-own-snippets). - */ - export class SnippetString { - /** - * The snippet string. - */ - value: string; - - /** - * Create a new snippet string. - * - * @param value A snippet string. - */ - constructor(value?: string); - - /** - * Builder-function that appends the given string to - * the {@linkcode SnippetString.value value} of this snippet string. - * - * @param string A value to append 'as given'. The string will be escaped. - * @returns This snippet string. - */ - appendText(string: string): SnippetString; - - /** - * Builder-function that appends a tabstop (`$1`, `$2` etc) to - * the {@linkcode SnippetString.value value} of this snippet string. - * - * @param number The number of this tabstop, defaults to an auto-increment - * value starting at 1. - * @returns This snippet string. - */ - appendTabstop(number?: number): SnippetString; - - /** - * Builder-function that appends a placeholder (`${1:value}`) to - * the {@linkcode SnippetString.value value} of this snippet string. - * - * @param value The value of this placeholder - either a string or a function - * with which a nested snippet can be created. - * @param number The number of this tabstop, defaults to an auto-increment - * value starting at 1. - * @returns This snippet string. - */ - appendPlaceholder( - value: string | ((snippet: SnippetString) => any), - number?: number, - ): SnippetString; - - /** - * Builder-function that appends a choice (`${1|a,b,c|}`) to - * the {@linkcode SnippetString.value value} of this snippet string. - * - * @param values The values for choices - the array of strings - * @param number The number of this tabstop, defaults to an auto-increment - * value starting at 1. - * @returns This snippet string. - */ - appendChoice(values: readonly string[], number?: number): SnippetString; - - /** - * Builder-function that appends a variable (`${VAR}`) to - * the {@linkcode SnippetString.value value} of this snippet string. - * - * @param name The name of the variable - excluding the `$`. - * @param defaultValue The default value which is used when the variable name cannot - * be resolved - either a string or a function with which a nested snippet can be created. - * @returns This snippet string. - */ - appendVariable( - name: string, - defaultValue: string | ((snippet: SnippetString) => any), - ): SnippetString; - } - - /** - * The rename provider interface defines the contract between extensions and - * the [rename](https://code.visualstudio.com/docs/editor/editingevolved#_rename-symbol)-feature. - */ - export interface RenameProvider { - /** - * Provide an edit that describes changes that have to be made to one - * or many resources to rename a symbol to a different name. - * - * @param document The document in which the command was invoked. - * @param position The position at which the command was invoked. - * @param newName The new name of the symbol. If the given name is not valid, the provider must return a rejected promise. - * @param token A cancellation token. - * @returns A workspace edit or a thenable that resolves to such. The lack of a result can be - * signaled by returning `undefined` or `null`. - */ - provideRenameEdits( - document: TextDocument, - position: Position, - newName: string, - token: CancellationToken, - ): ProviderResult; - - /** - * Optional function for resolving and validating a position *before* running rename. The result can - * be a range or a range and a placeholder text. The placeholder text should be the identifier of the symbol - * which is being renamed - when omitted the text in the returned range is used. - * - * *Note:* This function should throw an error or return a rejected thenable when the provided location - * doesn't allow for a rename. - * - * @param document The document in which rename will be invoked. - * @param position The position at which rename will be invoked. - * @param token A cancellation token. - * @returns The range or range and placeholder text of the identifier that is to be renamed. The lack of a result can signaled by returning `undefined` or `null`. - */ - prepareRename?( - document: TextDocument, - position: Position, - token: CancellationToken, - ): ProviderResult< - | Range - | { - /** - * The range of the identifier that can be renamed. - */ - range: Range; - /** - * The placeholder of the editors rename input box. - */ - placeholder: string; - } - >; - } - - /** - * A semantic tokens legend contains the needed information to decipher - * the integer encoded representation of semantic tokens. - */ - export class SemanticTokensLegend { - /** - * The possible token types. - */ - readonly tokenTypes: string[]; - /** - * The possible token modifiers. - */ - readonly tokenModifiers: string[]; - - /** - * Creates a semantic tokens legend. - * - * @param tokenTypes An array of token types. - * @param tokenModifiers An array of token modifiers. - */ - constructor(tokenTypes: string[], tokenModifiers?: string[]); - } - - /** - * A semantic tokens builder can help with creating a `SemanticTokens` instance - * which contains delta encoded semantic tokens. - */ - export class SemanticTokensBuilder { - /** - * Creates a semantic tokens builder. - * - * @param legend A semantic tokens legend. - */ - constructor(legend?: SemanticTokensLegend); - - /** - * Add another token. - * - * @param line The token start line number (absolute value). - * @param char The token start character (absolute value). - * @param length The token length in characters. - * @param tokenType The encoded token type. - * @param tokenModifiers The encoded token modifiers. - */ - push( - line: number, - char: number, - length: number, - tokenType: number, - tokenModifiers?: number, - ): void; - - /** - * Add another token. Use only when providing a legend. - * - * @param range The range of the token. Must be single-line. - * @param tokenType The token type. - * @param tokenModifiers The token modifiers. - */ - push( - range: Range, - tokenType: string, - tokenModifiers?: readonly string[], - ): void; - - /** - * Finish and create a `SemanticTokens` instance. - */ - build(resultId?: string): SemanticTokens; - } - - /** - * Represents semantic tokens, either in a range or in an entire document. - * @see {@link DocumentSemanticTokensProvider.provideDocumentSemanticTokens provideDocumentSemanticTokens} for an explanation of the format. - * @see {@link SemanticTokensBuilder} for a helper to create an instance. - */ - export class SemanticTokens { - /** - * The result id of the tokens. - * - * This is the id that will be passed to `DocumentSemanticTokensProvider.provideDocumentSemanticTokensEdits` (if implemented). - */ - readonly resultId: string | undefined; - /** - * The actual tokens data. - * @see {@link DocumentSemanticTokensProvider.provideDocumentSemanticTokens provideDocumentSemanticTokens} for an explanation of the format. - */ - readonly data: Uint32Array; - - /** - * Create new semantic tokens. - * - * @param data Token data. - * @param resultId Result identifier. - */ - constructor(data: Uint32Array, resultId?: string); - } - - /** - * Represents edits to semantic tokens. - * @see {@link DocumentSemanticTokensProvider.provideDocumentSemanticTokensEdits provideDocumentSemanticTokensEdits} for an explanation of the format. - */ - export class SemanticTokensEdits { - /** - * The result id of the tokens. - * - * This is the id that will be passed to `DocumentSemanticTokensProvider.provideDocumentSemanticTokensEdits` (if implemented). - */ - readonly resultId: string | undefined; - /** - * The edits to the tokens data. - * All edits refer to the initial data state. - */ - readonly edits: SemanticTokensEdit[]; - - /** - * Create new semantic tokens edits. - * - * @param edits An array of semantic token edits - * @param resultId Result identifier. - */ - constructor(edits: SemanticTokensEdit[], resultId?: string); - } - - /** - * Represents an edit to semantic tokens. - * @see {@link DocumentSemanticTokensProvider.provideDocumentSemanticTokensEdits provideDocumentSemanticTokensEdits} for an explanation of the format. - */ - export class SemanticTokensEdit { - /** - * The start offset of the edit. - */ - readonly start: number; - /** - * The count of elements to remove. - */ - readonly deleteCount: number; - /** - * The elements to insert. - */ - readonly data: Uint32Array | undefined; - - /** - * Create a semantic token edit. - * - * @param start Start offset - * @param deleteCount Number of elements to remove. - * @param data Elements to insert - */ - constructor(start: number, deleteCount: number, data?: Uint32Array); - } - - /** - * The document semantic tokens provider interface defines the contract between extensions and - * semantic tokens. - */ - export interface DocumentSemanticTokensProvider { - /** - * An optional event to signal that the semantic tokens from this provider have changed. - */ - onDidChangeSemanticTokens?: Event; - - /** - * Tokens in a file are represented as an array of integers. The position of each token is expressed relative to - * the token before it, because most tokens remain stable relative to each other when edits are made in a file. - * - * --- - * In short, each token takes 5 integers to represent, so a specific token `i` in the file consists of the following array indices: - * - at index `5*i` - `deltaLine`: token line number, relative to the previous token - * - at index `5*i+1` - `deltaStart`: token start character, relative to the previous token (relative to 0 or the previous token's start if they are on the same line) - * - at index `5*i+2` - `length`: the length of the token. A token cannot be multiline. - * - at index `5*i+3` - `tokenType`: will be looked up in `SemanticTokensLegend.tokenTypes`. We currently ask that `tokenType` < 65536. - * - at index `5*i+4` - `tokenModifiers`: each set bit will be looked up in `SemanticTokensLegend.tokenModifiers` - * - * --- - * ### How to encode tokens - * - * Here is an example for encoding a file with 3 tokens in a uint32 array: - * ``` - * { line: 2, startChar: 5, length: 3, tokenType: "property", tokenModifiers: ["private", "static"] }, - * { line: 2, startChar: 10, length: 4, tokenType: "type", tokenModifiers: [] }, - * { line: 5, startChar: 2, length: 7, tokenType: "class", tokenModifiers: [] } - * ``` - * - * 1. First of all, a legend must be devised. This legend must be provided up-front and capture all possible token types. - * For this example, we will choose the following legend which must be passed in when registering the provider: - * ``` - * tokenTypes: ['property', 'type', 'class'], - * tokenModifiers: ['private', 'static'] - * ``` - * - * 2. The first transformation step is to encode `tokenType` and `tokenModifiers` as integers using the legend. Token types are looked - * up by index, so a `tokenType` value of `1` means `tokenTypes[1]`. Multiple token modifiers can be set by using bit flags, - * so a `tokenModifier` value of `3` is first viewed as binary `0b00000011`, which means `[tokenModifiers[0], tokenModifiers[1]]` because - * bits 0 and 1 are set. Using this legend, the tokens now are: - * ``` - * { line: 2, startChar: 5, length: 3, tokenType: 0, tokenModifiers: 3 }, - * { line: 2, startChar: 10, length: 4, tokenType: 1, tokenModifiers: 0 }, - * { line: 5, startChar: 2, length: 7, tokenType: 2, tokenModifiers: 0 } - * ``` - * - * 3. The next step is to represent each token relative to the previous token in the file. In this case, the second token - * is on the same line as the first token, so the `startChar` of the second token is made relative to the `startChar` - * of the first token, so it will be `10 - 5`. The third token is on a different line than the second token, so the - * `startChar` of the third token will not be altered: - * ``` - * { deltaLine: 2, deltaStartChar: 5, length: 3, tokenType: 0, tokenModifiers: 3 }, - * { deltaLine: 0, deltaStartChar: 5, length: 4, tokenType: 1, tokenModifiers: 0 }, - * { deltaLine: 3, deltaStartChar: 2, length: 7, tokenType: 2, tokenModifiers: 0 } - * ``` - * - * 4. Finally, the last step is to inline each of the 5 fields for a token in a single array, which is a memory friendly representation: - * ``` - * // 1st token, 2nd token, 3rd token - * [ 2,5,3,0,3, 0,5,4,1,0, 3,2,7,2,0 ] - * ``` - * - * @see {@link SemanticTokensBuilder} for a helper to encode tokens as integers. - * *NOTE*: When doing edits, it is possible that multiple edits occur until the editor decides to invoke the semantic tokens provider. - * *NOTE*: If the provider cannot temporarily compute semantic tokens, it can indicate this by throwing an error with the message 'Busy'. - */ - provideDocumentSemanticTokens( - document: TextDocument, - token: CancellationToken, - ): ProviderResult; - - /** - * Instead of always returning all the tokens in a file, it is possible for a `DocumentSemanticTokensProvider` to implement - * this method (`provideDocumentSemanticTokensEdits`) and then return incremental updates to the previously provided semantic tokens. - * - * --- - * ### How tokens change when the document changes - * - * Suppose that `provideDocumentSemanticTokens` has previously returned the following semantic tokens: - * ``` - * // 1st token, 2nd token, 3rd token - * [ 2,5,3,0,3, 0,5,4,1,0, 3,2,7,2,0 ] - * ``` - * - * Also suppose that after some edits, the new semantic tokens in a file are: - * ``` - * // 1st token, 2nd token, 3rd token - * [ 3,5,3,0,3, 0,5,4,1,0, 3,2,7,2,0 ] - * ``` - * It is possible to express these new tokens in terms of an edit applied to the previous tokens: - * ``` - * [ 2,5,3,0,3, 0,5,4,1,0, 3,2,7,2,0 ] // old tokens - * [ 3,5,3,0,3, 0,5,4,1,0, 3,2,7,2,0 ] // new tokens - * - * edit: { start: 0, deleteCount: 1, data: [3] } // replace integer at offset 0 with 3 - * ``` - * - * *NOTE*: If the provider cannot compute `SemanticTokensEdits`, it can "give up" and return all the tokens in the document again. - * *NOTE*: All edits in `SemanticTokensEdits` contain indices in the old integers array, so they all refer to the previous result state. - */ - provideDocumentSemanticTokensEdits?( - document: TextDocument, - previousResultId: string, - token: CancellationToken, - ): ProviderResult; - } - - /** - * The document range semantic tokens provider interface defines the contract between extensions and - * semantic tokens. - */ - export interface DocumentRangeSemanticTokensProvider { - /** - * @see {@link DocumentSemanticTokensProvider.provideDocumentSemanticTokens provideDocumentSemanticTokens}. - */ - provideDocumentRangeSemanticTokens( - document: TextDocument, - range: Range, - token: CancellationToken, - ): ProviderResult; - } - - /** - * Value-object describing what options formatting should use. - */ - export interface FormattingOptions { - /** - * Size of a tab in spaces. - */ - tabSize: number; - - /** - * Prefer spaces over tabs. - */ - insertSpaces: boolean; - - /** - * Signature for further properties. - */ - [key: string]: boolean | number | string; - } - - /** - * The document formatting provider interface defines the contract between extensions and - * the formatting-feature. - */ - export interface DocumentFormattingEditProvider { - /** - * Provide formatting edits for a whole document. - * - * @param document The document in which the command was invoked. - * @param options Options controlling formatting. - * @param token A cancellation token. - * @returns A set of text edits or a thenable that resolves to such. The lack of a result can be - * signaled by returning `undefined`, `null`, or an empty array. - */ - provideDocumentFormattingEdits( - document: TextDocument, - options: FormattingOptions, - token: CancellationToken, - ): ProviderResult; - } - - /** - * The document formatting provider interface defines the contract between extensions and - * the formatting-feature. - */ - export interface DocumentRangeFormattingEditProvider { - /** - * Provide formatting edits for a range in a document. - * - * The given range is a hint and providers can decide to format a smaller - * or larger range. Often this is done by adjusting the start and end - * of the range to full syntax nodes. - * - * @param document The document in which the command was invoked. - * @param range The range which should be formatted. - * @param options Options controlling formatting. - * @param token A cancellation token. - * @returns A set of text edits or a thenable that resolves to such. The lack of a result can be - * signaled by returning `undefined`, `null`, or an empty array. - */ - provideDocumentRangeFormattingEdits( - document: TextDocument, - range: Range, - options: FormattingOptions, - token: CancellationToken, - ): ProviderResult; - - /** - * Provide formatting edits for multiple ranges in a document. - * - * This function is optional but allows a formatter to perform faster when formatting only modified ranges or when - * formatting a large number of selections. - * - * The given ranges are hints and providers can decide to format a smaller - * or larger range. Often this is done by adjusting the start and end - * of the range to full syntax nodes. - * - * @param document The document in which the command was invoked. - * @param ranges The ranges which should be formatted. - * @param options Options controlling formatting. - * @param token A cancellation token. - * @returns A set of text edits or a thenable that resolves to such. The lack of a result can be - * signaled by returning `undefined`, `null`, or an empty array. - */ - provideDocumentRangesFormattingEdits?( - document: TextDocument, - ranges: Range[], - options: FormattingOptions, - token: CancellationToken, - ): ProviderResult; - } - - /** - * The document formatting provider interface defines the contract between extensions and - * the formatting-feature. - */ - export interface OnTypeFormattingEditProvider { - /** - * Provide formatting edits after a character has been typed. - * - * The given position and character should hint to the provider - * what range the position to expand to, like find the matching `{` - * when `}` has been entered. - * - * @param document The document in which the command was invoked. - * @param position The position at which the command was invoked. - * @param ch The character that has been typed. - * @param options Options controlling formatting. - * @param token A cancellation token. - * @returns A set of text edits or a thenable that resolves to such. The lack of a result can be - * signaled by returning `undefined`, `null`, or an empty array. - */ - provideOnTypeFormattingEdits( - document: TextDocument, - position: Position, - ch: string, - options: FormattingOptions, - token: CancellationToken, - ): ProviderResult; - } - - /** - * Represents a parameter of a callable-signature. A parameter can - * have a label and a doc-comment. - */ - export class ParameterInformation { - /** - * The label of this signature. - * - * Either a string or inclusive start and exclusive end offsets within its containing - * {@link SignatureInformation.label signature label}. *Note*: A label of type string must be - * a substring of its containing signature information's {@link SignatureInformation.label label}. - */ - label: string | [number, number]; - - /** - * The human-readable doc-comment of this signature. Will be shown - * in the UI but can be omitted. - */ - documentation?: string | MarkdownString; - - /** - * Creates a new parameter information object. - * - * @param label A label string or inclusive start and exclusive end offsets within its containing signature label. - * @param documentation A doc string. - */ - constructor( - label: string | [number, number], - documentation?: string | MarkdownString, - ); - } - - /** - * Represents the signature of something callable. A signature - * can have a label, like a function-name, a doc-comment, and - * a set of parameters. - */ - export class SignatureInformation { - /** - * The label of this signature. Will be shown in - * the UI. - */ - label: string; - - /** - * The human-readable doc-comment of this signature. Will be shown - * in the UI but can be omitted. - */ - documentation?: string | MarkdownString; - - /** - * The parameters of this signature. - */ - parameters: ParameterInformation[]; - - /** - * The index of the active parameter. - * - * If provided, this is used in place of {@linkcode SignatureHelp.activeParameter}. - */ - activeParameter?: number; - - /** - * Creates a new signature information object. - * - * @param label A label string. - * @param documentation A doc string. - */ - constructor(label: string, documentation?: string | MarkdownString); - } - - /** - * Signature help represents the signature of something - * callable. There can be multiple signatures but only one - * active and only one active parameter. - */ - export class SignatureHelp { - /** - * One or more signatures. - */ - signatures: SignatureInformation[]; - - /** - * The active signature. - */ - activeSignature: number; - - /** - * The active parameter of the active signature. - */ - activeParameter: number; - } - - /** - * How a {@linkcode SignatureHelpProvider} was triggered. - */ - export enum SignatureHelpTriggerKind { - /** - * Signature help was invoked manually by the user or by a command. - */ - Invoke = 1, - - /** - * Signature help was triggered by a trigger character. - */ - TriggerCharacter = 2, - - /** - * Signature help was triggered by the cursor moving or by the document content changing. - */ - ContentChange = 3, - } - - /** - * Additional information about the context in which a - * {@linkcode SignatureHelpProvider.provideSignatureHelp SignatureHelpProvider} was triggered. - */ - export interface SignatureHelpContext { - /** - * Action that caused signature help to be triggered. - */ - readonly triggerKind: SignatureHelpTriggerKind; - - /** - * Character that caused signature help to be triggered. - * - * This is `undefined` when signature help is not triggered by typing, such as when manually invoking - * signature help or when moving the cursor. - */ - readonly triggerCharacter: string | undefined; - - /** - * `true` if signature help was already showing when it was triggered. - * - * Retriggers occur when the signature help is already active and can be caused by actions such as - * typing a trigger character, a cursor move, or document content changes. - */ - readonly isRetrigger: boolean; - - /** - * The currently active {@linkcode SignatureHelp}. - * - * The `activeSignatureHelp` has its {@linkcode SignatureHelp.activeSignature activeSignature} field updated based on - * the user arrowing through available signatures. - */ - readonly activeSignatureHelp: SignatureHelp | undefined; - } - - /** - * The signature help provider interface defines the contract between extensions and - * the [parameter hints](https://code.visualstudio.com/docs/editor/intellisense)-feature. - */ - export interface SignatureHelpProvider { - /** - * Provide help for the signature at the given position and document. - * - * @param document The document in which the command was invoked. - * @param position The position at which the command was invoked. - * @param token A cancellation token. - * @param context Information about how signature help was triggered. - * - * @returns Signature help or a thenable that resolves to such. The lack of a result can be - * signaled by returning `undefined` or `null`. - */ - provideSignatureHelp( - document: TextDocument, - position: Position, - token: CancellationToken, - context: SignatureHelpContext, - ): ProviderResult; - } - - /** - * Metadata about a registered {@linkcode SignatureHelpProvider}. - */ - export interface SignatureHelpProviderMetadata { - /** - * List of characters that trigger signature help. - */ - readonly triggerCharacters: readonly string[]; - - /** - * List of characters that re-trigger signature help. - * - * These trigger characters are only active when signature help is already showing. All trigger characters - * are also counted as re-trigger characters. - */ - readonly retriggerCharacters: readonly string[]; - } - - /** - * A structured label for a {@link CompletionItem completion item}. - */ - export interface CompletionItemLabel { - /** - * The label of this completion item. - * - * By default this is also the text that is inserted when this completion is selected. - */ - label: string; - - /** - * An optional string which is rendered less prominently directly after {@link CompletionItemLabel.label label}, - * without any spacing. Should be used for function signatures or type annotations. - */ - detail?: string; - - /** - * An optional string which is rendered less prominently after {@link CompletionItemLabel.detail}. Should be used - * for fully qualified names or file path. - */ - description?: string; - } - - /** - * Completion item kinds. - */ - export enum CompletionItemKind { - /** - * The `Text` completion item kind. - */ - Text = 0, - /** - * The `Method` completion item kind. - */ - Method = 1, - /** - * The `Function` completion item kind. - */ - Function = 2, - /** - * The `Constructor` completion item kind. - */ - Constructor = 3, - /** - * The `Field` completion item kind. - */ - Field = 4, - /** - * The `Variable` completion item kind. - */ - Variable = 5, - /** - * The `Class` completion item kind. - */ - Class = 6, - /** - * The `Interface` completion item kind. - */ - Interface = 7, - /** - * The `Module` completion item kind. - */ - Module = 8, - /** - * The `Property` completion item kind. - */ - Property = 9, - /** - * The `Unit` completion item kind. - */ - Unit = 10, - /** - * The `Value` completion item kind. - */ - Value = 11, - /** - * The `Enum` completion item kind. - */ - Enum = 12, - /** - * The `Keyword` completion item kind. - */ - Keyword = 13, - /** - * The `Snippet` completion item kind. - */ - Snippet = 14, - /** - * The `Color` completion item kind. - */ - Color = 15, - /** - * The `Reference` completion item kind. - */ - Reference = 17, - /** - * The `File` completion item kind. - */ - File = 16, - /** - * The `Folder` completion item kind. - */ - Folder = 18, - /** - * The `EnumMember` completion item kind. - */ - EnumMember = 19, - /** - * The `Constant` completion item kind. - */ - Constant = 20, - /** - * The `Struct` completion item kind. - */ - Struct = 21, - /** - * The `Event` completion item kind. - */ - Event = 22, - /** - * The `Operator` completion item kind. - */ - Operator = 23, - /** - * The `TypeParameter` completion item kind. - */ - TypeParameter = 24, - /** - * The `User` completion item kind. - */ - User = 25, - /** - * The `Issue` completion item kind. - */ - Issue = 26, - } - - /** - * Completion item tags are extra annotations that tweak the rendering of a completion - * item. - */ - export enum CompletionItemTag { - /** - * Render a completion as obsolete, usually using a strike-out. - */ - Deprecated = 1, - } - - /** - * A completion item represents a text snippet that is proposed to complete text that is being typed. - * - * It is sufficient to create a completion item from just a {@link CompletionItem.label label}. In that - * case the completion item will replace the {@link TextDocument.getWordRangeAtPosition word} - * until the cursor with the given label or {@link CompletionItem.insertText insertText}. Otherwise the - * given {@link CompletionItem.textEdit edit} is used. - * - * When selecting a completion item in the editor its defined or synthesized text edit will be applied - * to *all* cursors/selections whereas {@link CompletionItem.additionalTextEdits additionalTextEdits} will be - * applied as provided. - * - * @see {@link CompletionItemProvider.provideCompletionItems} - * @see {@link CompletionItemProvider.resolveCompletionItem} - */ - export class CompletionItem { - /** - * The label of this completion item. By default - * this is also the text that is inserted when selecting - * this completion. - */ - label: string | CompletionItemLabel; - - /** - * The kind of this completion item. Based on the kind - * an icon is chosen by the editor. - */ - kind?: CompletionItemKind; - - /** - * Tags for this completion item. - */ - tags?: readonly CompletionItemTag[]; - - /** - * A human-readable string with additional information - * about this item, like type or symbol information. - */ - detail?: string; - - /** - * A human-readable string that represents a doc-comment. - */ - documentation?: string | MarkdownString; - - /** - * A string that should be used when comparing this item - * with other items. When `falsy` the {@link CompletionItem.label label} - * is used. - * - * Note that `sortText` is only used for the initial ordering of completion - * items. When having a leading word (prefix) ordering is based on how - * well completions match that prefix and the initial ordering is only used - * when completions match equally well. The prefix is defined by the - * {@linkcode CompletionItem.range range}-property and can therefore be different - * for each completion. - */ - sortText?: string; - - /** - * A string that should be used when filtering a set of - * completion items. When `falsy` the {@link CompletionItem.label label} - * is used. - * - * Note that the filter text is matched against the leading word (prefix) which is defined - * by the {@linkcode CompletionItem.range range}-property. - */ - filterText?: string; - - /** - * Select this item when showing. *Note* that only one completion item can be selected and - * that the editor decides which item that is. The rule is that the *first* item of those - * that match best is selected. - */ - preselect?: boolean; - - /** - * A string or snippet that should be inserted in a document when selecting - * this completion. When `falsy` the {@link CompletionItem.label label} - * is used. - */ - insertText?: string | SnippetString; - - /** - * A range or a insert and replace range selecting the text that should be replaced by this completion item. - * - * When omitted, the range of the {@link TextDocument.getWordRangeAtPosition current word} is used as replace-range - * and as insert-range the start of the {@link TextDocument.getWordRangeAtPosition current word} to the - * current position is used. - * - * *Note 1:* A range must be a {@link Range.isSingleLine single line} and it must - * {@link Range.contains contain} the position at which completion has been {@link CompletionItemProvider.provideCompletionItems requested}. - * *Note 2:* A insert range must be a prefix of a replace range, that means it must be contained and starting at the same position. - */ - range?: - | Range - | { - /** - * The range that should be used when insert-accepting a completion. Must be a prefix of `replaceRange`. - */ - inserting: Range; - /** - * The range that should be used when replace-accepting a completion. - */ - replacing: Range; - }; - - /** - * An optional set of characters that when pressed while this completion is active will accept it first and - * then type that character. *Note* that all commit characters should have `length=1` and that superfluous - * characters will be ignored. - */ - commitCharacters?: string[]; - - /** - * Keep whitespace of the {@link CompletionItem.insertText insertText} as is. By default, the editor adjusts leading - * whitespace of new lines so that they match the indentation of the line for which the item is accepted - setting - * this to `true` will prevent that. - */ - keepWhitespace?: boolean; - - /** - * @deprecated Use `CompletionItem.insertText` and `CompletionItem.range` instead. - * - * An {@link TextEdit edit} which is applied to a document when selecting - * this completion. When an edit is provided the value of - * {@link CompletionItem.insertText insertText} is ignored. - * - * The {@link Range} of the edit must be single-line and on the same - * line completions were {@link CompletionItemProvider.provideCompletionItems requested} at. - */ - textEdit?: TextEdit; - - /** - * An optional array of additional {@link TextEdit text edits} that are applied when - * selecting this completion. Edits must not overlap with the main {@link CompletionItem.textEdit edit} - * nor with themselves. - */ - additionalTextEdits?: TextEdit[]; - - /** - * An optional {@link Command} that is executed *after* inserting this completion. *Note* that - * additional modifications to the current document should be described with the - * {@link CompletionItem.additionalTextEdits additionalTextEdits}-property. - */ - command?: Command; - - /** - * Creates a new completion item. - * - * Completion items must have at least a {@link CompletionItem.label label} which then - * will be used as insert text as well as for sorting and filtering. - * - * @param label The label of the completion. - * @param kind The {@link CompletionItemKind kind} of the completion. - */ - constructor( - label: string | CompletionItemLabel, - kind?: CompletionItemKind, - ); - } - - /** - * Represents a collection of {@link CompletionItem completion items} to be presented - * in the editor. - */ - export class CompletionList { - /** - * This list is not complete. Further typing should result in recomputing - * this list. - */ - isIncomplete?: boolean; - - /** - * The completion items. - */ - items: T[]; - - /** - * Creates a new completion list. - * - * @param items The completion items. - * @param isIncomplete The list is not complete. - */ - constructor(items?: T[], isIncomplete?: boolean); - } - - /** - * How a {@link CompletionItemProvider completion provider} was triggered - */ - export enum CompletionTriggerKind { - /** - * Completion was triggered normally. - */ - Invoke = 0, - /** - * Completion was triggered by a trigger character. - */ - TriggerCharacter = 1, - /** - * Completion was re-triggered as current completion list is incomplete - */ - TriggerForIncompleteCompletions = 2, - } - - /** - * Contains additional information about the context in which - * {@link CompletionItemProvider.provideCompletionItems completion provider} is triggered. - */ - export interface CompletionContext { - /** - * How the completion was triggered. - */ - readonly triggerKind: CompletionTriggerKind; - - /** - * Character that triggered the completion item provider. - * - * `undefined` if the provider was not triggered by a character. - * - * The trigger character is already in the document when the completion provider is triggered. - */ - readonly triggerCharacter: string | undefined; - } - - /** - * The completion item provider interface defines the contract between extensions and - * [IntelliSense](https://code.visualstudio.com/docs/editor/intellisense). - * - * Providers can delay the computation of the {@linkcode CompletionItem.detail detail} - * and {@linkcode CompletionItem.documentation documentation} properties by implementing the - * {@linkcode CompletionItemProvider.resolveCompletionItem resolveCompletionItem}-function. However, properties that - * are needed for the initial sorting and filtering, like `sortText`, `filterText`, `insertText`, and `range`, must - * not be changed during resolve. - * - * Providers are asked for completions either explicitly by a user gesture or -depending on the configuration- - * implicitly when typing words or trigger characters. - */ - export interface CompletionItemProvider< - T extends CompletionItem = CompletionItem, - > { - /** - * Provide completion items for the given position and document. - * - * @param document The document in which the command was invoked. - * @param position The position at which the command was invoked. - * @param token A cancellation token. - * @param context How the completion was triggered. - * - * @returns An array of completions, a {@link CompletionList completion list}, or a thenable that resolves to either. - * The lack of a result can be signaled by returning `undefined`, `null`, or an empty array. - */ - provideCompletionItems( - document: TextDocument, - position: Position, - token: CancellationToken, - context: CompletionContext, - ): ProviderResult>; - - /** - * Given a completion item fill in more data, like {@link CompletionItem.documentation doc-comment} - * or {@link CompletionItem.detail details}. - * - * The editor will only resolve a completion item once. - * - * *Note* that this function is called when completion items are already showing in the UI or when an item has been - * selected for insertion. Because of that, no property that changes the presentation (label, sorting, filtering etc) - * or the (primary) insert behaviour ({@link CompletionItem.insertText insertText}) can be changed. - * - * This function may fill in {@link CompletionItem.additionalTextEdits additionalTextEdits}. However, that means an item might be - * inserted *before* resolving is done and in that case the editor will do a best effort to still apply those additional - * text edits. - * - * @param item A completion item currently active in the UI. - * @param token A cancellation token. - * @returns The resolved completion item or a thenable that resolves to of such. It is OK to return the given - * `item`. When no result is returned, the given `item` will be used. - */ - resolveCompletionItem?( - item: T, - token: CancellationToken, - ): ProviderResult; - } - - /** - * The inline completion item provider interface defines the contract between extensions and - * the inline completion feature. - * - * Providers are asked for completions either explicitly by a user gesture or implicitly when typing. - */ - export interface InlineCompletionItemProvider { - /** - * Provides inline completion items for the given position and document. - * If inline completions are enabled, this method will be called whenever the user stopped typing. - * It will also be called when the user explicitly triggers inline completions or explicitly asks for the next or previous inline completion. - * In that case, all available inline completions should be returned. - * `context.triggerKind` can be used to distinguish between these scenarios. - * - * @param document The document inline completions are requested for. - * @param position The position inline completions are requested for. - * @param context A context object with additional information. - * @param token A cancellation token. - * @returns An array of completion items or a thenable that resolves to an array of completion items. - */ - provideInlineCompletionItems( - document: TextDocument, - position: Position, - context: InlineCompletionContext, - token: CancellationToken, - ): ProviderResult; - } - - /** - * Represents a collection of {@link InlineCompletionItem inline completion items} to be presented - * in the editor. - */ - export class InlineCompletionList { - /** - * The inline completion items. - */ - items: InlineCompletionItem[]; - - /** - * Creates a new list of inline completion items. - */ - constructor(items: InlineCompletionItem[]); - } - - /** - * Provides information about the context in which an inline completion was requested. - */ - export interface InlineCompletionContext { - /** - * Describes how the inline completion was triggered. - */ - readonly triggerKind: InlineCompletionTriggerKind; - - /** - * Provides information about the currently selected item in the autocomplete widget if it is visible. - * - * If set, provided inline completions must extend the text of the selected item - * and use the same range, otherwise they are not shown as preview. - * As an example, if the document text is `console.` and the selected item is `.log` replacing the `.` in the document, - * the inline completion must also replace `.` and start with `.log`, for example `.log()`. - * - * Inline completion providers are requested again whenever the selected item changes. - */ - readonly selectedCompletionInfo: SelectedCompletionInfo | undefined; - } - - /** - * Describes the currently selected completion item. - */ - export interface SelectedCompletionInfo { - /** - * The range that will be replaced if this completion item is accepted. - */ - readonly range: Range; - - /** - * The text the range will be replaced with if this completion is accepted. - */ - readonly text: string; - } - - /** - * Describes how an {@link InlineCompletionItemProvider inline completion provider} was triggered. - */ - export enum InlineCompletionTriggerKind { - /** - * Completion was triggered explicitly by a user gesture. - * Return multiple completion items to enable cycling through them. - */ - Invoke = 0, - - /** - * Completion was triggered automatically while editing. - * It is sufficient to return a single completion item in this case. - */ - Automatic = 1, - } - - /** - * An inline completion item represents a text snippet that is proposed inline to complete text that is being typed. - * - * @see {@link InlineCompletionItemProvider.provideInlineCompletionItems} - */ - export class InlineCompletionItem { - /** - * The text to replace the range with. Must be set. - * Is used both for the preview and the accept operation. - */ - insertText: string | SnippetString; - - /** - * A text that is used to decide if this inline completion should be shown. When `falsy` - * the {@link InlineCompletionItem.insertText} is used. - * - * An inline completion is shown if the text to replace is a prefix of the filter text. - */ - filterText?: string; - - /** - * The range to replace. - * Must begin and end on the same line. - * - * Prefer replacements over insertions to provide a better experience when the user deletes typed text. - */ - range?: Range; - - /** - * An optional {@link Command} that is executed *after* inserting this completion. - */ - command?: Command; - - /** - * Creates a new inline completion item. - * - * @param insertText The text to replace the range with. - * @param range The range to replace. If not set, the word at the requested position will be used. - * @param command An optional {@link Command} that is executed *after* inserting this completion. - */ - constructor( - insertText: string | SnippetString, - range?: Range, - command?: Command, - ); - } - - /** - * A document link is a range in a text document that links to an internal or external resource, like another - * text document or a web site. - */ - export class DocumentLink { - /** - * The range this link applies to. - */ - range: Range; - - /** - * The uri this link points to. - */ - target?: Uri; - - /** - * The tooltip text when you hover over this link. - * - * If a tooltip is provided, is will be displayed in a string that includes instructions on how to - * trigger the link, such as `{0} (ctrl + click)`. The specific instructions vary depending on OS, - * user settings, and localization. - */ - tooltip?: string; - - /** - * Creates a new document link. - * - * @param range The range the document link applies to. Must not be empty. - * @param target The uri the document link points to. - */ - constructor(range: Range, target?: Uri); - } - - /** - * The document link provider defines the contract between extensions and feature of showing - * links in the editor. - */ - export interface DocumentLinkProvider< - T extends DocumentLink = DocumentLink, - > { - /** - * Provide links for the given document. Note that the editor ships with a default provider that detects - * `http(s)` and `file` links. - * - * @param document The document in which the command was invoked. - * @param token A cancellation token. - * @returns An array of {@link DocumentLink document links} or a thenable that resolves to such. The lack of a result - * can be signaled by returning `undefined`, `null`, or an empty array. - */ - provideDocumentLinks( - document: TextDocument, - token: CancellationToken, - ): ProviderResult; - - /** - * Given a link fill in its {@link DocumentLink.target target}. This method is called when an incomplete - * link is selected in the UI. Providers can implement this method and return incomplete links - * (without target) from the {@linkcode DocumentLinkProvider.provideDocumentLinks provideDocumentLinks} method which - * often helps to improve performance. - * - * @param link The link that is to be resolved. - * @param token A cancellation token. - */ - resolveDocumentLink?( - link: T, - token: CancellationToken, - ): ProviderResult; - } - - /** - * Represents a color in RGBA space. - */ - export class Color { - /** - * The red component of this color in the range `[0-1]`. - */ - readonly red: number; - - /** - * The green component of this color in the range `[0-1]`. - */ - readonly green: number; - - /** - * The blue component of this color in the range `[0-1]`. - */ - readonly blue: number; - - /** - * The alpha component of this color in the range `[0-1]`. - */ - readonly alpha: number; - - /** - * Creates a new color instance. - * - * @param red The red component. - * @param green The green component. - * @param blue The blue component. - * @param alpha The alpha component. - */ - constructor(red: number, green: number, blue: number, alpha: number); - } - - /** - * Represents a color range from a document. - */ - export class ColorInformation { - /** - * The range in the document where this color appears. - */ - range: Range; - - /** - * The actual color value for this color range. - */ - color: Color; - - /** - * Creates a new color range. - * - * @param range The range the color appears in. Must not be empty. - * @param color The value of the color. - */ - constructor(range: Range, color: Color); - } - - /** - * A color presentation object describes how a {@linkcode Color} should be represented as text and what - * edits are required to refer to it from source code. - * - * For some languages one color can have multiple presentations, e.g. css can represent the color red with - * the constant `Red`, the hex-value `#ff0000`, or in rgba and hsla forms. In csharp other representations - * apply, e.g. `System.Drawing.Color.Red`. - */ - export class ColorPresentation { - /** - * The label of this color presentation. It will be shown on the color - * picker header. By default this is also the text that is inserted when selecting - * this color presentation. - */ - label: string; - - /** - * An {@link TextEdit edit} which is applied to a document when selecting - * this presentation for the color. When `falsy` the {@link ColorPresentation.label label} - * is used. - */ - textEdit?: TextEdit; - - /** - * An optional array of additional {@link TextEdit text edits} that are applied when - * selecting this color presentation. Edits must not overlap with the main {@link ColorPresentation.textEdit edit} nor with themselves. - */ - additionalTextEdits?: TextEdit[]; - - /** - * Creates a new color presentation. - * - * @param label The label of this color presentation. - */ - constructor(label: string); - } - - /** - * The document color provider defines the contract between extensions and feature of - * picking and modifying colors in the editor. - */ - export interface DocumentColorProvider { - /** - * Provide colors for the given document. - * - * @param document The document in which the command was invoked. - * @param token A cancellation token. - * @returns An array of {@link ColorInformation color information} or a thenable that resolves to such. The lack of a result - * can be signaled by returning `undefined`, `null`, or an empty array. - */ - provideDocumentColors( - document: TextDocument, - token: CancellationToken, - ): ProviderResult; - - /** - * Provide {@link ColorPresentation representations} for a color. - * - * @param color The color to show and insert. - * @param context A context object with additional information - * @param token A cancellation token. - * @returns An array of color presentations or a thenable that resolves to such. The lack of a result - * can be signaled by returning `undefined`, `null`, or an empty array. - */ - provideColorPresentations( - color: Color, - context: { - /** - * The text document that contains the color - */ - readonly document: TextDocument; - /** - * The range in the document where the color is located. - */ - readonly range: Range; - }, - token: CancellationToken, - ): ProviderResult; - } - - /** - * Inlay hint kinds. - * - * The kind of an inline hint defines its appearance, e.g the corresponding foreground and background colors are being - * used. - */ - export enum InlayHintKind { - /** - * An inlay hint that for a type annotation. - */ - Type = 1, - /** - * An inlay hint that is for a parameter. - */ - Parameter = 2, - } - - /** - * An inlay hint label part allows for interactive and composite labels of inlay hints. - */ - export class InlayHintLabelPart { - /** - * The value of this label part. - */ - value: string; - - /** - * The tooltip text when you hover over this label part. - * - * *Note* that this property can be set late during - * {@link InlayHintsProvider.resolveInlayHint resolving} of inlay hints. - */ - tooltip?: string | MarkdownString | undefined; - - /** - * An optional {@link Location source code location} that represents this label - * part. - * - * The editor will use this location for the hover and for code navigation features: This - * part will become a clickable link that resolves to the definition of the symbol at the - * given location (not necessarily the location itself), it shows the hover that shows at - * the given location, and it shows a context menu with further code navigation commands. - * - * *Note* that this property can be set late during - * {@link InlayHintsProvider.resolveInlayHint resolving} of inlay hints. - */ - location?: Location | undefined; - - /** - * An optional command for this label part. - * - * The editor renders parts with commands as clickable links. The command is added to the context menu - * when a label part defines {@link InlayHintLabelPart.location location} and {@link InlayHintLabelPart.command command} . - * - * *Note* that this property can be set late during - * {@link InlayHintsProvider.resolveInlayHint resolving} of inlay hints. - */ - command?: Command | undefined; - - /** - * Creates a new inlay hint label part. - * - * @param value The value of the part. - */ - constructor(value: string); - } - - /** - * Inlay hint information. - */ - export class InlayHint { - /** - * The position of this hint. - */ - position: Position; - - /** - * The label of this hint. A human readable string or an array of {@link InlayHintLabelPart label parts}. - * - * *Note* that neither the string nor the label part can be empty. - */ - label: string | InlayHintLabelPart[]; - - /** - * The tooltip text when you hover over this item. - * - * *Note* that this property can be set late during - * {@link InlayHintsProvider.resolveInlayHint resolving} of inlay hints. - */ - tooltip?: string | MarkdownString | undefined; - - /** - * The kind of this hint. The inlay hint kind defines the appearance of this inlay hint. - */ - kind?: InlayHintKind; - - /** - * Optional {@link TextEdit text edits} that are performed when accepting this inlay hint. The default - * gesture for accepting an inlay hint is the double click. - * - * *Note* that edits are expected to change the document so that the inlay hint (or its nearest variant) is - * now part of the document and the inlay hint itself is now obsolete. - * - * *Note* that this property can be set late during - * {@link InlayHintsProvider.resolveInlayHint resolving} of inlay hints. - */ - textEdits?: TextEdit[]; - - /** - * Render padding before the hint. Padding will use the editor's background color, - * not the background color of the hint itself. That means padding can be used to visually - * align/separate an inlay hint. - */ - paddingLeft?: boolean; - - /** - * Render padding after the hint. Padding will use the editor's background color, - * not the background color of the hint itself. That means padding can be used to visually - * align/separate an inlay hint. - */ - paddingRight?: boolean; - - /** - * Creates a new inlay hint. - * - * @param position The position of the hint. - * @param label The label of the hint. - * @param kind The {@link InlayHintKind kind} of the hint. - */ - constructor( - position: Position, - label: string | InlayHintLabelPart[], - kind?: InlayHintKind, - ); - } - - /** - * The inlay hints provider interface defines the contract between extensions and - * the inlay hints feature. - */ - export interface InlayHintsProvider { - /** - * An optional event to signal that inlay hints from this provider have changed. - */ - onDidChangeInlayHints?: Event; - - /** - * Provide inlay hints for the given range and document. - * - * *Note* that inlay hints that are not {@link Range.contains contained} by the given range are ignored. - * - * @param document The document in which the command was invoked. - * @param range The range for which inlay hints should be computed. - * @param token A cancellation token. - * @returns An array of inlay hints or a thenable that resolves to such. - */ - provideInlayHints( - document: TextDocument, - range: Range, - token: CancellationToken, - ): ProviderResult; - - /** - * Given an inlay hint fill in {@link InlayHint.tooltip tooltip}, {@link InlayHint.textEdits text edits}, - * or complete label {@link InlayHintLabelPart parts}. - * - * *Note* that the editor will resolve an inlay hint at most once. - * - * @param hint An inlay hint. - * @param token A cancellation token. - * @returns The resolved inlay hint or a thenable that resolves to such. It is OK to return the given `item`. When no result is returned, the given `item` will be used. - */ - resolveInlayHint?(hint: T, token: CancellationToken): ProviderResult; - } - - /** - * A line based folding range. To be valid, start and end line must be bigger than zero and smaller than the number of lines in the document. - * Invalid ranges will be ignored. - */ - export class FoldingRange { - /** - * The zero-based start line of the range to fold. The folded area starts after the line's last character. - * To be valid, the end must be zero or larger and smaller than the number of lines in the document. - */ - start: number; - - /** - * The zero-based end line of the range to fold. The folded area ends with the line's last character. - * To be valid, the end must be zero or larger and smaller than the number of lines in the document. - */ - end: number; - - /** - * Describes the {@link FoldingRangeKind Kind} of the folding range such as {@link FoldingRangeKind.Comment Comment} or - * {@link FoldingRangeKind.Region Region}. The kind is used to categorize folding ranges and used by commands - * like 'Fold all comments'. See - * {@link FoldingRangeKind} for an enumeration of all kinds. - * If not set, the range is originated from a syntax element. - */ - kind?: FoldingRangeKind; - - /** - * Creates a new folding range. - * - * @param start The start line of the folded range. - * @param end The end line of the folded range. - * @param kind The kind of the folding range. - */ - constructor(start: number, end: number, kind?: FoldingRangeKind); - } - - /** - * An enumeration of specific folding range kinds. The kind is an optional field of a {@link FoldingRange} - * and is used to distinguish specific folding ranges such as ranges originated from comments. The kind is used by commands like - * `Fold all comments` or `Fold all regions`. - * If the kind is not set on the range, the range originated from a syntax element other than comments, imports or region markers. - */ - export enum FoldingRangeKind { - /** - * Kind for folding range representing a comment. - */ - Comment = 1, - /** - * Kind for folding range representing a import. - */ - Imports = 2, - /** - * Kind for folding range representing regions originating from folding markers like `#region` and `#endregion`. - */ - Region = 3, - } - - /** - * Folding context (for future use) - */ - export interface FoldingContext {} - - /** - * The folding range provider interface defines the contract between extensions and - * [Folding](https://code.visualstudio.com/docs/editor/codebasics#_folding) in the editor. - */ - export interface FoldingRangeProvider { - /** - * An optional event to signal that the folding ranges from this provider have changed. - */ - onDidChangeFoldingRanges?: Event; - - /** - * Returns a list of folding ranges or null and undefined if the provider - * does not want to participate or was cancelled. - * @param document The document in which the command was invoked. - * @param context Additional context information (for future use) - * @param token A cancellation token. - */ - provideFoldingRanges( - document: TextDocument, - context: FoldingContext, - token: CancellationToken, - ): ProviderResult; - } - - /** - * A selection range represents a part of a selection hierarchy. A selection range - * may have a parent selection range that contains it. - */ - export class SelectionRange { - /** - * The {@link Range} of this selection range. - */ - range: Range; - - /** - * The parent selection range containing this range. - */ - parent?: SelectionRange; - - /** - * Creates a new selection range. - * - * @param range The range of the selection range. - * @param parent The parent of the selection range. - */ - constructor(range: Range, parent?: SelectionRange); - } - - /** - * The selection range provider interface defines the contract between extensions and the "Expand and Shrink Selection" feature. - */ - export interface SelectionRangeProvider { - /** - * Provide selection ranges for the given positions. - * - * Selection ranges should be computed individually and independent for each position. The editor will merge - * and deduplicate ranges but providers must return hierarchies of selection ranges so that a range - * is {@link Range.contains contained} by its parent. - * - * @param document The document in which the command was invoked. - * @param positions The positions at which the command was invoked. - * @param token A cancellation token. - * @returns Selection ranges or a thenable that resolves to such. The lack of a result can be - * signaled by returning `undefined` or `null`. - */ - provideSelectionRanges( - document: TextDocument, - positions: readonly Position[], - token: CancellationToken, - ): ProviderResult; - } - - /** - * Represents programming constructs like functions or constructors in the context - * of call hierarchy. - */ - export class CallHierarchyItem { - /** - * The name of this item. - */ - name: string; - - /** - * The kind of this item. - */ - kind: SymbolKind; - - /** - * Tags for this item. - */ - tags?: readonly SymbolTag[]; - - /** - * More detail for this item, e.g. the signature of a function. - */ - detail?: string; - - /** - * The resource identifier of this item. - */ - uri: Uri; - - /** - * The range enclosing this symbol not including leading/trailing whitespace but everything else, e.g. comments and code. - */ - range: Range; - - /** - * The range that should be selected and revealed when this symbol is being picked, e.g. the name of a function. - * Must be contained by the {@linkcode CallHierarchyItem.range range}. - */ - selectionRange: Range; - - /** - * Creates a new call hierarchy item. - */ - constructor( - kind: SymbolKind, - name: string, - detail: string, - uri: Uri, - range: Range, - selectionRange: Range, - ); - } - - /** - * Represents an incoming call, e.g. a caller of a method or constructor. - */ - export class CallHierarchyIncomingCall { - /** - * The item that makes the call. - */ - from: CallHierarchyItem; - - /** - * The range at which at which the calls appears. This is relative to the caller - * denoted by {@linkcode CallHierarchyIncomingCall.from this.from}. - */ - fromRanges: Range[]; - - /** - * Create a new call object. - * - * @param item The item making the call. - * @param fromRanges The ranges at which the calls appear. - */ - constructor(item: CallHierarchyItem, fromRanges: Range[]); - } - - /** - * Represents an outgoing call, e.g. calling a getter from a method or a method from a constructor etc. - */ - export class CallHierarchyOutgoingCall { - /** - * The item that is called. - */ - to: CallHierarchyItem; - - /** - * The range at which this item is called. This is the range relative to the caller, e.g the item - * passed to {@linkcode CallHierarchyProvider.provideCallHierarchyOutgoingCalls provideCallHierarchyOutgoingCalls} - * and not {@linkcode CallHierarchyOutgoingCall.to this.to}. - */ - fromRanges: Range[]; - - /** - * Create a new call object. - * - * @param item The item being called - * @param fromRanges The ranges at which the calls appear. - */ - constructor(item: CallHierarchyItem, fromRanges: Range[]); - } - - /** - * The call hierarchy provider interface describes the contract between extensions - * and the call hierarchy feature which allows to browse calls and caller of function, - * methods, constructor etc. - */ - export interface CallHierarchyProvider { - /** - * Bootstraps call hierarchy by returning the item that is denoted by the given document - * and position. This item will be used as entry into the call graph. Providers should - * return `undefined` or `null` when there is no item at the given location. - * - * @param document The document in which the command was invoked. - * @param position The position at which the command was invoked. - * @param token A cancellation token. - * @returns One or multiple call hierarchy items or a thenable that resolves to such. The lack of a result can be - * signaled by returning `undefined`, `null`, or an empty array. - */ - prepareCallHierarchy( - document: TextDocument, - position: Position, - token: CancellationToken, - ): ProviderResult; - - /** - * Provide all incoming calls for an item, e.g all callers for a method. In graph terms this describes directed - * and annotated edges inside the call graph, e.g the given item is the starting node and the result is the nodes - * that can be reached. - * - * @param item The hierarchy item for which incoming calls should be computed. - * @param token A cancellation token. - * @returns A set of incoming calls or a thenable that resolves to such. The lack of a result can be - * signaled by returning `undefined` or `null`. - */ - provideCallHierarchyIncomingCalls( - item: CallHierarchyItem, - token: CancellationToken, - ): ProviderResult; - - /** - * Provide all outgoing calls for an item, e.g call calls to functions, methods, or constructors from the given item. In - * graph terms this describes directed and annotated edges inside the call graph, e.g the given item is the starting - * node and the result is the nodes that can be reached. - * - * @param item The hierarchy item for which outgoing calls should be computed. - * @param token A cancellation token. - * @returns A set of outgoing calls or a thenable that resolves to such. The lack of a result can be - * signaled by returning `undefined` or `null`. - */ - provideCallHierarchyOutgoingCalls( - item: CallHierarchyItem, - token: CancellationToken, - ): ProviderResult; - } - - /** - * Represents an item of a type hierarchy, like a class or an interface. - */ - export class TypeHierarchyItem { - /** - * The name of this item. - */ - name: string; - - /** - * The kind of this item. - */ - kind: SymbolKind; - - /** - * Tags for this item. - */ - tags?: ReadonlyArray; - - /** - * More detail for this item, e.g. the signature of a function. - */ - detail?: string; - - /** - * The resource identifier of this item. - */ - uri: Uri; - - /** - * The range enclosing this symbol not including leading/trailing whitespace - * but everything else, e.g. comments and code. - */ - range: Range; - - /** - * The range that should be selected and revealed when this symbol is being - * picked, e.g. the name of a class. Must be contained by the {@link TypeHierarchyItem.range range}-property. - */ - selectionRange: Range; - - /** - * Creates a new type hierarchy item. - * - * @param kind The kind of the item. - * @param name The name of the item. - * @param detail The details of the item. - * @param uri The Uri of the item. - * @param range The whole range of the item. - * @param selectionRange The selection range of the item. - */ - constructor( - kind: SymbolKind, - name: string, - detail: string, - uri: Uri, - range: Range, - selectionRange: Range, - ); - } - - /** - * The type hierarchy provider interface describes the contract between extensions - * and the type hierarchy feature. - */ - export interface TypeHierarchyProvider { - /** - * Bootstraps type hierarchy by returning the item that is denoted by the given document - * and position. This item will be used as entry into the type graph. Providers should - * return `undefined` or `null` when there is no item at the given location. - * - * @param document The document in which the command was invoked. - * @param position The position at which the command was invoked. - * @param token A cancellation token. - * @returns One or multiple type hierarchy items or a thenable that resolves to such. The lack of a result can be - * signaled by returning `undefined`, `null`, or an empty array. - */ - prepareTypeHierarchy( - document: TextDocument, - position: Position, - token: CancellationToken, - ): ProviderResult; - - /** - * Provide all supertypes for an item, e.g all types from which a type is derived/inherited. In graph terms this describes directed - * and annotated edges inside the type graph, e.g the given item is the starting node and the result is the nodes - * that can be reached. - * - * @param item The hierarchy item for which super types should be computed. - * @param token A cancellation token. - * @returns A set of direct supertypes or a thenable that resolves to such. The lack of a result can be - * signaled by returning `undefined` or `null`. - */ - provideTypeHierarchySupertypes( - item: TypeHierarchyItem, - token: CancellationToken, - ): ProviderResult; - - /** - * Provide all subtypes for an item, e.g all types which are derived/inherited from the given item. In - * graph terms this describes directed and annotated edges inside the type graph, e.g the given item is the starting - * node and the result is the nodes that can be reached. - * - * @param item The hierarchy item for which subtypes should be computed. - * @param token A cancellation token. - * @returns A set of direct subtypes or a thenable that resolves to such. The lack of a result can be - * signaled by returning `undefined` or `null`. - */ - provideTypeHierarchySubtypes( - item: TypeHierarchyItem, - token: CancellationToken, - ): ProviderResult; - } - - /** - * Represents a list of ranges that can be edited together along with a word pattern to describe valid range contents. - */ - export class LinkedEditingRanges { - /** - * Create a new linked editing ranges object. - * - * @param ranges A list of ranges that can be edited together - * @param wordPattern An optional word pattern that describes valid contents for the given ranges - */ - constructor(ranges: Range[], wordPattern?: RegExp); - - /** - * A list of ranges that can be edited together. The ranges must have - * identical length and text content. The ranges cannot overlap. - */ - readonly ranges: Range[]; - - /** - * An optional word pattern that describes valid contents for the given ranges. - * If no pattern is provided, the language configuration's word pattern will be used. - */ - readonly wordPattern: RegExp | undefined; - } - - /** - * The linked editing range provider interface defines the contract between extensions and - * the linked editing feature. - */ - export interface LinkedEditingRangeProvider { - /** - * For a given position in a document, returns the range of the symbol at the position and all ranges - * that have the same content. A change to one of the ranges can be applied to all other ranges if the new content - * is valid. An optional word pattern can be returned with the result to describe valid contents. - * If no result-specific word pattern is provided, the word pattern from the language configuration is used. - * - * @param document The document in which the provider was invoked. - * @param position The position at which the provider was invoked. - * @param token A cancellation token. - * @returns A list of ranges that can be edited together - */ - provideLinkedEditingRanges( - document: TextDocument, - position: Position, - token: CancellationToken, - ): ProviderResult; - } - - /** - * An edit operation applied {@link DocumentDropEditProvider on drop}. - */ - export class DocumentDropEdit { - /** - * The text or snippet to insert at the drop location. - */ - insertText: string | SnippetString; - - /** - * An optional additional edit to apply on drop. - */ - additionalEdit?: WorkspaceEdit; - - /** - * @param insertText The text or snippet to insert at the drop location. - */ - constructor(insertText: string | SnippetString); - } - - /** - * Provider which handles dropping of resources into a text editor. - * - * This allows users to drag and drop resources (including resources from external apps) into the editor. While dragging - * and dropping files, users can hold down `shift` to drop the file into the editor instead of opening it. - * Requires `editor.dropIntoEditor.enabled` to be on. - */ - export interface DocumentDropEditProvider { - /** - * Provide edits which inserts the content being dragged and dropped into the document. - * - * @param document The document in which the drop occurred. - * @param position The position in the document where the drop occurred. - * @param dataTransfer A {@link DataTransfer} object that holds data about what is being dragged and dropped. - * @param token A cancellation token. - * - * @returns A {@link DocumentDropEdit} or a thenable that resolves to such. The lack of a result can be - * signaled by returning `undefined` or `null`. - */ - provideDocumentDropEdits( - document: TextDocument, - position: Position, - dataTransfer: DataTransfer, - token: CancellationToken, - ): ProviderResult; - } - - /** - * A tuple of two characters, like a pair of - * opening and closing brackets. - */ - export type CharacterPair = [string, string]; - - /** - * Describes how comments for a language work. - */ - export interface CommentRule { - /** - * The line comment token, like `// this is a comment` - */ - lineComment?: string; - - /** - * The block comment character pair, like `/* block comment */` - */ - blockComment?: CharacterPair; - } - - /** - * Describes indentation rules for a language. - */ - export interface IndentationRule { - /** - * If a line matches this pattern, then all the lines after it should be unindented once (until another rule matches). - */ - decreaseIndentPattern: RegExp; - /** - * If a line matches this pattern, then all the lines after it should be indented once (until another rule matches). - */ - increaseIndentPattern: RegExp; - /** - * If a line matches this pattern, then **only the next line** after it should be indented once. - */ - indentNextLinePattern?: RegExp; - /** - * If a line matches this pattern, then its indentation should not be changed and it should not be evaluated against the other rules. - */ - unIndentedLinePattern?: RegExp; - } - - /** - * Describes what to do with the indentation when pressing Enter. - */ - export enum IndentAction { - /** - * Insert new line and copy the previous line's indentation. - */ - None = 0, - /** - * Insert new line and indent once (relative to the previous line's indentation). - */ - Indent = 1, - /** - * Insert two new lines: - * - the first one indented which will hold the cursor - * - the second one at the same indentation level - */ - IndentOutdent = 2, - /** - * Insert new line and outdent once (relative to the previous line's indentation). - */ - Outdent = 3, - } - - /** - * Describes what to do when pressing Enter. - */ - export interface EnterAction { - /** - * Describe what to do with the indentation. - */ - indentAction: IndentAction; - /** - * Describes text to be appended after the new line and after the indentation. - */ - appendText?: string; - /** - * Describes the number of characters to remove from the new line's indentation. - */ - removeText?: number; - } - - /** - * Describes a rule to be evaluated when pressing Enter. - */ - export interface OnEnterRule { - /** - * This rule will only execute if the text before the cursor matches this regular expression. - */ - beforeText: RegExp; - /** - * This rule will only execute if the text after the cursor matches this regular expression. - */ - afterText?: RegExp; - /** - * This rule will only execute if the text above the current line matches this regular expression. - */ - previousLineText?: RegExp; - /** - * The action to execute. - */ - action: EnterAction; - } - - /** - * Enumeration of commonly encountered syntax token types. - */ - export enum SyntaxTokenType { - /** - * Everything except tokens that are part of comments, string literals and regular expressions. - */ - Other = 0, - /** - * A comment. - */ - Comment = 1, - /** - * A string literal. - */ - String = 2, - /** - * A regular expression. - */ - RegEx = 3, - } - - /** - * Describes pairs of strings where the close string will be automatically inserted when typing the opening string. - */ - export interface AutoClosingPair { - /** - * The string that will trigger the automatic insertion of the closing string. - */ - open: string; - /** - * The closing string that will be automatically inserted when typing the opening string. - */ - close: string; - /** - * A set of tokens where the pair should not be auto closed. - */ - notIn?: SyntaxTokenType[]; - } - - /** - * The language configuration interfaces defines the contract between extensions - * and various editor features, like automatic bracket insertion, automatic indentation etc. - */ - export interface LanguageConfiguration { - /** - * The language's comment settings. - */ - comments?: CommentRule; - /** - * The language's brackets. - * This configuration implicitly affects pressing Enter around these brackets. - */ - brackets?: CharacterPair[]; - /** - * The language's word definition. - * If the language supports Unicode identifiers (e.g. JavaScript), it is preferable - * to provide a word definition that uses exclusion of known separators. - * e.g.: A regex that matches anything except known separators (and dot is allowed to occur in a floating point number): - * ``` - * /(-?\d*\.\d\w*)|([^\`\~\!\@\#\%\^\&\*\(\)\-\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g - * ``` - */ - wordPattern?: RegExp; - /** - * The language's indentation settings. - */ - indentationRules?: IndentationRule; - /** - * The language's rules to be evaluated when pressing Enter. - */ - onEnterRules?: OnEnterRule[]; - /** - * The language's auto closing pairs. - */ - autoClosingPairs?: AutoClosingPair[]; - - /** - * **Deprecated** Do not use. - * - * @deprecated Will be replaced by a better API soon. - */ - __electricCharacterSupport?: { - /** - * This property is deprecated and will be **ignored** from - * the editor. - * @deprecated - */ - brackets?: any; - /** - * This property is deprecated and not fully supported anymore by - * the editor (scope and lineStart are ignored). - * Use the autoClosingPairs property in the language configuration file instead. - * @deprecated - */ - docComment?: { - /** - * @deprecated - */ - scope: string; - /** - * @deprecated - */ - open: string; - /** - * @deprecated - */ - lineStart: string; - /** - * @deprecated - */ - close?: string; - }; - }; - - /** - * **Deprecated** Do not use. - * - * @deprecated * Use the autoClosingPairs property in the language configuration file instead. - */ - __characterPairSupport?: { - /** - * @deprecated - */ - autoClosingPairs: { - /** - * @deprecated - */ - open: string; - /** - * @deprecated - */ - close: string; - /** - * @deprecated - */ - notIn?: string[]; - }[]; - }; - } - - /** - * The configuration target - */ - export enum ConfigurationTarget { - /** - * Global configuration - */ - Global = 1, - - /** - * Workspace configuration - */ - Workspace = 2, - - /** - * Workspace folder configuration - */ - WorkspaceFolder = 3, - } - - /** - * Represents the configuration. It is a merged view of - * - * - *Default Settings* - * - *Global (User) Settings* - * - *Workspace settings* - * - *Workspace Folder settings* - From one of the {@link workspace.workspaceFolders Workspace Folders} under which requested resource belongs to. - * - *Language settings* - Settings defined under requested language. - * - * The *effective* value (returned by {@linkcode WorkspaceConfiguration.get get}) is computed by overriding or merging the values in the following order: - * - * 1. `defaultValue` (if defined in `package.json` otherwise derived from the value's type) - * 1. `globalValue` (if defined) - * 1. `workspaceValue` (if defined) - * 1. `workspaceFolderValue` (if defined) - * 1. `defaultLanguageValue` (if defined) - * 1. `globalLanguageValue` (if defined) - * 1. `workspaceLanguageValue` (if defined) - * 1. `workspaceFolderLanguageValue` (if defined) - * - * **Note:** Only `object` value types are merged and all other value types are overridden. - * - * Example 1: Overriding - * - * ```ts - * defaultValue = 'on'; - * globalValue = 'relative' - * workspaceFolderValue = 'off' - * value = 'off' - * ``` - * - * Example 2: Language Values - * - * ```ts - * defaultValue = 'on'; - * globalValue = 'relative' - * workspaceFolderValue = 'off' - * globalLanguageValue = 'on' - * value = 'on' - * ``` - * - * Example 3: Object Values - * - * ```ts - * defaultValue = { "a": 1, "b": 2 }; - * globalValue = { "b": 3, "c": 4 }; - * value = { "a": 1, "b": 3, "c": 4 }; - * ``` - * - * *Note:* Workspace and Workspace Folder configurations contains `launch` and `tasks` settings. Their basename will be - * part of the section identifier. The following snippets shows how to retrieve all configurations - * from `launch.json`: - * - * ```ts - * // launch.json configuration - * const config = workspace.getConfiguration('launch', vscode.workspace.workspaceFolders[0].uri); - * - * // retrieve values - * const values = config.get('configurations'); - * ``` - * - * Refer to [Settings](https://code.visualstudio.com/docs/getstarted/settings) for more information. - */ - export interface WorkspaceConfiguration { - /** - * Return a value from this configuration. - * - * @param section Configuration name, supports _dotted_ names. - * @returns The value `section` denotes or `undefined`. - */ - get(section: string): T | undefined; - - /** - * Return a value from this configuration. - * - * @param section Configuration name, supports _dotted_ names. - * @param defaultValue A value should be returned when no value could be found, is `undefined`. - * @returns The value `section` denotes or the default. - */ - get(section: string, defaultValue: T): T; - - /** - * Check if this configuration has a certain value. - * - * @param section Configuration name, supports _dotted_ names. - * @returns `true` if the section doesn't resolve to `undefined`. - */ - has(section: string): boolean; - - /** - * Retrieve all information about a configuration setting. A configuration value - * often consists of a *default* value, a global or installation-wide value, - * a workspace-specific value, folder-specific value - * and language-specific values (if {@link WorkspaceConfiguration} is scoped to a language). - * - * Also provides all language ids under which the given configuration setting is defined. - * - * *Note:* The configuration name must denote a leaf in the configuration tree - * (`editor.fontSize` vs `editor`) otherwise no result is returned. - * - * @param section Configuration name, supports _dotted_ names. - * @returns Information about a configuration setting or `undefined`. - */ - inspect(section: string): - | { - /** - * The fully qualified key of the configuration value - */ - key: string; - - /** - * The default value which is used when no other value is defined - */ - defaultValue?: T; - - /** - * The global or installation-wide value. - */ - globalValue?: T; - - /** - * The workspace-specific value. - */ - workspaceValue?: T; - - /** - * The workspace-folder-specific value. - */ - workspaceFolderValue?: T; - - /** - * Language specific default value when this configuration value is created for a {@link ConfigurationScope language scope}. - */ - defaultLanguageValue?: T; - - /** - * Language specific global value when this configuration value is created for a {@link ConfigurationScope language scope}. - */ - globalLanguageValue?: T; - - /** - * Language specific workspace value when this configuration value is created for a {@link ConfigurationScope language scope}. - */ - workspaceLanguageValue?: T; - - /** - * Language specific workspace-folder value when this configuration value is created for a {@link ConfigurationScope language scope}. - */ - workspaceFolderLanguageValue?: T; - - /** - * All language identifiers for which this configuration is defined. - */ - languageIds?: string[]; - } - | undefined; - - /** - * Update a configuration value. The updated configuration values are persisted. - * - * A value can be changed in - * - * - {@link ConfigurationTarget.Global Global settings}: Changes the value for all instances of the editor. - * - {@link ConfigurationTarget.Workspace Workspace settings}: Changes the value for current workspace, if available. - * - {@link ConfigurationTarget.WorkspaceFolder Workspace folder settings}: Changes the value for settings from one of the {@link workspace.workspaceFolders Workspace Folders} under which the requested resource belongs to. - * - Language settings: Changes the value for the requested languageId. - * - * *Note:* To remove a configuration value use `undefined`, like so: `config.update('somekey', undefined)` - * - * @param section Configuration name, supports _dotted_ names. - * @param value The new value. - * @param configurationTarget The {@link ConfigurationTarget configuration target} or a boolean value. - * - If `true` updates {@link ConfigurationTarget.Global Global settings}. - * - If `false` updates {@link ConfigurationTarget.Workspace Workspace settings}. - * - If `undefined` or `null` updates to {@link ConfigurationTarget.WorkspaceFolder Workspace folder settings} if configuration is resource specific, - * otherwise to {@link ConfigurationTarget.Workspace Workspace settings}. - * @param overrideInLanguage Whether to update the value in the scope of requested languageId or not. - * - If `true` updates the value under the requested languageId. - * - If `undefined` updates the value under the requested languageId only if the configuration is defined for the language. - * @throws error while updating - * - configuration which is not registered. - * - window configuration to workspace folder - * - configuration to workspace or workspace folder when no workspace is opened. - * - configuration to workspace folder when there is no workspace folder settings. - * - configuration to workspace folder when {@link WorkspaceConfiguration} is not scoped to a resource. - */ - update( - section: string, - value: any, - configurationTarget?: ConfigurationTarget | boolean | null, - overrideInLanguage?: boolean, - ): Thenable; - - /** - * Readable dictionary that backs this configuration. - */ - readonly [key: string]: any; - } - - /** - * Represents a location inside a resource, such as a line - * inside a text file. - */ - export class Location { - /** - * The resource identifier of this location. - */ - uri: Uri; - - /** - * The document range of this location. - */ - range: Range; - - /** - * Creates a new location object. - * - * @param uri The resource identifier. - * @param rangeOrPosition The range or position. Positions will be converted to an empty range. - */ - constructor(uri: Uri, rangeOrPosition: Range | Position); - } - - /** - * Represents the connection of two locations. Provides additional metadata over normal {@link Location locations}, - * including an origin range. - */ - export interface LocationLink { - /** - * Span of the origin of this link. - * - * Used as the underlined span for mouse definition hover. Defaults to the word range at - * the definition position. - */ - originSelectionRange?: Range; - - /** - * The target resource identifier of this link. - */ - targetUri: Uri; - - /** - * The full target range of this link. - */ - targetRange: Range; - - /** - * The span of this link. - */ - targetSelectionRange?: Range; - } - - /** - * The event that is fired when diagnostics change. - */ - export interface DiagnosticChangeEvent { - /** - * An array of resources for which diagnostics have changed. - */ - readonly uris: readonly Uri[]; - } - - /** - * Represents the severity of diagnostics. - */ - export enum DiagnosticSeverity { - /** - * Something not allowed by the rules of a language or other means. - */ - Error = 0, - - /** - * Something suspicious but allowed. - */ - Warning = 1, - - /** - * Something to inform about but not a problem. - */ - Information = 2, - - /** - * Something to hint to a better way of doing it, like proposing - * a refactoring. - */ - Hint = 3, - } - - /** - * Represents a related message and source code location for a diagnostic. This should be - * used to point to code locations that cause or related to a diagnostics, e.g. when duplicating - * a symbol in a scope. - */ - export class DiagnosticRelatedInformation { - /** - * The location of this related diagnostic information. - */ - location: Location; - - /** - * The message of this related diagnostic information. - */ - message: string; - - /** - * Creates a new related diagnostic information object. - * - * @param location The location. - * @param message The message. - */ - constructor(location: Location, message: string); - } - - /** - * Additional metadata about the type of a diagnostic. - */ - export enum DiagnosticTag { - /** - * Unused or unnecessary code. - * - * Diagnostics with this tag are rendered faded out. The amount of fading - * is controlled by the `"editorUnnecessaryCode.opacity"` theme color. For - * example, `"editorUnnecessaryCode.opacity": "#000000c0"` will render the - * code with 75% opacity. For high contrast themes, use the - * `"editorUnnecessaryCode.border"` theme color to underline unnecessary code - * instead of fading it out. - */ - Unnecessary = 1, - - /** - * Deprecated or obsolete code. - * - * Diagnostics with this tag are rendered with a strike through. - */ - Deprecated = 2, - } - - /** - * Represents a diagnostic, such as a compiler error or warning. Diagnostic objects - * are only valid in the scope of a file. - */ - export class Diagnostic { - /** - * The range to which this diagnostic applies. - */ - range: Range; - - /** - * The human-readable message. - */ - message: string; - - /** - * The severity, default is {@link DiagnosticSeverity.Error error}. - */ - severity: DiagnosticSeverity; - - /** - * A human-readable string describing the source of this - * diagnostic, e.g. 'typescript' or 'super lint'. - */ - source?: string; - - /** - * A code or identifier for this diagnostic. - * Should be used for later processing, e.g. when providing {@link CodeActionContext code actions}. - */ - code?: - | string - | number - | { - /** - * A code or identifier for this diagnostic. - * Should be used for later processing, e.g. when providing {@link CodeActionContext code actions}. - */ - value: string | number; - - /** - * A target URI to open with more information about the diagnostic error. - */ - target: Uri; - }; - - /** - * An array of related diagnostic information, e.g. when symbol-names within - * a scope collide all definitions can be marked via this property. - */ - relatedInformation?: DiagnosticRelatedInformation[]; - - /** - * Additional metadata about the diagnostic. - */ - tags?: DiagnosticTag[]; - - /** - * Creates a new diagnostic object. - * - * @param range The range to which this diagnostic applies. - * @param message The human-readable message. - * @param severity The severity, default is {@link DiagnosticSeverity.Error error}. - */ - constructor( - range: Range, - message: string, - severity?: DiagnosticSeverity, - ); - } - - /** - * A diagnostics collection is a container that manages a set of - * {@link Diagnostic diagnostics}. Diagnostics are always scopes to a - * diagnostics collection and a resource. - * - * To get an instance of a `DiagnosticCollection` use - * {@link languages.createDiagnosticCollection createDiagnosticCollection}. - */ - export interface DiagnosticCollection - extends Iterable<[uri: Uri, diagnostics: readonly Diagnostic[]]> { - /** - * The name of this diagnostic collection, for instance `typescript`. Every diagnostic - * from this collection will be associated with this name. Also, the task framework uses this - * name when defining [problem matchers](https://code.visualstudio.com/docs/editor/tasks#_defining-a-problem-matcher). - */ - readonly name: string; - - /** - * Assign diagnostics for given resource. Will replace - * existing diagnostics for that resource. - * - * @param uri A resource identifier. - * @param diagnostics Array of diagnostics or `undefined` - */ - set(uri: Uri, diagnostics: readonly Diagnostic[] | undefined): void; - - /** - * Replace diagnostics for multiple resources in this collection. - * - * _Note_ that multiple tuples of the same uri will be merged, e.g - * `[[file1, [d1]], [file1, [d2]]]` is equivalent to `[[file1, [d1, d2]]]`. - * If a diagnostics item is `undefined` as in `[file1, undefined]` - * all previous but not subsequent diagnostics are removed. - * - * @param entries An array of tuples, like `[[file1, [d1, d2]], [file2, [d3, d4, d5]]]`, or `undefined`. - */ - set( - entries: ReadonlyArray<[Uri, readonly Diagnostic[] | undefined]>, - ): void; - - /** - * Remove all diagnostics from this collection that belong - * to the provided `uri`. The same as `#set(uri, undefined)`. - * - * @param uri A resource identifier. - */ - delete(uri: Uri): void; - - /** - * Remove all diagnostics from this collection. The same - * as calling `#set(undefined)`; - */ - clear(): void; - - /** - * Iterate over each entry in this collection. - * - * @param callback Function to execute for each entry. - * @param thisArg The `this` context used when invoking the handler function. - */ - forEach( - callback: ( - uri: Uri, - diagnostics: readonly Diagnostic[], - collection: DiagnosticCollection, - ) => any, - thisArg?: any, - ): void; - - /** - * Get the diagnostics for a given resource. *Note* that you cannot - * modify the diagnostics-array returned from this call. - * - * @param uri A resource identifier. - * @returns An immutable array of {@link Diagnostic diagnostics} or `undefined`. - */ - get(uri: Uri): readonly Diagnostic[] | undefined; - - /** - * Check if this collection contains diagnostics for a - * given resource. - * - * @param uri A resource identifier. - * @returns `true` if this collection has diagnostic for the given resource. - */ - has(uri: Uri): boolean; - - /** - * Dispose and free associated resources. Calls - * {@link DiagnosticCollection.clear clear}. - */ - dispose(): void; - } - - /** - * Represents the severity of a language status item. - */ - /** - * Represents the severity level of a language status. - */ - export enum LanguageStatusSeverity { - /** - * Informational severity level. - */ - Information = 0, - /** - * Warning severity level. - */ - Warning = 1, - /** - * Error severity level. - */ - Error = 2, - } - - /** - * A language status item is the preferred way to present language status reports for the active text editors, - * such as selected linter or notifying about a configuration problem. - */ - export interface LanguageStatusItem { - /** - * The identifier of this item. - */ - readonly id: string; - - /** - * The short name of this item, like 'Java Language Status', etc. - */ - name: string | undefined; - - /** - * A {@link DocumentSelector selector} that defines for what editors - * this item shows. - */ - selector: DocumentSelector; - - /** - * The severity of this item. - * - * Defaults to {@link LanguageStatusSeverity.Information information}. You can use this property to - * signal to users that there is a problem that needs attention, like a missing executable or an - * invalid configuration. - */ - severity: LanguageStatusSeverity; - - /** - * The text to show for the entry. You can embed icons in the text by leveraging the syntax: - * - * `My text $(icon-name) contains icons like $(icon-name) this one.` - * - * Where the icon-name is taken from the ThemeIcon [icon set](https://code.visualstudio.com/api/references/icons-in-labels#icon-listing), e.g. - * `light-bulb`, `thumbsup`, `zap` etc. - */ - text: string; - - /** - * Optional, human-readable details for this item. - */ - detail?: string; - - /** - * Controls whether the item is shown as "busy". Defaults to `false`. - */ - busy: boolean; - - /** - * A {@linkcode Command command} for this item. - */ - command: Command | undefined; - - /** - * Accessibility information used when a screen reader interacts with this item - */ - accessibilityInformation?: AccessibilityInformation; - - /** - * Dispose and free associated resources. - */ - dispose(): void; - } - - /** - * Denotes a location of an editor in the window. Editors can be arranged in a grid - * and each column represents one editor location in that grid by counting the editors - * in order of their appearance. - */ - export enum ViewColumn { - /** - * A *symbolic* editor column representing the currently active column. This value - * can be used when opening editors, but the *resolved* {@link TextEditor.viewColumn viewColumn}-value - * of editors will always be `One`, `Two`, `Three`,... or `undefined` but never `Active`. - */ - Active = -1, - /** - * A *symbolic* editor column representing the column to the side of the active one. This value - * can be used when opening editors, but the *resolved* {@link TextEditor.viewColumn viewColumn}-value - * of editors will always be `One`, `Two`, `Three`,... or `undefined` but never `Beside`. - */ - Beside = -2, - /** - * The first editor column. - */ - One = 1, - /** - * The second editor column. - */ - Two = 2, - /** - * The third editor column. - */ - Three = 3, - /** - * The fourth editor column. - */ - Four = 4, - /** - * The fifth editor column. - */ - Five = 5, - /** - * The sixth editor column. - */ - Six = 6, - /** - * The seventh editor column. - */ - Seven = 7, - /** - * The eighth editor column. - */ - Eight = 8, - /** - * The ninth editor column. - */ - Nine = 9, - } - - /** - * An output channel is a container for readonly textual information. - * - * To get an instance of an `OutputChannel` use - * {@link window.createOutputChannel createOutputChannel}. - */ - export interface OutputChannel { - /** - * The human-readable name of this output channel. - */ - readonly name: string; - - /** - * Append the given value to the channel. - * - * @param value A string, falsy values will not be printed. - */ - append(value: string): void; - - /** - * Append the given value and a line feed character - * to the channel. - * - * @param value A string, falsy values will be printed. - */ - appendLine(value: string): void; - - /** - * Replaces all output from the channel with the given value. - * - * @param value A string, falsy values will not be printed. - */ - replace(value: string): void; - - /** - * Removes all output from the channel. - */ - clear(): void; - - /** - * Reveal this channel in the UI. - * - * @param preserveFocus When `true` the channel will not take focus. - */ - show(preserveFocus?: boolean): void; - - /** - * Reveal this channel in the UI. - * - * @deprecated Use the overload with just one parameter (`show(preserveFocus?: boolean): void`). - * - * @param column This argument is **deprecated** and will be ignored. - * @param preserveFocus When `true` the channel will not take focus. - */ - show(column?: ViewColumn, preserveFocus?: boolean): void; - - /** - * Hide this channel from the UI. - */ - hide(): void; - - /** - * Dispose and free associated resources. - */ - dispose(): void; - } - - /** - * A channel for containing log output. - * - * To get an instance of a `LogOutputChannel` use - * {@link window.createOutputChannel createOutputChannel}. - */ - export interface LogOutputChannel extends OutputChannel { - /** - * The current log level of the channel. Defaults to {@link env.logLevel editor log level}. - */ - readonly logLevel: LogLevel; - - /** - * An {@link Event} which fires when the log level of the channel changes. - */ - readonly onDidChangeLogLevel: Event; - - /** - * Outputs the given trace message to the channel. Use this method to log verbose information. - * - * The message is only logged if the channel is configured to display {@link LogLevel.Trace trace} log level. - * - * @param message trace message to log - */ - trace(message: string, ...args: any[]): void; - - /** - * Outputs the given debug message to the channel. - * - * The message is only logged if the channel is configured to display {@link LogLevel.Debug debug} log level or lower. - * - * @param message debug message to log - */ - debug(message: string, ...args: any[]): void; - - /** - * Outputs the given information message to the channel. - * - * The message is only logged if the channel is configured to display {@link LogLevel.Info info} log level or lower. - * - * @param message info message to log - */ - info(message: string, ...args: any[]): void; - - /** - * Outputs the given warning message to the channel. - * - * The message is only logged if the channel is configured to display {@link LogLevel.Warning warning} log level or lower. - * - * @param message warning message to log - */ - warn(message: string, ...args: any[]): void; - - /** - * Outputs the given error or error message to the channel. - * - * The message is only logged if the channel is configured to display {@link LogLevel.Error error} log level or lower. - * - * @param error Error or error message to log - */ - error(error: string | Error, ...args: any[]): void; - } - - /** - * Accessibility information which controls screen reader behavior. - */ - export interface AccessibilityInformation { - /** - * Label to be read out by a screen reader once the item has focus. - */ - readonly label: string; - - /** - * Role of the widget which defines how a screen reader interacts with it. - * The role should be set in special cases when for example a tree-like element behaves like a checkbox. - * If role is not specified the editor will pick the appropriate role automatically. - * More about aria roles can be found here https://w3c.github.io/aria/#widget_roles - */ - readonly role?: string; - } - - /** - * Represents the alignment of status bar items. - */ - export enum StatusBarAlignment { - /** - * Aligned to the left side. - */ - Left = 1, - - /** - * Aligned to the right side. - */ - Right = 2, - } - - /** - * A status bar item is a status bar contribution that can - * show text and icons and run a command on click. - */ - export interface StatusBarItem { - /** - * The identifier of this item. - * - * *Note*: if no identifier was provided by the {@linkcode window.createStatusBarItem} - * method, the identifier will match the {@link Extension.id extension identifier}. - */ - readonly id: string; - - /** - * The alignment of this item. - */ - readonly alignment: StatusBarAlignment; - - /** - * The priority of this item. Higher value means the item should - * be shown more to the left. - */ - readonly priority: number | undefined; - - /** - * The name of the entry, like 'Python Language Indicator', 'Git Status' etc. - * Try to keep the length of the name short, yet descriptive enough that - * users can understand what the status bar item is about. - */ - name: string | undefined; - - /** - * The text to show for the entry. You can embed icons in the text by leveraging the syntax: - * - * `My text $(icon-name) contains icons like $(icon-name) this one.` - * - * Where the icon-name is taken from the ThemeIcon [icon set](https://code.visualstudio.com/api/references/icons-in-labels#icon-listing), e.g. - * `light-bulb`, `thumbsup`, `zap` etc. - */ - text: string; - - /** - * The tooltip text when you hover over this entry. - */ - tooltip: string | MarkdownString | undefined; - - /** - * The foreground color for this entry. - */ - color: string | ThemeColor | undefined; - - /** - * The background color for this entry. - * - * *Note*: only the following colors are supported: - * * `new ThemeColor('statusBarItem.errorBackground')` - * * `new ThemeColor('statusBarItem.warningBackground')` - * - * More background colors may be supported in the future. - * - * *Note*: when a background color is set, the statusbar may override - * the `color` choice to ensure the entry is readable in all themes. - */ - backgroundColor: ThemeColor | undefined; - - /** - * {@linkcode Command} or identifier of a command to run on click. - * - * The command must be {@link commands.getCommands known}. - * - * Note that if this is a {@linkcode Command} object, only the {@linkcode Command.command command} and {@linkcode Command.arguments arguments} - * are used by the editor. - */ - command: string | Command | undefined; - - /** - * Accessibility information used when a screen reader interacts with this StatusBar item - */ - accessibilityInformation: AccessibilityInformation | undefined; - - /** - * Shows the entry in the status bar. - */ - show(): void; - - /** - * Hide the entry in the status bar. - */ - hide(): void; - - /** - * Dispose and free associated resources. Call - * {@link StatusBarItem.hide hide}. - */ - dispose(): void; - } - - /** - * Defines a generalized way of reporting progress updates. - */ - export interface Progress { - /** - * Report a progress update. - * @param value A progress item, like a message and/or an - * report on how much work finished - */ - report(value: T): void; - } - - /** - * An individual terminal instance within the integrated terminal. - */ - export interface Terminal { - /** - * The name of the terminal. - */ - readonly name: string; - - /** - * The process ID of the shell process. - */ - readonly processId: Thenable; - - /** - * The object used to initialize the terminal, this is useful for example to detecting the - * shell type of when the terminal was not launched by this extension or for detecting what - * folder the shell was launched in. - */ - readonly creationOptions: Readonly< - TerminalOptions | ExtensionTerminalOptions - >; - - /** - * The exit status of the terminal, this will be undefined while the terminal is active. - * - * **Example:** Show a notification with the exit code when the terminal exits with a - * non-zero exit code. - * ```typescript - * window.onDidCloseTerminal(t => { - * if (t.exitStatus && t.exitStatus.code) { - * vscode.window.showInformationMessage(`Exit code: ${t.exitStatus.code}`); - * } - * }); - * ``` - */ - readonly exitStatus: TerminalExitStatus | undefined; - - /** - * The current state of the {@link Terminal}. - */ - readonly state: TerminalState; - - /** - * An object that contains [shell integration](https://code.visualstudio.com/docs/terminal/shell-integration)-powered - * features for the terminal. This will always be `undefined` immediately after the terminal - * is created. Listen to {@link window.onDidChangeTerminalShellIntegration} to be notified - * when shell integration is activated for a terminal. - * - * Note that this object may remain undefined if shell integration never activates. For - * example Command Prompt does not support shell integration and a user's shell setup could - * conflict with the automatic shell integration activation. - */ - readonly shellIntegration: TerminalShellIntegration | undefined; - - /** - * Send text to the terminal. The text is written to the stdin of the underlying pty process - * (shell) of the terminal. - * - * @param text The text to send. - * @param shouldExecute Indicates that the text being sent should be executed rather than just inserted in the terminal. - * The character(s) added are `\n` or `\r\n`, depending on the platform. This defaults to `true`. - */ - sendText(text: string, shouldExecute?: boolean): void; - - /** - * Show the terminal panel and reveal this terminal in the UI. - * - * @param preserveFocus When `true` the terminal will not take focus. - */ - show(preserveFocus?: boolean): void; - - /** - * Hide the terminal panel if this terminal is currently showing. - */ - hide(): void; - - /** - * Dispose and free associated resources. - */ - dispose(): void; - } - - /** - * The location of the terminal. - */ - export enum TerminalLocation { - /** - * In the terminal view - */ - Panel = 1, - /** - * In the editor area - */ - Editor = 2, - } - - /** - * Assumes a {@link TerminalLocation} of editor and allows specifying a {@link ViewColumn} and - * {@link TerminalEditorLocationOptions.preserveFocus preserveFocus } property - */ - export interface TerminalEditorLocationOptions { - /** - * A view column in which the {@link Terminal terminal} should be shown in the editor area. - * The default is the {@link ViewColumn.Active active}. Columns that do not exist - * will be created as needed up to the maximum of {@linkcode ViewColumn.Nine}. - * Use {@linkcode ViewColumn.Beside} to open the editor to the side of the currently - * active one. - */ - viewColumn: ViewColumn; - /** - * An optional flag that when `true` will stop the {@link Terminal} from taking focus. - */ - preserveFocus?: boolean; - } - - /** - * Uses the parent {@link Terminal}'s location for the terminal - */ - export interface TerminalSplitLocationOptions { - /** - * The parent terminal to split this terminal beside. This works whether the parent terminal - * is in the panel or the editor area. - */ - parentTerminal: Terminal; - } - - /** - * Represents the state of a {@link Terminal}. - */ - export interface TerminalState { - /** - * Whether the {@link Terminal} has been interacted with. Interaction means that the - * terminal has sent data to the process which depending on the terminal's _mode_. By - * default input is sent when a key is pressed or when a command or extension sends text, - * but based on the terminal's mode it can also happen on: - * - * - a pointer click event - * - a pointer scroll event - * - a pointer move event - * - terminal focus in/out - * - * For more information on events that can send data see "DEC Private Mode Set (DECSET)" on - * https://invisible-island.net/xterm/ctlseqs/ctlseqs.html - */ - readonly isInteractedWith: boolean; - } - - /** - * [Shell integration](https://code.visualstudio.com/docs/terminal/shell-integration)-powered capabilities owned by a terminal. - */ - export interface TerminalShellIntegration { - /** - * The current working directory of the terminal. This {@link Uri} may represent a file on - * another machine (eg. ssh into another machine). This requires the shell integration to - * support working directory reporting. - */ - readonly cwd: Uri | undefined; - - /** - * Execute a command, sending ^C as necessary to interrupt any running command if needed. - * - * @param commandLine The command line to execute, this is the exact text that will be sent - * to the terminal. - * - * @example - * // Execute a command in a terminal immediately after being created - * const myTerm = window.createTerminal(); - * window.onDidChangeTerminalShellIntegration(async ({ terminal, shellIntegration }) => { - * if (terminal === myTerm) { - * const execution = shellIntegration.executeCommand('echo "Hello world"'); - * window.onDidEndTerminalShellExecution(event => { - * if (event.execution === execution) { - * console.log(`Command exited with code ${event.exitCode}`); - * } - * }); - * } - * })); - * // Fallback to sendText if there is no shell integration within 3 seconds of launching - * setTimeout(() => { - * if (!myTerm.shellIntegration) { - * myTerm.sendText('echo "Hello world"'); - * // Without shell integration, we can't know when the command has finished or what the - * // exit code was. - * } - * }, 3000); - * - * @example - * // Send command to terminal that has been alive for a while - * const commandLine = 'echo "Hello world"'; - * if (term.shellIntegration) { - * const execution = shellIntegration.executeCommand({ commandLine }); - * window.onDidEndTerminalShellExecution(event => { - * if (event.execution === execution) { - * console.log(`Command exited with code ${event.exitCode}`); - * } - * }); - * } else { - * term.sendText(commandLine); - * // Without shell integration, we can't know when the command has finished or what the - * // exit code was. - * } - */ - executeCommand(commandLine: string): TerminalShellExecution; - - /** - * Execute a command, sending ^C as necessary to interrupt any running command if needed. - * - * *Note* This is not guaranteed to work as [shell integration](https://code.visualstudio.com/docs/terminal/shell-integration) - * must be activated. Check whether {@link TerminalShellExecution.exitCode} is rejected to - * verify whether it was successful. - * - * @param executable A command to run. - * @param args Arguments to launch the executable with which will be automatically escaped - * based on the executable type. - * - * @example - * // Execute a command in a terminal immediately after being created - * const myTerm = window.createTerminal(); - * window.onDidChangeTerminalShellIntegration(async ({ terminal, shellIntegration }) => { - * if (terminal === myTerm) { - * const command = shellIntegration.executeCommand({ - * command: 'echo', - * args: ['Hello world'] - * }); - * const code = await command.exitCode; - * console.log(`Command exited with code ${code}`); - * } - * })); - * // Fallback to sendText if there is no shell integration within 3 seconds of launching - * setTimeout(() => { - * if (!myTerm.shellIntegration) { - * myTerm.sendText('echo "Hello world"'); - * // Without shell integration, we can't know when the command has finished or what the - * // exit code was. - * } - * }, 3000); - * - * @example - * // Send command to terminal that has been alive for a while - * const commandLine = 'echo "Hello world"'; - * if (term.shellIntegration) { - * const command = term.shellIntegration.executeCommand({ - * command: 'echo', - * args: ['Hello world'] - * }); - * const code = await command.exitCode; - * console.log(`Command exited with code ${code}`); - * } else { - * term.sendText(commandLine); - * // Without shell integration, we can't know when the command has finished or what the - * // exit code was. - * } - */ - executeCommand( - executable: string, - args: string[], - ): TerminalShellExecution; - } - - /** - * A command that was executed in a terminal. - */ - export interface TerminalShellExecution { - /** - * The command line that was executed. The {@link TerminalShellExecutionCommandLineConfidence confidence} - * of this value depends on the specific shell's shell integration implementation. This - * value may become more accurate after {@link window.onDidEndTerminalShellExecution} is - * fired. - * - * @example - * // Log the details of the command line on start and end - * window.onDidStartTerminalShellExecution(event => { - * const commandLine = event.execution.commandLine; - * console.log(`Command started\n${summarizeCommandLine(commandLine)}`); - * }); - * window.onDidEndTerminalShellExecution(event => { - * const commandLine = event.execution.commandLine; - * console.log(`Command ended\n${summarizeCommandLine(commandLine)}`); - * }); - * function summarizeCommandLine(commandLine: TerminalShellExecutionCommandLine) { - * return [ - * ` Command line: ${command.commandLine.value}`, - * ` Confidence: ${command.commandLine.confidence}`, - * ` Trusted: ${command.commandLine.isTrusted} - * ].join('\n'); - * } - */ - readonly commandLine: TerminalShellExecutionCommandLine; - - /** - * The working directory that was reported by the shell when this command executed. This - * {@link Uri} may represent a file on another machine (eg. ssh into another machine). This - * requires the shell integration to support working directory reporting. - */ - readonly cwd: Uri | undefined; - - /** - * Creates a stream of raw data (including escape sequences) that is written to the - * terminal. This will only include data that was written after `read` was called for - * the first time, ie. you must call `read` immediately after the command is executed via - * {@link TerminalShellIntegration.executeCommand} or - * {@link window.onDidStartTerminalShellExecution} to not miss any data. - * - * @example - * // Log all data written to the terminal for a command - * const command = term.shellIntegration.executeCommand({ commandLine: 'echo "Hello world"' }); - * const stream = command.read(); - * for await (const data of stream) { - * console.log(data); - * } - */ - read(): AsyncIterable; - } - - /** - * A command line that was executed in a terminal. - */ - export interface TerminalShellExecutionCommandLine { - /** - * The full command line that was executed, including both the command and its arguments. - */ - readonly value: string; - - /** - * Whether the command line value came from a trusted source and is therefore safe to - * execute without user additional confirmation, such as a notification that asks "Do you - * want to execute (command)?". This verification is likely only needed if you are going to - * execute the command again. - * - * This is `true` only when the command line was reported explicitly by the shell - * integration script (ie. {@link TerminalShellExecutionCommandLineConfidence.High high confidence}) - * and it used a nonce for verification. - */ - readonly isTrusted: boolean; - - /** - * The confidence of the command line value which is determined by how the value was - * obtained. This depends upon the implementation of the shell integration script. - */ - readonly confidence: TerminalShellExecutionCommandLineConfidence; - } - - /** - * The confidence of a {@link TerminalShellExecutionCommandLine} value. - */ - enum TerminalShellExecutionCommandLineConfidence { - /** - * The command line value confidence is low. This means that the value was read from the - * terminal buffer using markers reported by the shell integration script. Additionally one - * of the following conditions will be met: - * - * - The command started on the very left-most column which is unusual, or - * - The command is multi-line which is more difficult to accurately detect due to line - * continuation characters and right prompts. - * - Command line markers were not reported by the shell integration script. - */ - Low = 0, - - /** - * The command line value confidence is medium. This means that the value was read from the - * terminal buffer using markers reported by the shell integration script. The command is - * single-line and does not start on the very left-most column (which is unusual). - */ - Medium = 1, - - /** - * The command line value confidence is high. This means that the value was explicitly sent - * from the shell integration script or the command was executed via the - * {@link TerminalShellIntegration.executeCommand} API. - */ - High = 2, - } - - /** - * An event signalling that a terminal's shell integration has changed. - */ - export interface TerminalShellIntegrationChangeEvent { - /** - * The terminal that shell integration has been activated in. - */ - readonly terminal: Terminal; - - /** - * The shell integration object. - */ - readonly shellIntegration: TerminalShellIntegration; - } - - /** - * An event signalling that an execution has started in a terminal. - */ - export interface TerminalShellExecutionStartEvent { - /** - * The terminal that shell integration has been activated in. - */ - readonly terminal: Terminal; - - /** - * The shell integration object. - */ - readonly shellIntegration: TerminalShellIntegration; - - /** - * The terminal shell execution that has ended. - */ - readonly execution: TerminalShellExecution; - } - - /** - * An event signalling that an execution has ended in a terminal. - */ - export interface TerminalShellExecutionEndEvent { - /** - * The terminal that shell integration has been activated in. - */ - readonly terminal: Terminal; - - /** - * The shell integration object. - */ - readonly shellIntegration: TerminalShellIntegration; - - /** - * The terminal shell execution that has ended. - */ - readonly execution: TerminalShellExecution; - - /** - * The exit code reported by the shell. - * - * Note that `undefined` means the shell either did not report an exit code (ie. the shell - * integration script is misbehaving) or the shell reported a command started before the command - * finished (eg. a sub-shell was opened). Generally this should not happen, depending on the use - * case, it may be best to treat this as a failure. - * - * @example - * const execution = shellIntegration.executeCommand({ - * command: 'echo', - * args: ['Hello world'] - * }); - * window.onDidEndTerminalShellExecution(event => { - * if (event.execution === execution) { - * if (event.exitCode === undefined) { - * console.log('Command finished but exit code is unknown'); - * } else if (event.exitCode === 0) { - * console.log('Command succeeded'); - * } else { - * console.log('Command failed'); - * } - * } - * }); - */ - readonly exitCode: number | undefined; - } - - /** - * Provides information on a line in a terminal in order to provide links for it. - */ - export interface TerminalLinkContext { - /** - * This is the text from the unwrapped line in the terminal. - */ - line: string; - - /** - * The terminal the link belongs to. - */ - terminal: Terminal; - } - - /** - * A provider that enables detection and handling of links within terminals. - */ - export interface TerminalLinkProvider< - T extends TerminalLink = TerminalLink, - > { - /** - * Provide terminal links for the given context. Note that this can be called multiple times - * even before previous calls resolve, make sure to not share global objects (eg. `RegExp`) - * that could have problems when asynchronous usage may overlap. - * @param context Information about what links are being provided for. - * @param token A cancellation token. - * @returns A list of terminal links for the given line. - */ - provideTerminalLinks( - context: TerminalLinkContext, - token: CancellationToken, - ): ProviderResult; - - /** - * Handle an activated terminal link. - * @param link The link to handle. - */ - handleTerminalLink(link: T): ProviderResult; - } - - /** - * A link on a terminal line. - */ - export class TerminalLink { - /** - * The start index of the link on {@link TerminalLinkContext.line}. - */ - startIndex: number; - - /** - * The length of the link on {@link TerminalLinkContext.line}. - */ - length: number; - - /** - * The tooltip text when you hover over this link. - * - * If a tooltip is provided, is will be displayed in a string that includes instructions on - * how to trigger the link, such as `{0} (ctrl + click)`. The specific instructions vary - * depending on OS, user settings, and localization. - */ - tooltip?: string; - - /** - * Creates a new terminal link. - * @param startIndex The start index of the link on {@link TerminalLinkContext.line}. - * @param length The length of the link on {@link TerminalLinkContext.line}. - * @param tooltip The tooltip text when you hover over this link. - * - * If a tooltip is provided, is will be displayed in a string that includes instructions on - * how to trigger the link, such as `{0} (ctrl + click)`. The specific instructions vary - * depending on OS, user settings, and localization. - */ - constructor(startIndex: number, length: number, tooltip?: string); - } - - /** - * Provides a terminal profile for the contributed terminal profile when launched via the UI or - * command. - */ - export interface TerminalProfileProvider { - /** - * Provide the terminal profile. - * @param token A cancellation token that indicates the result is no longer needed. - * @returns The terminal profile. - */ - provideTerminalProfile( - token: CancellationToken, - ): ProviderResult; - } - - /** - * A terminal profile defines how a terminal will be launched. - */ - export class TerminalProfile { - /** - * The options that the terminal will launch with. - */ - options: TerminalOptions | ExtensionTerminalOptions; - - /** - * Creates a new terminal profile. - * @param options The options that the terminal will launch with. - */ - constructor(options: TerminalOptions | ExtensionTerminalOptions); - } - - /** - * A file decoration represents metadata that can be rendered with a file. - */ - export class FileDecoration { - /** - * A very short string that represents this decoration. - */ - badge?: string; - - /** - * A human-readable tooltip for this decoration. - */ - tooltip?: string; - - /** - * The color of this decoration. - */ - color?: ThemeColor; - - /** - * A flag expressing that this decoration should be - * propagated to its parents. - */ - propagate?: boolean; - - /** - * Creates a new decoration. - * - * @param badge A letter that represents the decoration. - * @param tooltip The tooltip of the decoration. - * @param color The color of the decoration. - */ - constructor(badge?: string, tooltip?: string, color?: ThemeColor); - } - - /** - * The decoration provider interfaces defines the contract between extensions and - * file decorations. - */ - export interface FileDecorationProvider { - /** - * An optional event to signal that decorations for one or many files have changed. - * - * *Note* that this event should be used to propagate information about children. - * - * @see {@link EventEmitter} - */ - onDidChangeFileDecorations?: Event; - - /** - * Provide decorations for a given uri. - * - * *Note* that this function is only called when a file gets rendered in the UI. - * This means a decoration from a descendent that propagates upwards must be signaled - * to the editor via the {@link FileDecorationProvider.onDidChangeFileDecorations onDidChangeFileDecorations}-event. - * - * @param uri The uri of the file to provide a decoration for. - * @param token A cancellation token. - * @returns A decoration or a thenable that resolves to such. - */ - provideFileDecoration( - uri: Uri, - token: CancellationToken, - ): ProviderResult; - } - - /** - * In a remote window the extension kind describes if an extension - * runs where the UI (window) runs or if an extension runs remotely. - */ - export enum ExtensionKind { - /** - * Extension runs where the UI runs. - */ - UI = 1, - - /** - * Extension runs where the remote extension host runs. - */ - Workspace = 2, - } - - /** - * Represents an extension. - * - * To get an instance of an `Extension` use {@link extensions.getExtension getExtension}. - */ - export interface Extension { - /** - * The canonical extension identifier in the form of: `publisher.name`. - */ - readonly id: string; - - /** - * The uri of the directory containing the extension. - */ - readonly extensionUri: Uri; - - /** - * The absolute file path of the directory containing this extension. Shorthand - * notation for {@link Extension.extensionUri Extension.extensionUri.fsPath} (independent of the uri scheme). - */ - readonly extensionPath: string; - - /** - * `true` if the extension has been activated. - */ - readonly isActive: boolean; - - /** - * The parsed contents of the extension's package.json. - */ - readonly packageJSON: any; - - /** - * The extension kind describes if an extension runs where the UI runs - * or if an extension runs where the remote extension host runs. The extension kind - * is defined in the `package.json`-file of extensions but can also be refined - * via the `remote.extensionKind`-setting. When no remote extension host exists, - * the value is {@linkcode ExtensionKind.UI}. - */ - extensionKind: ExtensionKind; - - /** - * The public API exported by this extension (return value of `activate`). - * It is an invalid action to access this field before this extension has been activated. - */ - readonly exports: T; - - /** - * Activates this extension and returns its public API. - * - * @returns A promise that will resolve when this extension has been activated. - */ - activate(): Thenable; - } - - /** - * The ExtensionMode is provided on the `ExtensionContext` and indicates the - * mode the specific extension is running in. - */ - export enum ExtensionMode { - /** - * The extension is installed normally (for example, from the marketplace - * or VSIX) in the editor. - */ - Production = 1, - - /** - * The extension is running from an `--extensionDevelopmentPath` provided - * when launching the editor. - */ - Development = 2, - - /** - * The extension is running from an `--extensionTestsPath` and - * the extension host is running unit tests. - */ - Test = 3, - } - - /** - * An extension context is a collection of utilities private to an - * extension. - * - * An instance of an `ExtensionContext` is provided as the first - * parameter to the `activate`-call of an extension. - */ - export interface ExtensionContext { - /** - * An array to which disposables can be added. When this - * extension is deactivated the disposables will be disposed. - * - * *Note* that asynchronous dispose-functions aren't awaited. - */ - readonly subscriptions: { - /** - * Function to clean up resources. - */ - dispose(): any; - }[]; - - /** - * A memento object that stores state in the context - * of the currently opened {@link workspace.workspaceFolders workspace}. - */ - readonly workspaceState: Memento; - - /** - * A memento object that stores state independent - * of the current opened {@link workspace.workspaceFolders workspace}. - */ - readonly globalState: Memento & { - /** - * Set the keys whose values should be synchronized across devices when synchronizing user-data - * like configuration, extensions, and mementos. - * - * Note that this function defines the whole set of keys whose values are synchronized: - * - calling it with an empty array stops synchronization for this memento - * - calling it with a non-empty array replaces all keys whose values are synchronized - * - * For any given set of keys this function needs to be called only once but there is no harm in - * repeatedly calling it. - * - * @param keys The set of keys whose values are synced. - */ - setKeysForSync(keys: readonly string[]): void; - }; - - /** - * A storage utility for secrets. Secrets are persisted across reloads and are independent of the - * current opened {@link workspace.workspaceFolders workspace}. - */ - readonly secrets: SecretStorage; - - /** - * The uri of the directory containing the extension. - */ - readonly extensionUri: Uri; - - /** - * The absolute file path of the directory containing the extension. Shorthand - * notation for {@link TextDocument.uri ExtensionContext.extensionUri.fsPath} (independent of the uri scheme). - */ - readonly extensionPath: string; - - /** - * Gets the extension's global environment variable collection for this workspace, enabling changes to be - * applied to terminal environment variables. - */ - readonly environmentVariableCollection: GlobalEnvironmentVariableCollection; - - /** - * Get the absolute path of a resource contained in the extension. - * - * *Note* that an absolute uri can be constructed via {@linkcode Uri.joinPath} and - * {@linkcode ExtensionContext.extensionUri extensionUri}, e.g. `vscode.Uri.joinPath(context.extensionUri, relativePath);` - * - * @param relativePath A relative path to a resource contained in the extension. - * @returns The absolute path of the resource. - */ - asAbsolutePath(relativePath: string): string; - - /** - * The uri of a workspace specific directory in which the extension - * can store private state. The directory might not exist and creation is - * up to the extension. However, the parent directory is guaranteed to be existent. - * The value is `undefined` when no workspace nor folder has been opened. - * - * Use {@linkcode ExtensionContext.workspaceState workspaceState} or - * {@linkcode ExtensionContext.globalState globalState} to store key value data. - * - * @see {@linkcode FileSystem workspace.fs} for how to read and write files and folders from - * an uri. - */ - readonly storageUri: Uri | undefined; - - /** - * An absolute file path of a workspace specific directory in which the extension - * can store private state. The directory might not exist on disk and creation is - * up to the extension. However, the parent directory is guaranteed to be existent. - * - * Use {@linkcode ExtensionContext.workspaceState workspaceState} or - * {@linkcode ExtensionContext.globalState globalState} to store key value data. - * - * @deprecated Use {@link ExtensionContext.storageUri storageUri} instead. - */ - readonly storagePath: string | undefined; - - /** - * The uri of a directory in which the extension can store global state. - * The directory might not exist on disk and creation is - * up to the extension. However, the parent directory is guaranteed to be existent. - * - * Use {@linkcode ExtensionContext.globalState globalState} to store key value data. - * - * @see {@linkcode FileSystem workspace.fs} for how to read and write files and folders from - * an uri. - */ - readonly globalStorageUri: Uri; - - /** - * An absolute file path in which the extension can store global state. - * The directory might not exist on disk and creation is - * up to the extension. However, the parent directory is guaranteed to be existent. - * - * Use {@linkcode ExtensionContext.globalState globalState} to store key value data. - * - * @deprecated Use {@link ExtensionContext.globalStorageUri globalStorageUri} instead. - */ - readonly globalStoragePath: string; - - /** - * The uri of a directory in which the extension can create log files. - * The directory might not exist on disk and creation is up to the extension. However, - * the parent directory is guaranteed to be existent. - * - * @see {@linkcode FileSystem workspace.fs} for how to read and write files and folders from - * an uri. - */ - readonly logUri: Uri; - - /** - * An absolute file path of a directory in which the extension can create log files. - * The directory might not exist on disk and creation is up to the extension. However, - * the parent directory is guaranteed to be existent. - * - * @deprecated Use {@link ExtensionContext.logUri logUri} instead. - */ - readonly logPath: string; - - /** - * The mode the extension is running in. See {@link ExtensionMode} - * for possible values and scenarios. - */ - readonly extensionMode: ExtensionMode; - - /** - * The current `Extension` instance. - */ - readonly extension: Extension; - - /** - * An object that keeps information about how this extension can use language models. - * - * @see {@link LanguageModelChat.sendRequest} - */ - readonly languageModelAccessInformation: LanguageModelAccessInformation; - } - - /** - * A memento represents a storage utility. It can store and retrieve - * values. - */ - export interface Memento { - /** - * Returns the stored keys. - * - * @returns The stored keys. - */ - keys(): readonly string[]; - - /** - * Return a value. - * - * @param key A string. - * @returns The stored value or `undefined`. - */ - get(key: string): T | undefined; - - /** - * Return a value. - * - * @param key A string. - * @param defaultValue A value that should be returned when there is no - * value (`undefined`) with the given key. - * @returns The stored value or the defaultValue. - */ - get(key: string, defaultValue: T): T; - - /** - * Store a value. The value must be JSON-stringifyable. - * - * *Note* that using `undefined` as value removes the key from the underlying - * storage. - * - * @param key A string. - * @param value A value. MUST not contain cyclic references. - */ - update(key: string, value: any): Thenable; - } - - /** - * The event data that is fired when a secret is added or removed. - */ - export interface SecretStorageChangeEvent { - /** - * The key of the secret that has changed. - */ - readonly key: string; - } - - /** - * Represents a storage utility for secrets, information that is - * sensitive. - */ - export interface SecretStorage { - /** - * Retrieve a secret that was stored with key. Returns undefined if there - * is no password matching that key. - * @param key The key the secret was stored under. - * @returns The stored value or `undefined`. - */ - get(key: string): Thenable; - - /** - * Store a secret under a given key. - * @param key The key to store the secret under. - * @param value The secret. - */ - store(key: string, value: string): Thenable; - - /** - * Remove a secret from storage. - * @param key The key the secret was stored under. - */ - delete(key: string): Thenable; - - /** - * Fires when a secret is stored or deleted. - */ - onDidChange: Event; - } - - /** - * Represents a color theme kind. - */ - export enum ColorThemeKind { - /** - * A light color theme. - */ - Light = 1, - /** - * A dark color theme. - */ - Dark = 2, - /** - * A dark high contrast color theme. - */ - HighContrast = 3, - /** - * A light high contrast color theme. - */ - HighContrastLight = 4, - } - - /** - * Represents a color theme. - */ - export interface ColorTheme { - /** - * The kind of this color theme: light, dark, high contrast dark and high contrast light. - */ - readonly kind: ColorThemeKind; - } - - /** - * Controls the behaviour of the terminal's visibility. - */ - export enum TaskRevealKind { - /** - * Always brings the terminal to front if the task is executed. - */ - Always = 1, - - /** - * Only brings the terminal to front if a problem is detected executing the task - * (e.g. the task couldn't be started because). - */ - Silent = 2, - - /** - * The terminal never comes to front when the task is executed. - */ - Never = 3, - } - - /** - * Controls how the task channel is used between tasks - */ - export enum TaskPanelKind { - /** - * Shares a panel with other tasks. This is the default. - */ - Shared = 1, - - /** - * Uses a dedicated panel for this tasks. The panel is not - * shared with other tasks. - */ - Dedicated = 2, - - /** - * Creates a new panel whenever this task is executed. - */ - New = 3, - } - - /** - * Controls how the task is presented in the UI. - */ - export interface TaskPresentationOptions { - /** - * Controls whether the task output is reveal in the user interface. - * Defaults to `RevealKind.Always`. - */ - reveal?: TaskRevealKind; - - /** - * Controls whether the command associated with the task is echoed - * in the user interface. - */ - echo?: boolean; - - /** - * Controls whether the panel showing the task output is taking focus. - */ - focus?: boolean; - - /** - * Controls if the task panel is used for this task only (dedicated), - * shared between tasks (shared) or if a new panel is created on - * every task execution (new). Defaults to `TaskInstanceKind.Shared` - */ - panel?: TaskPanelKind; - - /** - * Controls whether to show the "Terminal will be reused by tasks, press any key to close it" message. - */ - showReuseMessage?: boolean; - - /** - * Controls whether the terminal is cleared before executing the task. - */ - clear?: boolean; - - /** - * Controls whether the terminal is closed after executing the task. - */ - close?: boolean; - } - - /** - * A grouping for tasks. The editor by default supports the - * 'Clean', 'Build', 'RebuildAll' and 'Test' group. - */ - export class TaskGroup { - /** - * The clean task group; - */ - static Clean: TaskGroup; - - /** - * The build task group; - */ - static Build: TaskGroup; - - /** - * The rebuild all task group; - */ - static Rebuild: TaskGroup; - - /** - * The test all task group; - */ - static Test: TaskGroup; - - /** - * Whether the task that is part of this group is the default for the group. - * This property cannot be set through API, and is controlled by a user's task configurations. - */ - readonly isDefault: boolean | undefined; - - /** - * The ID of the task group. Is one of TaskGroup.Clean.id, TaskGroup.Build.id, TaskGroup.Rebuild.id, or TaskGroup.Test.id. - */ - readonly id: string; - - /** - * Private constructor - * - * @param id Identifier of a task group. - * @param label The human-readable name of a task group. - */ - private constructor(id: string, label: string); - } - - /** - * A structure that defines a task kind in the system. - * The value must be JSON-stringifyable. - */ - export interface TaskDefinition { - /** - * The task definition describing the task provided by an extension. - * Usually a task provider defines more properties to identify - * a task. They need to be defined in the package.json of the - * extension under the 'taskDefinitions' extension point. The npm - * task definition for example looks like this - * ```typescript - * interface NpmTaskDefinition extends TaskDefinition { - * script: string; - * } - * ``` - * - * Note that type identifier starting with a '$' are reserved for internal - * usages and shouldn't be used by extensions. - */ - readonly type: string; - - /** - * Additional attributes of a concrete task definition. - */ - [name: string]: any; - } - - /** - * Options for a process execution - */ - export interface ProcessExecutionOptions { - /** - * The current working directory of the executed program or shell. - * If omitted the tools current workspace root is used. - */ - cwd?: string; - - /** - * The additional environment of the executed program or shell. If omitted - * the parent process' environment is used. If provided it is merged with - * the parent process' environment. - */ - env?: { [key: string]: string }; - } - - /** - * The execution of a task happens as an external process - * without shell interaction. - */ - export class ProcessExecution { - /** - * Creates a process execution. - * - * @param process The process to start. - * @param options Optional options for the started process. - */ - constructor(process: string, options?: ProcessExecutionOptions); - - /** - * Creates a process execution. - * - * @param process The process to start. - * @param args Arguments to be passed to the process. - * @param options Optional options for the started process. - */ - constructor( - process: string, - args: string[], - options?: ProcessExecutionOptions, - ); - - /** - * The process to be executed. - */ - process: string; - - /** - * The arguments passed to the process. Defaults to an empty array. - */ - args: string[]; - - /** - * The process options used when the process is executed. - * Defaults to undefined. - */ - options?: ProcessExecutionOptions; - } - - /** - * The shell quoting options. - */ - export interface ShellQuotingOptions { - /** - * The character used to do character escaping. If a string is provided only spaces - * are escaped. If a `{ escapeChar, charsToEscape }` literal is provide all characters - * in `charsToEscape` are escaped using the `escapeChar`. - */ - escape?: - | string - | { - /** - * The escape character. - */ - escapeChar: string; - /** - * The characters to escape. - */ - charsToEscape: string; - }; - - /** - * The character used for strong quoting. The string's length must be 1. - */ - strong?: string; - - /** - * The character used for weak quoting. The string's length must be 1. - */ - weak?: string; - } - - /** - * Options for a shell execution - */ - export interface ShellExecutionOptions { - /** - * The shell executable. - */ - executable?: string; - - /** - * The arguments to be passed to the shell executable used to run the task. Most shells - * require special arguments to execute a command. For example `bash` requires the `-c` - * argument to execute a command, `PowerShell` requires `-Command` and `cmd` requires both - * `/d` and `/c`. - */ - shellArgs?: string[]; - - /** - * The shell quotes supported by this shell. - */ - shellQuoting?: ShellQuotingOptions; - - /** - * The current working directory of the executed shell. - * If omitted the tools current workspace root is used. - */ - cwd?: string; - - /** - * The additional environment of the executed shell. If omitted - * the parent process' environment is used. If provided it is merged with - * the parent process' environment. - */ - env?: { [key: string]: string }; - } - - /** - * Defines how an argument should be quoted if it contains - * spaces or unsupported characters. - */ - export enum ShellQuoting { - /** - * Character escaping should be used. This for example - * uses \ on bash and ` on PowerShell. - */ - Escape = 1, - - /** - * Strong string quoting should be used. This for example - * uses " for Windows cmd and ' for bash and PowerShell. - * Strong quoting treats arguments as literal strings. - * Under PowerShell echo 'The value is $(2 * 3)' will - * print `The value is $(2 * 3)` - */ - Strong = 2, - - /** - * Weak string quoting should be used. This for example - * uses " for Windows cmd, bash and PowerShell. Weak quoting - * still performs some kind of evaluation inside the quoted - * string. Under PowerShell echo "The value is $(2 * 3)" - * will print `The value is 6` - */ - Weak = 3, - } - - /** - * A string that will be quoted depending on the used shell. - */ - export interface ShellQuotedString { - /** - * The actual string value. - */ - value: string; - - /** - * The quoting style to use. - */ - quoting: ShellQuoting; - } - - /** - * Represents a task execution that happens inside a shell. - */ - export class ShellExecution { - /** - * Creates a shell execution with a full command line. - * - * @param commandLine The command line to execute. - * @param options Optional options for the started the shell. - */ - constructor(commandLine: string, options?: ShellExecutionOptions); - - /** - * Creates a shell execution with a command and arguments. For the real execution the editor will - * construct a command line from the command and the arguments. This is subject to interpretation - * especially when it comes to quoting. If full control over the command line is needed please - * use the constructor that creates a `ShellExecution` with the full command line. - * - * @param command The command to execute. - * @param args The command arguments. - * @param options Optional options for the started the shell. - */ - constructor( - command: string | ShellQuotedString, - args: Array, - options?: ShellExecutionOptions, - ); - - /** - * The shell command line. Is `undefined` if created with a command and arguments. - */ - commandLine: string | undefined; - - /** - * The shell command. Is `undefined` if created with a full command line. - */ - command: string | ShellQuotedString; - - /** - * The shell args. Is `undefined` if created with a full command line. - */ - args: Array; - - /** - * The shell options used when the command line is executed in a shell. - * Defaults to undefined. - */ - options?: ShellExecutionOptions; - } - - /** - * Class used to execute an extension callback as a task. - */ - export class CustomExecution { - /** - * Constructs a CustomExecution task object. The callback will be executed when the task is run, at which point the - * extension should return the Pseudoterminal it will "run in". The task should wait to do further execution until - * {@link Pseudoterminal.open} is called. Task cancellation should be handled using - * {@link Pseudoterminal.close}. When the task is complete fire - * {@link Pseudoterminal.onDidClose}. - * @param callback The callback that will be called when the task is started by a user. Any ${} style variables that - * were in the task definition will be resolved and passed into the callback as `resolvedDefinition`. - */ - constructor( - callback: ( - resolvedDefinition: TaskDefinition, - ) => Thenable, - ); - } - - /** - * The scope of a task. - */ - export enum TaskScope { - /** - * The task is a global task. Global tasks are currently not supported. - */ - Global = 1, - - /** - * The task is a workspace task - */ - Workspace = 2, - } - - /** - * Run options for a task. - */ - export interface RunOptions { - /** - * Controls whether task variables are re-evaluated on rerun. - */ - reevaluateOnRerun?: boolean; - } - - /** - * A task to execute - */ - export class Task { - /** - * Creates a new task. - * - * @param taskDefinition The task definition as defined in the taskDefinitions extension point. - * @param scope Specifies the task's scope. It is either a global or a workspace task or a task for a specific workspace folder. Global tasks are currently not supported. - * @param name The task's name. Is presented in the user interface. - * @param source The task's source (e.g. 'gulp', 'npm', ...). Is presented in the user interface. - * @param execution The process or shell execution. - * @param problemMatchers the names of problem matchers to use, like '$tsc' - * or '$eslint'. Problem matchers can be contributed by an extension using - * the `problemMatchers` extension point. - */ - constructor( - taskDefinition: TaskDefinition, - scope: WorkspaceFolder | TaskScope.Global | TaskScope.Workspace, - name: string, - source: string, - execution?: ProcessExecution | ShellExecution | CustomExecution, - problemMatchers?: string | string[], - ); - - /** - * Creates a new task. - * - * @deprecated Use the new constructors that allow specifying a scope for the task. - * - * @param taskDefinition The task definition as defined in the taskDefinitions extension point. - * @param name The task's name. Is presented in the user interface. - * @param source The task's source (e.g. 'gulp', 'npm', ...). Is presented in the user interface. - * @param execution The process or shell execution. - * @param problemMatchers the names of problem matchers to use, like '$tsc' - * or '$eslint'. Problem matchers can be contributed by an extension using - * the `problemMatchers` extension point. - */ - constructor( - taskDefinition: TaskDefinition, - name: string, - source: string, - execution?: ProcessExecution | ShellExecution, - problemMatchers?: string | string[], - ); - - /** - * The task's definition. - */ - definition: TaskDefinition; - - /** - * The task's scope. - */ - readonly scope: - | TaskScope.Global - | TaskScope.Workspace - | WorkspaceFolder - | undefined; - - /** - * The task's name - */ - name: string; - - /** - * A human-readable string which is rendered less prominently on a separate line in places - * where the task's name is displayed. Supports rendering of {@link ThemeIcon theme icons} - * via the `$()`-syntax. - */ - detail?: string; - - /** - * The task's execution engine - */ - execution?: ProcessExecution | ShellExecution | CustomExecution; - - /** - * Whether the task is a background task or not. - */ - isBackground: boolean; - - /** - * A human-readable string describing the source of this shell task, e.g. 'gulp' - * or 'npm'. Supports rendering of {@link ThemeIcon theme icons} via the `$()`-syntax. - */ - source: string; - - /** - * The task group this tasks belongs to. See TaskGroup - * for a predefined set of available groups. - * Defaults to undefined meaning that the task doesn't - * belong to any special group. - */ - group?: TaskGroup; - - /** - * The presentation options. Defaults to an empty literal. - */ - presentationOptions: TaskPresentationOptions; - - /** - * The problem matchers attached to the task. Defaults to an empty - * array. - */ - problemMatchers: string[]; - - /** - * Run options for the task - */ - runOptions: RunOptions; - } - - /** - * A task provider allows to add tasks to the task service. - * A task provider is registered via {@link tasks.registerTaskProvider}. - */ - export interface TaskProvider { - /** - * Provides tasks. - * @param token A cancellation token. - * @returns an array of tasks - */ - provideTasks(token: CancellationToken): ProviderResult; - - /** - * Resolves a task that has no {@linkcode Task.execution execution} set. Tasks are - * often created from information found in the `tasks.json`-file. Such tasks miss - * the information on how to execute them and a task provider must fill in - * the missing information in the `resolveTask`-method. This method will not be - * called for tasks returned from the above `provideTasks` method since those - * tasks are always fully resolved. A valid default implementation for the - * `resolveTask` method is to return `undefined`. - * - * Note that when filling in the properties of `task`, you _must_ be sure to - * use the exact same `TaskDefinition` and not create a new one. Other properties - * may be changed. - * - * @param task The task to resolve. - * @param token A cancellation token. - * @returns The resolved task - */ - resolveTask(task: T, token: CancellationToken): ProviderResult; - } - - /** - * An object representing an executed Task. It can be used - * to terminate a task. - * - * This interface is not intended to be implemented. - */ - export interface TaskExecution { - /** - * The task that got started. - */ - task: Task; - - /** - * Terminates the task execution. - */ - terminate(): void; - } - - /** - * An event signaling the start of a task execution. - * - * This interface is not intended to be implemented. - */ - interface TaskStartEvent { - /** - * The task item representing the task that got started. - */ - readonly execution: TaskExecution; - } - - /** - * An event signaling the end of an executed task. - * - * This interface is not intended to be implemented. - */ - interface TaskEndEvent { - /** - * The task item representing the task that finished. - */ - readonly execution: TaskExecution; - } - - /** - * An event signaling the start of a process execution - * triggered through a task - */ - export interface TaskProcessStartEvent { - /** - * The task execution for which the process got started. - */ - readonly execution: TaskExecution; - - /** - * The underlying process id. - */ - readonly processId: number; - } - - /** - * An event signaling the end of a process execution - * triggered through a task - */ - export interface TaskProcessEndEvent { - /** - * The task execution for which the process got started. - */ - readonly execution: TaskExecution; - - /** - * The process's exit code. Will be `undefined` when the task is terminated. - */ - readonly exitCode: number | undefined; - } - - /** - * A task filter denotes tasks by their version and types - */ - export interface TaskFilter { - /** - * The task version as used in the tasks.json file. - * The string support the package.json semver notation. - */ - version?: string; - - /** - * The task type to return; - */ - type?: string; - } - - /** - * Namespace for tasks functionality. - */ - export namespace tasks { - /** - * Register a task provider. - * - * @param type The task kind type this provider is registered for. - * @param provider A task provider. - * @returns A {@link Disposable} that unregisters this provider when being disposed. - */ - export function registerTaskProvider( - type: string, - provider: TaskProvider, - ): Disposable; - - /** - * Fetches all tasks available in the systems. This includes tasks - * from `tasks.json` files as well as tasks from task providers - * contributed through extensions. - * - * @param filter Optional filter to select tasks of a certain type or version. - * @returns A thenable that resolves to an array of tasks. - */ - export function fetchTasks(filter?: TaskFilter): Thenable; - - /** - * Executes a task that is managed by the editor. The returned - * task execution can be used to terminate the task. - * - * @throws When running a ShellExecution or a ProcessExecution - * task in an environment where a new process cannot be started. - * In such an environment, only CustomExecution tasks can be run. - * - * @param task the task to execute - * @returns A thenable that resolves to a task execution. - */ - export function executeTask(task: Task): Thenable; - - /** - * The currently active task executions or an empty array. - */ - export const taskExecutions: readonly TaskExecution[]; - - /** - * Fires when a task starts. - */ - export const onDidStartTask: Event; - - /** - * Fires when a task ends. - */ - export const onDidEndTask: Event; - - /** - * Fires when the underlying process has been started. - * This event will not fire for tasks that don't - * execute an underlying process. - */ - export const onDidStartTaskProcess: Event; - - /** - * Fires when the underlying process has ended. - * This event will not fire for tasks that don't - * execute an underlying process. - */ - export const onDidEndTaskProcess: Event; - } - - /** - * Enumeration of file types. The types `File` and `Directory` can also be - * a symbolic links, in that case use `FileType.File | FileType.SymbolicLink` and - * `FileType.Directory | FileType.SymbolicLink`. - */ - export enum FileType { - /** - * The file type is unknown. - */ - Unknown = 0, - /** - * A regular file. - */ - File = 1, - /** - * A directory. - */ - Directory = 2, - /** - * A symbolic link to a file. - */ - SymbolicLink = 64, - } - - /** - * Permissions of a file. - */ - export enum FilePermission { - /** - * The file is readonly. - * - * *Note:* All `FileStat` from a `FileSystemProvider` that is registered with - * the option `isReadonly: true` will be implicitly handled as if `FilePermission.Readonly` - * is set. As a consequence, it is not possible to have a readonly file system provider - * registered where some `FileStat` are not readonly. - */ - Readonly = 1, - } - - /** - * The `FileStat`-type represents metadata about a file - */ - export interface FileStat { - /** - * The type of the file, e.g. is a regular file, a directory, or symbolic link - * to a file. - * - * *Note:* This value might be a bitmask, e.g. `FileType.File | FileType.SymbolicLink`. - */ - type: FileType; - /** - * The creation timestamp in milliseconds elapsed since January 1, 1970 00:00:00 UTC. - */ - ctime: number; - /** - * The modification timestamp in milliseconds elapsed since January 1, 1970 00:00:00 UTC. - * - * *Note:* If the file changed, it is important to provide an updated `mtime` that advanced - * from the previous value. Otherwise there may be optimizations in place that will not show - * the updated file contents in an editor for example. - */ - mtime: number; - /** - * The size in bytes. - * - * *Note:* If the file changed, it is important to provide an updated `size`. Otherwise there - * may be optimizations in place that will not show the updated file contents in an editor for - * example. - */ - size: number; - /** - * The permissions of the file, e.g. whether the file is readonly. - * - * *Note:* This value might be a bitmask, e.g. `FilePermission.Readonly | FilePermission.Other`. - */ - permissions?: FilePermission; - } - - /** - * A type that filesystem providers should use to signal errors. - * - * This class has factory methods for common error-cases, like `FileNotFound` when - * a file or folder doesn't exist, use them like so: `throw vscode.FileSystemError.FileNotFound(someUri);` - */ - export class FileSystemError extends Error { - /** - * Create an error to signal that a file or folder wasn't found. - * @param messageOrUri Message or uri. - */ - static FileNotFound(messageOrUri?: string | Uri): FileSystemError; - - /** - * Create an error to signal that a file or folder already exists, e.g. when - * creating but not overwriting a file. - * @param messageOrUri Message or uri. - */ - static FileExists(messageOrUri?: string | Uri): FileSystemError; - - /** - * Create an error to signal that a file is not a folder. - * @param messageOrUri Message or uri. - */ - static FileNotADirectory(messageOrUri?: string | Uri): FileSystemError; - - /** - * Create an error to signal that a file is a folder. - * @param messageOrUri Message or uri. - */ - static FileIsADirectory(messageOrUri?: string | Uri): FileSystemError; - - /** - * Create an error to signal that an operation lacks required permissions. - * @param messageOrUri Message or uri. - */ - static NoPermissions(messageOrUri?: string | Uri): FileSystemError; - - /** - * Create an error to signal that the file system is unavailable or too busy to - * complete a request. - * @param messageOrUri Message or uri. - */ - static Unavailable(messageOrUri?: string | Uri): FileSystemError; - - /** - * Creates a new filesystem error. - * - * @param messageOrUri Message or uri. - */ - constructor(messageOrUri?: string | Uri); - - /** - * A code that identifies this error. - * - * Possible values are names of errors, like {@linkcode FileSystemError.FileNotFound FileNotFound}, - * or `Unknown` for unspecified errors. - */ - readonly code: string; - } - - /** - * Enumeration of file change types. - */ - export enum FileChangeType { - /** - * The contents or metadata of a file have changed. - */ - Changed = 1, - - /** - * A file has been created. - */ - Created = 2, - - /** - * A file has been deleted. - */ - Deleted = 3, - } - - /** - * The event filesystem providers must use to signal a file change. - */ - export interface FileChangeEvent { - /** - * The type of change. - */ - readonly type: FileChangeType; - - /** - * The uri of the file that has changed. - */ - readonly uri: Uri; - } - - /** - * The filesystem provider defines what the editor needs to read, write, discover, - * and to manage files and folders. It allows extensions to serve files from remote places, - * like ftp-servers, and to seamlessly integrate those into the editor. - * - * * *Note 1:* The filesystem provider API works with {@link Uri uris} and assumes hierarchical - * paths, e.g. `foo:/my/path` is a child of `foo:/my/` and a parent of `foo:/my/path/deeper`. - * * *Note 2:* There is an activation event `onFileSystem:` that fires when a file - * or folder is being accessed. - * * *Note 3:* The word 'file' is often used to denote all {@link FileType kinds} of files, e.g. - * folders, symbolic links, and regular files. - */ - export interface FileSystemProvider { - /** - * An event to signal that a resource has been created, changed, or deleted. This - * event should fire for resources that are being {@link FileSystemProvider.watch watched} - * by clients of this provider. - * - * *Note:* It is important that the metadata of the file that changed provides an - * updated `mtime` that advanced from the previous value in the {@link FileStat stat} and a - * correct `size` value. Otherwise there may be optimizations in place that will not show - * the change in an editor for example. - */ - readonly onDidChangeFile: Event; - - /** - * Subscribes to file change events in the file or folder denoted by `uri`. For folders, - * the option `recursive` indicates whether subfolders, sub-subfolders, etc. should - * be watched for file changes as well. With `recursive: false`, only changes to the - * files that are direct children of the folder should trigger an event. - * - * The `excludes` array is used to indicate paths that should be excluded from file - * watching. It is typically derived from the `files.watcherExclude` setting that - * is configurable by the user. Each entry can be be: - * - the absolute path to exclude - * - a relative path to exclude (for example `build/output`) - * - a simple glob pattern (for example `**​/build`, `output/**`) - * - * It is the file system provider's job to call {@linkcode FileSystemProvider.onDidChangeFile onDidChangeFile} - * for every change given these rules. No event should be emitted for files that match any of the provided - * excludes. - * - * @param uri The uri of the file or folder to be watched. - * @param options Configures the watch. - * @returns A disposable that tells the provider to stop watching the `uri`. - */ - watch( - uri: Uri, - options: { - /** - * When enabled also watch subfolders. - */ - readonly recursive: boolean; - /** - * A list of paths and pattern to exclude from watching. - */ - readonly excludes: readonly string[]; - }, - ): Disposable; - - /** - * Retrieve metadata about a file. - * - * Note that the metadata for symbolic links should be the metadata of the file they refer to. - * Still, the {@link FileType.SymbolicLink SymbolicLink}-type must be used in addition to the actual type, e.g. - * `FileType.SymbolicLink | FileType.Directory`. - * - * @param uri The uri of the file to retrieve metadata about. - * @returns The file metadata about the file. - * @throws {@linkcode FileSystemError.FileNotFound FileNotFound} when `uri` doesn't exist. - */ - stat(uri: Uri): FileStat | Thenable; - - /** - * Retrieve all entries of a {@link FileType.Directory directory}. - * - * @param uri The uri of the folder. - * @returns An array of name/type-tuples or a thenable that resolves to such. - * @throws {@linkcode FileSystemError.FileNotFound FileNotFound} when `uri` doesn't exist. - */ - readDirectory( - uri: Uri, - ): [string, FileType][] | Thenable<[string, FileType][]>; - - /** - * Create a new directory (Note, that new files are created via `write`-calls). - * - * @param uri The uri of the new folder. - * @throws {@linkcode FileSystemError.FileNotFound FileNotFound} when the parent of `uri` doesn't exist, e.g. no mkdirp-logic required. - * @throws {@linkcode FileSystemError.FileExists FileExists} when `uri` already exists. - * @throws {@linkcode FileSystemError.NoPermissions NoPermissions} when permissions aren't sufficient. - */ - createDirectory(uri: Uri): void | Thenable; - - /** - * Read the entire contents of a file. - * - * @param uri The uri of the file. - * @returns An array of bytes or a thenable that resolves to such. - * @throws {@linkcode FileSystemError.FileNotFound FileNotFound} when `uri` doesn't exist. - */ - readFile(uri: Uri): Uint8Array | Thenable; - - /** - * Write data to a file, replacing its entire contents. - * - * @param uri The uri of the file. - * @param content The new content of the file. - * @param options Defines if missing files should or must be created. - * @throws {@linkcode FileSystemError.FileNotFound FileNotFound} when `uri` doesn't exist and `create` is not set. - * @throws {@linkcode FileSystemError.FileNotFound FileNotFound} when the parent of `uri` doesn't exist and `create` is set, e.g. no mkdirp-logic required. - * @throws {@linkcode FileSystemError.FileExists FileExists} when `uri` already exists, `create` is set but `overwrite` is not set. - * @throws {@linkcode FileSystemError.NoPermissions NoPermissions} when permissions aren't sufficient. - */ - writeFile( - uri: Uri, - content: Uint8Array, - options: { - /** - * Create the file if it does not exist already. - */ - readonly create: boolean; - /** - * Overwrite the file if it does exist. - */ - readonly overwrite: boolean; - }, - ): void | Thenable; - - /** - * Delete a file. - * - * @param uri The resource that is to be deleted. - * @param options Defines if deletion of folders is recursive. - * @throws {@linkcode FileSystemError.FileNotFound FileNotFound} when `uri` doesn't exist. - * @throws {@linkcode FileSystemError.NoPermissions NoPermissions} when permissions aren't sufficient. - */ - delete( - uri: Uri, - options: { - /** - * Delete the content recursively if a folder is denoted. - */ - readonly recursive: boolean; - }, - ): void | Thenable; - - /** - * Rename a file or folder. - * - * @param oldUri The existing file. - * @param newUri The new location. - * @param options Defines if existing files should be overwritten. - * @throws {@linkcode FileSystemError.FileNotFound FileNotFound} when `oldUri` doesn't exist. - * @throws {@linkcode FileSystemError.FileNotFound FileNotFound} when parent of `newUri` doesn't exist, e.g. no mkdirp-logic required. - * @throws {@linkcode FileSystemError.FileExists FileExists} when `newUri` exists and when the `overwrite` option is not `true`. - * @throws {@linkcode FileSystemError.NoPermissions NoPermissions} when permissions aren't sufficient. - */ - rename( - oldUri: Uri, - newUri: Uri, - options: { - /** - * Overwrite the file if it does exist. - */ - readonly overwrite: boolean; - }, - ): void | Thenable; - - /** - * Copy files or folders. Implementing this function is optional but it will speedup - * the copy operation. - * - * @param source The existing file. - * @param destination The destination location. - * @param options Defines if existing files should be overwritten. - * @throws {@linkcode FileSystemError.FileNotFound FileNotFound} when `source` doesn't exist. - * @throws {@linkcode FileSystemError.FileNotFound FileNotFound} when parent of `destination` doesn't exist, e.g. no mkdirp-logic required. - * @throws {@linkcode FileSystemError.FileExists FileExists} when `destination` exists and when the `overwrite` option is not `true`. - * @throws {@linkcode FileSystemError.NoPermissions NoPermissions} when permissions aren't sufficient. - */ - copy?( - source: Uri, - destination: Uri, - options: { - /** - * Overwrite the file if it does exist. - */ - readonly overwrite: boolean; - }, - ): void | Thenable; - } - - /** - * The file system interface exposes the editor's built-in and contributed - * {@link FileSystemProvider file system providers}. It allows extensions to work - * with files from the local disk as well as files from remote places, like the - * remote extension host or ftp-servers. - * - * *Note* that an instance of this interface is available as {@linkcode workspace.fs}. - */ - export interface FileSystem { - /** - * Retrieve metadata about a file. - * - * @param uri The uri of the file to retrieve metadata about. - * @returns The file metadata about the file. - */ - stat(uri: Uri): Thenable; - - /** - * Retrieve all entries of a {@link FileType.Directory directory}. - * - * @param uri The uri of the folder. - * @returns An array of name/type-tuples or a thenable that resolves to such. - */ - readDirectory(uri: Uri): Thenable<[string, FileType][]>; - - /** - * Create a new directory (Note, that new files are created via `write`-calls). - * - * *Note* that missing directories are created automatically, e.g this call has - * `mkdirp` semantics. - * - * @param uri The uri of the new folder. - */ - createDirectory(uri: Uri): Thenable; - - /** - * Read the entire contents of a file. - * - * @param uri The uri of the file. - * @returns An array of bytes or a thenable that resolves to such. - */ - readFile(uri: Uri): Thenable; - - /** - * Write data to a file, replacing its entire contents. - * - * @param uri The uri of the file. - * @param content The new content of the file. - */ - writeFile(uri: Uri, content: Uint8Array): Thenable; - - /** - * Delete a file. - * - * @param uri The resource that is to be deleted. - * @param options Defines if trash can should be used and if deletion of folders is recursive - */ - delete( - uri: Uri, - options?: { - /** - * Delete the content recursively if a folder is denoted. - */ - recursive?: boolean; - /** - * Use the os's trashcan instead of permanently deleting files whenever possible. - */ - useTrash?: boolean; - }, - ): Thenable; - - /** - * Rename a file or folder. - * - * @param source The existing file. - * @param target The new location. - * @param options Defines if existing files should be overwritten. - */ - rename( - source: Uri, - target: Uri, - options?: { - /** - * Overwrite the file if it does exist. - */ - overwrite?: boolean; - }, - ): Thenable; - - /** - * Copy files or folders. - * - * @param source The existing file. - * @param target The destination location. - * @param options Defines if existing files should be overwritten. - */ - copy( - source: Uri, - target: Uri, - options?: { - /** - * Overwrite the file if it does exist. - */ - overwrite?: boolean; - }, - ): Thenable; - - /** - * Check if a given file system supports writing files. - * - * Keep in mind that just because a file system supports writing, that does - * not mean that writes will always succeed. There may be permissions issues - * or other errors that prevent writing a file. - * - * @param scheme The scheme of the filesystem, for example `file` or `git`. - * - * @returns `true` if the file system supports writing, `false` if it does not - * support writing (i.e. it is readonly), and `undefined` if the editor does not - * know about the filesystem. - */ - isWritableFileSystem(scheme: string): boolean | undefined; - } - - /** - * Defines a port mapping used for localhost inside the webview. - */ - export interface WebviewPortMapping { - /** - * Localhost port to remap inside the webview. - */ - readonly webviewPort: number; - - /** - * Destination port. The `webviewPort` is resolved to this port. - */ - readonly extensionHostPort: number; - } - - /** - * Content settings for a webview. - */ - export interface WebviewOptions { - /** - * Controls whether scripts are enabled in the webview content or not. - * - * Defaults to false (scripts-disabled). - */ - readonly enableScripts?: boolean; - - /** - * Controls whether forms are enabled in the webview content or not. - * - * Defaults to true if {@link WebviewOptions.enableScripts scripts are enabled}. Otherwise defaults to false. - * Explicitly setting this property to either true or false overrides the default. - */ - readonly enableForms?: boolean; - - /** - * Controls whether command uris are enabled in webview content or not. - * - * Defaults to `false` (command uris are disabled). - * - * If you pass in an array, only the commands in the array are allowed. - */ - readonly enableCommandUris?: boolean | readonly string[]; - - /** - * Root paths from which the webview can load local (filesystem) resources using uris from `asWebviewUri` - * - * Default to the root folders of the current workspace plus the extension's install directory. - * - * Pass in an empty array to disallow access to any local resources. - */ - readonly localResourceRoots?: readonly Uri[]; - - /** - * Mappings of localhost ports used inside the webview. - * - * Port mapping allow webviews to transparently define how localhost ports are resolved. This can be used - * to allow using a static localhost port inside the webview that is resolved to random port that a service is - * running on. - * - * If a webview accesses localhost content, we recommend that you specify port mappings even if - * the `webviewPort` and `extensionHostPort` ports are the same. - * - * *Note* that port mappings only work for `http` or `https` urls. Websocket urls (e.g. `ws://localhost:3000`) - * cannot be mapped to another port. - */ - readonly portMapping?: readonly WebviewPortMapping[]; - } - - /** - * Displays html content, similarly to an iframe. - */ - export interface Webview { - /** - * Content settings for the webview. - */ - options: WebviewOptions; - - /** - * HTML contents of the webview. - * - * This should be a complete, valid html document. Changing this property causes the webview to be reloaded. - * - * Webviews are sandboxed from normal extension process, so all communication with the webview must use - * message passing. To send a message from the extension to the webview, use {@linkcode Webview.postMessage postMessage}. - * To send message from the webview back to an extension, use the `acquireVsCodeApi` function inside the webview - * to get a handle to the editor's api and then call `.postMessage()`: - * - * ```html - * - * ``` - * - * To load a resources from the workspace inside a webview, use the {@linkcode Webview.asWebviewUri asWebviewUri} method - * and ensure the resource's directory is listed in {@linkcode WebviewOptions.localResourceRoots}. - * - * Keep in mind that even though webviews are sandboxed, they still allow running scripts and loading arbitrary content, - * so extensions must follow all standard web security best practices when working with webviews. This includes - * properly sanitizing all untrusted input (including content from the workspace) and - * setting a [content security policy](https://aka.ms/vscode-api-webview-csp). - */ - html: string; - - /** - * Fired when the webview content posts a message. - * - * Webview content can post strings or json serializable objects back to an extension. They cannot - * post `Blob`, `File`, `ImageData` and other DOM specific objects since the extension that receives the - * message does not run in a browser environment. - */ - readonly onDidReceiveMessage: Event; - - /** - * Post a message to the webview content. - * - * Messages are only delivered if the webview is live (either visible or in the - * background with `retainContextWhenHidden`). - * - * @param message Body of the message. This must be a string or other json serializable object. - * - * For older versions of vscode, if an `ArrayBuffer` is included in `message`, - * it will not be serialized properly and will not be received by the webview. - * Similarly any TypedArrays, such as a `Uint8Array`, will be very inefficiently - * serialized and will also not be recreated as a typed array inside the webview. - * - * However if your extension targets vscode 1.57+ in the `engines` field of its - * `package.json`, any `ArrayBuffer` values that appear in `message` will be more - * efficiently transferred to the webview and will also be correctly recreated inside - * of the webview. - * - * @returns A promise that resolves when the message is posted to a webview or when it is - * dropped because the message was not deliverable. - * - * Returns `true` if the message was posted to the webview. Messages can only be posted to - * live webviews (i.e. either visible webviews or hidden webviews that set `retainContextWhenHidden`). - * - * A response of `true` does not mean that the message was actually received by the webview. - * For example, no message listeners may be have been hooked up inside the webview or the webview may - * have been destroyed after the message was posted but before it was received. - * - * If you want confirm that a message as actually received, you can try having your webview posting a - * confirmation message back to your extension. - */ - postMessage(message: any): Thenable; - - /** - * Convert a uri for the local file system to one that can be used inside webviews. - * - * Webviews cannot directly load resources from the workspace or local file system using `file:` uris. The - * `asWebviewUri` function takes a local `file:` uri and converts it into a uri that can be used inside of - * a webview to load the same resource: - * - * ```ts - * webview.html = `` - * ``` - */ - asWebviewUri(localResource: Uri): Uri; - - /** - * Content security policy source for webview resources. - * - * This is the origin that should be used in a content security policy rule: - * - * ```ts - * `img-src https: ${webview.cspSource} ...;` - * ``` - */ - readonly cspSource: string; - } - - /** - * Content settings for a webview panel. - */ - export interface WebviewPanelOptions { - /** - * Controls if the find widget is enabled in the panel. - * - * Defaults to `false`. - */ - readonly enableFindWidget?: boolean; - - /** - * Controls if the webview panel's content (iframe) is kept around even when the panel - * is no longer visible. - * - * Normally the webview panel's html context is created when the panel becomes visible - * and destroyed when it is hidden. Extensions that have complex state - * or UI can set the `retainContextWhenHidden` to make the editor keep the webview - * context around, even when the webview moves to a background tab. When a webview using - * `retainContextWhenHidden` becomes hidden, its scripts and other dynamic content are suspended. - * When the panel becomes visible again, the context is automatically restored - * in the exact same state it was in originally. You cannot send messages to a - * hidden webview, even with `retainContextWhenHidden` enabled. - * - * `retainContextWhenHidden` has a high memory overhead and should only be used if - * your panel's context cannot be quickly saved and restored. - */ - readonly retainContextWhenHidden?: boolean; - } - - /** - * A panel that contains a webview. - */ - interface WebviewPanel { - /** - * Identifies the type of the webview panel, such as `'markdown.preview'`. - */ - readonly viewType: string; - - /** - * Title of the panel shown in UI. - */ - title: string; - - /** - * Icon for the panel shown in UI. - */ - iconPath?: - | Uri - | { - /** - * The icon path for the light theme. - */ - readonly light: Uri; - /** - * The icon path for the dark theme. - */ - readonly dark: Uri; - }; - - /** - * {@linkcode Webview} belonging to the panel. - */ - readonly webview: Webview; - - /** - * Content settings for the webview panel. - */ - readonly options: WebviewPanelOptions; - - /** - * Editor position of the panel. This property is only set if the webview is in - * one of the editor view columns. - */ - readonly viewColumn: ViewColumn | undefined; - - /** - * Whether the panel is active (focused by the user). - */ - readonly active: boolean; - - /** - * Whether the panel is visible. - */ - readonly visible: boolean; - - /** - * Fired when the panel's view state changes. - */ - readonly onDidChangeViewState: Event; - - /** - * Fired when the panel is disposed. - * - * This may be because the user closed the panel or because `.dispose()` was - * called on it. - * - * Trying to use the panel after it has been disposed throws an exception. - */ - readonly onDidDispose: Event; - - /** - * Show the webview panel in a given column. - * - * A webview panel may only show in a single column at a time. If it is already showing, this - * method moves it to a new column. - * - * @param viewColumn View column to show the panel in. Shows in the current `viewColumn` if undefined. - * @param preserveFocus When `true`, the webview will not take focus. - */ - reveal(viewColumn?: ViewColumn, preserveFocus?: boolean): void; - - /** - * Dispose of the webview panel. - * - * This closes the panel if it showing and disposes of the resources owned by the webview. - * Webview panels are also disposed when the user closes the webview panel. Both cases - * fire the `onDispose` event. - */ - dispose(): any; - } - - /** - * Event fired when a webview panel's view state changes. - */ - export interface WebviewPanelOnDidChangeViewStateEvent { - /** - * Webview panel whose view state changed. - */ - readonly webviewPanel: WebviewPanel; - } - - /** - * Restore webview panels that have been persisted when vscode shuts down. - * - * There are two types of webview persistence: - * - * - Persistence within a session. - * - Persistence across sessions (across restarts of the editor). - * - * A `WebviewPanelSerializer` is only required for the second case: persisting a webview across sessions. - * - * Persistence within a session allows a webview to save its state when it becomes hidden - * and restore its content from this state when it becomes visible again. It is powered entirely - * by the webview content itself. To save off a persisted state, call `acquireVsCodeApi().setState()` with - * any json serializable object. To restore the state again, call `getState()` - * - * ```js - * // Within the webview - * const vscode = acquireVsCodeApi(); - * - * // Get existing state - * const oldState = vscode.getState() || { value: 0 }; - * - * // Update state - * setState({ value: oldState.value + 1 }) - * ``` - * - * A `WebviewPanelSerializer` extends this persistence across restarts of the editor. When the editor is shutdown, - * it will save off the state from `setState` of all webviews that have a serializer. When the - * webview first becomes visible after the restart, this state is passed to `deserializeWebviewPanel`. - * The extension can then restore the old `WebviewPanel` from this state. - * - * @param T Type of the webview's state. - */ - interface WebviewPanelSerializer { - /** - * Restore a webview panel from its serialized `state`. - * - * Called when a serialized webview first becomes visible. - * - * @param webviewPanel Webview panel to restore. The serializer should take ownership of this panel. The - * serializer must restore the webview's `.html` and hook up all webview events. - * @param state Persisted state from the webview content. - * - * @returns Thenable indicating that the webview has been fully restored. - */ - deserializeWebviewPanel( - webviewPanel: WebviewPanel, - state: T, - ): Thenable; - } - - /** - * A webview based view. - */ - export interface WebviewView { - /** - * Identifies the type of the webview view, such as `'hexEditor.dataView'`. - */ - readonly viewType: string; - - /** - * The underlying webview for the view. - */ - readonly webview: Webview; - - /** - * View title displayed in the UI. - * - * The view title is initially taken from the extension `package.json` contribution. - */ - title?: string; - - /** - * Human-readable string which is rendered less prominently in the title. - */ - description?: string; - - /** - * The badge to display for this webview view. - * To remove the badge, set to undefined. - */ - badge?: ViewBadge | undefined; - - /** - * Event fired when the view is disposed. - * - * Views are disposed when they are explicitly hidden by a user (this happens when a user - * right clicks in a view and unchecks the webview view). - * - * Trying to use the view after it has been disposed throws an exception. - */ - readonly onDidDispose: Event; - - /** - * Tracks if the webview is currently visible. - * - * Views are visible when they are on the screen and expanded. - */ - readonly visible: boolean; - - /** - * Event fired when the visibility of the view changes. - * - * Actions that trigger a visibility change: - * - * - The view is collapsed or expanded. - * - The user switches to a different view group in the sidebar or panel. - * - * Note that hiding a view using the context menu instead disposes of the view and fires `onDidDispose`. - */ - readonly onDidChangeVisibility: Event; - - /** - * Reveal the view in the UI. - * - * If the view is collapsed, this will expand it. - * - * @param preserveFocus When `true` the view will not take focus. - */ - show(preserveFocus?: boolean): void; - } - - /** - * Additional information the webview view being resolved. - * - * @param T Type of the webview's state. - */ - interface WebviewViewResolveContext { - /** - * Persisted state from the webview content. - * - * To save resources, the editor normally deallocates webview documents (the iframe content) that are not visible. - * For example, when the user collapse a view or switches to another top level activity in the sidebar, the - * `WebviewView` itself is kept alive but the webview's underlying document is deallocated. It is recreated when - * the view becomes visible again. - * - * You can prevent this behavior by setting `retainContextWhenHidden` in the `WebviewOptions`. However this - * increases resource usage and should be avoided wherever possible. Instead, you can use persisted state to - * save off a webview's state so that it can be quickly recreated as needed. - * - * To save off a persisted state, inside the webview call `acquireVsCodeApi().setState()` with - * any json serializable object. To restore the state again, call `getState()`. For example: - * - * ```js - * // Within the webview - * const vscode = acquireVsCodeApi(); - * - * // Get existing state - * const oldState = vscode.getState() || { value: 0 }; - * - * // Update state - * setState({ value: oldState.value + 1 }) - * ``` - * - * The editor ensures that the persisted state is saved correctly when a webview is hidden and across - * editor restarts. - */ - readonly state: T | undefined; - } - - /** - * Provider for creating `WebviewView` elements. - */ - export interface WebviewViewProvider { - /** - * Resolves a webview view. - * - * `resolveWebviewView` is called when a view first becomes visible. This may happen when the view is - * first loaded or when the user hides and then shows a view again. - * - * @param webviewView Webview view to restore. The provider should take ownership of this view. The - * provider must set the webview's `.html` and hook up all webview events it is interested in. - * @param context Additional metadata about the view being resolved. - * @param token Cancellation token indicating that the view being provided is no longer needed. - * - * @returns Optional thenable indicating that the view has been fully resolved. - */ - resolveWebviewView( - webviewView: WebviewView, - context: WebviewViewResolveContext, - token: CancellationToken, - ): Thenable | void; - } - - /** - * Provider for text based custom editors. - * - * Text based custom editors use a {@linkcode TextDocument} as their data model. This considerably simplifies - * implementing a custom editor as it allows the editor to handle many common operations such as - * undo and backup. The provider is responsible for synchronizing text changes between the webview and the `TextDocument`. - */ - export interface CustomTextEditorProvider { - /** - * Resolve a custom editor for a given text resource. - * - * This is called when a user first opens a resource for a `CustomTextEditorProvider`, or if they reopen an - * existing editor using this `CustomTextEditorProvider`. - * - * - * @param document Document for the resource to resolve. - * - * @param webviewPanel The webview panel used to display the editor UI for this resource. - * - * During resolve, the provider must fill in the initial html for the content webview panel and hook up all - * the event listeners on it that it is interested in. The provider can also hold onto the `WebviewPanel` to - * use later for example in a command. See {@linkcode WebviewPanel} for additional details. - * - * @param token A cancellation token that indicates the result is no longer needed. - * - * @returns Thenable indicating that the custom editor has been resolved. - */ - resolveCustomTextEditor( - document: TextDocument, - webviewPanel: WebviewPanel, - token: CancellationToken, - ): Thenable | void; - } - - /** - * Represents a custom document used by a {@linkcode CustomEditorProvider}. - * - * Custom documents are only used within a given `CustomEditorProvider`. The lifecycle of a `CustomDocument` is - * managed by the editor. When no more references remain to a `CustomDocument`, it is disposed of. - */ - interface CustomDocument { - /** - * The associated uri for this document. - */ - readonly uri: Uri; - - /** - * Dispose of the custom document. - * - * This is invoked by the editor when there are no more references to a given `CustomDocument` (for example when - * all editors associated with the document have been closed.) - */ - dispose(): void; - } - - /** - * Event triggered by extensions to signal to the editor that an edit has occurred on an {@linkcode CustomDocument}. - * - * @see {@linkcode CustomEditorProvider.onDidChangeCustomDocument}. - */ - interface CustomDocumentEditEvent< - T extends CustomDocument = CustomDocument, - > { - /** - * The document that the edit is for. - */ - readonly document: T; - - /** - * Undo the edit operation. - * - * This is invoked by the editor when the user undoes this edit. To implement `undo`, your - * extension should restore the document and editor to the state they were in just before this - * edit was added to the editor's internal edit stack by `onDidChangeCustomDocument`. - */ - undo(): Thenable | void; - - /** - * Redo the edit operation. - * - * This is invoked by the editor when the user redoes this edit. To implement `redo`, your - * extension should restore the document and editor to the state they were in just after this - * edit was added to the editor's internal edit stack by `onDidChangeCustomDocument`. - */ - redo(): Thenable | void; - - /** - * Display name describing the edit. - * - * This will be shown to users in the UI for undo/redo operations. - */ - readonly label?: string; - } - - /** - * Event triggered by extensions to signal to the editor that the content of a {@linkcode CustomDocument} - * has changed. - * - * @see {@linkcode CustomEditorProvider.onDidChangeCustomDocument}. - */ - interface CustomDocumentContentChangeEvent< - T extends CustomDocument = CustomDocument, - > { - /** - * The document that the change is for. - */ - readonly document: T; - } - - /** - * A backup for an {@linkcode CustomDocument}. - */ - interface CustomDocumentBackup { - /** - * Unique identifier for the backup. - * - * This id is passed back to your extension in `openCustomDocument` when opening a custom editor from a backup. - */ - readonly id: string; - - /** - * Delete the current backup. - * - * This is called by the editor when it is clear the current backup is no longer needed, such as when a new backup - * is made or when the file is saved. - */ - delete(): void; - } - - /** - * Additional information used to implement {@linkcode CustomDocumentBackup}. - */ - interface CustomDocumentBackupContext { - /** - * Suggested file location to write the new backup. - * - * Note that your extension is free to ignore this and use its own strategy for backup. - * - * If the editor is for a resource from the current workspace, `destination` will point to a file inside - * `ExtensionContext.storagePath`. The parent folder of `destination` may not exist, so make sure to created it - * before writing the backup to this location. - */ - readonly destination: Uri; - } - - /** - * Additional information about the opening custom document. - */ - interface CustomDocumentOpenContext { - /** - * The id of the backup to restore the document from or `undefined` if there is no backup. - * - * If this is provided, your extension should restore the editor from the backup instead of reading the file - * from the user's workspace. - */ - readonly backupId: string | undefined; - - /** - * If the URI is an untitled file, this will be populated with the byte data of that file - * - * If this is provided, your extension should utilize this byte data rather than executing fs APIs on the URI passed in - */ - readonly untitledDocumentData: Uint8Array | undefined; - } - - /** - * Provider for readonly custom editors that use a custom document model. - * - * Custom editors use {@linkcode CustomDocument} as their document model instead of a {@linkcode TextDocument}. - * - * You should use this type of custom editor when dealing with binary files or more complex scenarios. For simple - * text based documents, use {@linkcode CustomTextEditorProvider} instead. - * - * @param T Type of the custom document returned by this provider. - */ - export interface CustomReadonlyEditorProvider< - T extends CustomDocument = CustomDocument, - > { - /** - * Create a new document for a given resource. - * - * `openCustomDocument` is called when the first time an editor for a given resource is opened. The opened - * document is then passed to `resolveCustomEditor` so that the editor can be shown to the user. - * - * Already opened `CustomDocument` are re-used if the user opened additional editors. When all editors for a - * given resource are closed, the `CustomDocument` is disposed of. Opening an editor at this point will - * trigger another call to `openCustomDocument`. - * - * @param uri Uri of the document to open. - * @param openContext Additional information about the opening custom document. - * @param token A cancellation token that indicates the result is no longer needed. - * - * @returns The custom document. - */ - openCustomDocument( - uri: Uri, - openContext: CustomDocumentOpenContext, - token: CancellationToken, - ): Thenable | T; - - /** - * Resolve a custom editor for a given resource. - * - * This is called whenever the user opens a new editor for this `CustomEditorProvider`. - * - * @param document Document for the resource being resolved. - * - * @param webviewPanel The webview panel used to display the editor UI for this resource. - * - * During resolve, the provider must fill in the initial html for the content webview panel and hook up all - * the event listeners on it that it is interested in. The provider can also hold onto the `WebviewPanel` to - * use later for example in a command. See {@linkcode WebviewPanel} for additional details. - * - * @param token A cancellation token that indicates the result is no longer needed. - * - * @returns Optional thenable indicating that the custom editor has been resolved. - */ - resolveCustomEditor( - document: T, - webviewPanel: WebviewPanel, - token: CancellationToken, - ): Thenable | void; - } - - /** - * Provider for editable custom editors that use a custom document model. - * - * Custom editors use {@linkcode CustomDocument} as their document model instead of a {@linkcode TextDocument}. - * This gives extensions full control over actions such as edit, save, and backup. - * - * You should use this type of custom editor when dealing with binary files or more complex scenarios. For simple - * text based documents, use {@linkcode CustomTextEditorProvider} instead. - * - * @param T Type of the custom document returned by this provider. - */ - export interface CustomEditorProvider< - T extends CustomDocument = CustomDocument, - > extends CustomReadonlyEditorProvider { - /** - * Signal that an edit has occurred inside a custom editor. - * - * This event must be fired by your extension whenever an edit happens in a custom editor. An edit can be - * anything from changing some text, to cropping an image, to reordering a list. Your extension is free to - * define what an edit is and what data is stored on each edit. - * - * Firing `onDidChange` causes the editors to be marked as being dirty. This is cleared when the user either - * saves or reverts the file. - * - * Editors that support undo/redo must fire a `CustomDocumentEditEvent` whenever an edit happens. This allows - * users to undo and redo the edit using the editor's standard keyboard shortcuts. The editor will also mark - * the editor as no longer being dirty if the user undoes all edits to the last saved state. - * - * Editors that support editing but cannot use the editor's standard undo/redo mechanism must fire a `CustomDocumentContentChangeEvent`. - * The only way for a user to clear the dirty state of an editor that does not support undo/redo is to either - * `save` or `revert` the file. - * - * An editor should only ever fire `CustomDocumentEditEvent` events, or only ever fire `CustomDocumentContentChangeEvent` events. - */ - readonly onDidChangeCustomDocument: - | Event> - | Event>; - - /** - * Save a custom document. - * - * This method is invoked by the editor when the user saves a custom editor. This can happen when the user - * triggers save while the custom editor is active, by commands such as `save all`, or by auto save if enabled. - * - * To implement `save`, the implementer must persist the custom editor. This usually means writing the - * file data for the custom document to disk. After `save` completes, any associated editor instances will - * no longer be marked as dirty. - * - * @param document Document to save. - * @param cancellation Token that signals the save is no longer required (for example, if another save was triggered). - * - * @returns Thenable signaling that saving has completed. - */ - saveCustomDocument( - document: T, - cancellation: CancellationToken, - ): Thenable; - - /** - * Save a custom document to a different location. - * - * This method is invoked by the editor when the user triggers 'save as' on a custom editor. The implementer must - * persist the custom editor to `destination`. - * - * When the user accepts save as, the current editor is be replaced by an non-dirty editor for the newly saved file. - * - * @param document Document to save. - * @param destination Location to save to. - * @param cancellation Token that signals the save is no longer required. - * - * @returns Thenable signaling that saving has completed. - */ - saveCustomDocumentAs( - document: T, - destination: Uri, - cancellation: CancellationToken, - ): Thenable; - - /** - * Revert a custom document to its last saved state. - * - * This method is invoked by the editor when the user triggers `File: Revert File` in a custom editor. (Note that - * this is only used using the editor's `File: Revert File` command and not on a `git revert` of the file). - * - * To implement `revert`, the implementer must make sure all editor instances (webviews) for `document` - * are displaying the document in the same state is saved in. This usually means reloading the file from the - * workspace. - * - * @param document Document to revert. - * @param cancellation Token that signals the revert is no longer required. - * - * @returns Thenable signaling that the change has completed. - */ - revertCustomDocument( - document: T, - cancellation: CancellationToken, - ): Thenable; - - /** - * Back up a dirty custom document. - * - * Backups are used for hot exit and to prevent data loss. Your `backup` method should persist the resource in - * its current state, i.e. with the edits applied. Most commonly this means saving the resource to disk in - * the `ExtensionContext.storagePath`. When the editor reloads and your custom editor is opened for a resource, - * your extension should first check to see if any backups exist for the resource. If there is a backup, your - * extension should load the file contents from there instead of from the resource in the workspace. - * - * `backup` is triggered approximately one second after the user stops editing the document. If the user - * rapidly edits the document, `backup` will not be invoked until the editing stops. - * - * `backup` is not invoked when `auto save` is enabled (since auto save already persists the resource). - * - * @param document Document to backup. - * @param context Information that can be used to backup the document. - * @param cancellation Token that signals the current backup since a new backup is coming in. It is up to your - * extension to decided how to respond to cancellation. If for example your extension is backing up a large file - * in an operation that takes time to complete, your extension may decide to finish the ongoing backup rather - * than cancelling it to ensure that the editor has some valid backup. - */ - backupCustomDocument( - document: T, - context: CustomDocumentBackupContext, - cancellation: CancellationToken, - ): Thenable; - } - - /** - * The clipboard provides read and write access to the system's clipboard. - */ - export interface Clipboard { - /** - * Read the current clipboard contents as text. - * @returns A thenable that resolves to a string. - */ - readText(): Thenable; - - /** - * Writes text into the clipboard. - * @returns A thenable that resolves when writing happened. - */ - writeText(value: string): Thenable; - } - - /** - * Possible kinds of UI that can use extensions. - */ - export enum UIKind { - /** - * Extensions are accessed from a desktop application. - */ - Desktop = 1, - - /** - * Extensions are accessed from a web browser. - */ - Web = 2, - } - - /** - * Log levels - */ - export enum LogLevel { - /** - * No messages are logged with this level. - */ - Off = 0, - - /** - * All messages are logged with this level. - */ - Trace = 1, - - /** - * Messages with debug and higher log level are logged with this level. - */ - Debug = 2, - - /** - * Messages with info and higher log level are logged with this level. - */ - Info = 3, - - /** - * Messages with warning and higher log level are logged with this level. - */ - Warning = 4, - - /** - * Only error messages are logged with this level. - */ - Error = 5, - } - - /** - * Namespace describing the environment the editor runs in. - */ - export namespace env { - /** - * The application name of the editor, like 'VS Code'. - */ - export const appName: string; - - /** - * The application root folder from which the editor is running. - * - * *Note* that the value is the empty string when running in an - * environment that has no representation of an application root folder. - */ - export const appRoot: string; - - /** - * The hosted location of the application - * On desktop this is 'desktop' - * In the web this is the specified embedder i.e. 'github.dev', 'codespaces', or 'web' if the embedder - * does not provide that information - */ - export const appHost: string; - - /** - * The custom uri scheme the editor registers to in the operating system. - */ - export const uriScheme: string; - - /** - * Represents the preferred user-language, like `de-CH`, `fr`, or `en-US`. - */ - export const language: string; - - /** - * The system clipboard. - */ - export const clipboard: Clipboard; - - /** - * A unique identifier for the computer. - */ - export const machineId: string; - - /** - * A unique identifier for the current session. - * Changes each time the editor is started. - */ - export const sessionId: string; - - /** - * Indicates that this is a fresh install of the application. - * `true` if within the first day of installation otherwise `false`. - */ - export const isNewAppInstall: boolean; - - /** - * Indicates whether the users has telemetry enabled. - * Can be observed to determine if the extension should send telemetry. - */ - export const isTelemetryEnabled: boolean; - - /** - * An {@link Event} which fires when the user enabled or disables telemetry. - * `true` if the user has enabled telemetry or `false` if the user has disabled telemetry. - */ - export const onDidChangeTelemetryEnabled: Event; - - /** - * An {@link Event} which fires when the default shell changes. This fires with the new - * shell path. - */ - export const onDidChangeShell: Event; - - /** - * Creates a new {@link TelemetryLogger telemetry logger}. - * - * @param sender The telemetry sender that is used by the telemetry logger. - * @param options Options for the telemetry logger. - * @returns A new telemetry logger - */ - export function createTelemetryLogger( - sender: TelemetrySender, - options?: TelemetryLoggerOptions, - ): TelemetryLogger; - - /** - * The name of a remote. Defined by extensions, popular samples are `wsl` for the Windows - * Subsystem for Linux or `ssh-remote` for remotes using a secure shell. - * - * *Note* that the value is `undefined` when there is no remote extension host but that the - * value is defined in all extension hosts (local and remote) in case a remote extension host - * exists. Use {@link Extension.extensionKind} to know if - * a specific extension runs remote or not. - */ - export const remoteName: string | undefined; - - /** - * The detected default shell for the extension host, this is overridden by the - * `terminal.integrated.defaultProfile` setting for the extension host's platform. Note that in - * environments that do not support a shell the value is the empty string. - */ - export const shell: string; - - /** - * The UI kind property indicates from which UI extensions - * are accessed from. For example, extensions could be accessed - * from a desktop application or a web browser. - */ - export const uiKind: UIKind; - - /** - * Opens a link externally using the default application. Depending on the - * used scheme this can be: - * * a browser (`http:`, `https:`) - * * a mail client (`mailto:`) - * * VSCode itself (`vscode:` from `vscode.env.uriScheme`) - * - * *Note* that {@linkcode window.showTextDocument showTextDocument} is the right - * way to open a text document inside the editor, not this function. - * - * @param target The uri that should be opened. - * @returns A promise indicating if open was successful. - */ - export function openExternal(target: Uri): Thenable; - - /** - * Resolves a uri to a form that is accessible externally. - * - * #### `http:` or `https:` scheme - * - * Resolves an *external* uri, such as a `http:` or `https:` link, from where the extension is running to a - * uri to the same resource on the client machine. - * - * This is a no-op if the extension is running on the client machine. - * - * If the extension is running remotely, this function automatically establishes a port forwarding tunnel - * from the local machine to `target` on the remote and returns a local uri to the tunnel. The lifetime of - * the port forwarding tunnel is managed by the editor and the tunnel can be closed by the user. - * - * *Note* that uris passed through `openExternal` are automatically resolved and you should not call `asExternalUri` on them. - * - * #### `vscode.env.uriScheme` - * - * Creates a uri that - if opened in a browser (e.g. via `openExternal`) - will result in a registered {@link UriHandler} - * to trigger. - * - * Extensions should not make any assumptions about the resulting uri and should not alter it in any way. - * Rather, extensions can e.g. use this uri in an authentication flow, by adding the uri as callback query - * argument to the server to authenticate to. - * - * *Note* that if the server decides to add additional query parameters to the uri (e.g. a token or secret), it - * will appear in the uri that is passed to the {@link UriHandler}. - * - * **Example** of an authentication flow: - * ```typescript - * vscode.window.registerUriHandler({ - * handleUri(uri: vscode.Uri): vscode.ProviderResult { - * if (uri.path === '/did-authenticate') { - * console.log(uri.toString()); - * } - * } - * }); - * - * const callableUri = await vscode.env.asExternalUri(vscode.Uri.parse(vscode.env.uriScheme + '://my.extension/did-authenticate')); - * await vscode.env.openExternal(callableUri); - * ``` - * - * *Note* that extensions should not cache the result of `asExternalUri` as the resolved uri may become invalid due to - * a system or user action — for example, in remote cases, a user may close a port forwarding tunnel that was opened by - * `asExternalUri`. - * - * #### Any other scheme - * - * Any other scheme will be handled as if the provided URI is a workspace URI. In that case, the method will return - * a URI which, when handled, will make the editor open the workspace. - * - * @returns A uri that can be used on the client machine. - */ - export function asExternalUri(target: Uri): Thenable; - - /** - * The current log level of the editor. - */ - export const logLevel: LogLevel; - - /** - * An {@link Event} which fires when the log level of the editor changes. - */ - export const onDidChangeLogLevel: Event; - } - - /** - * Namespace for dealing with commands. In short, a command is a function with a - * unique identifier. The function is sometimes also called _command handler_. - * - * Commands can be added to the editor using the {@link commands.registerCommand registerCommand} - * and {@link commands.registerTextEditorCommand registerTextEditorCommand} functions. Commands - * can be executed {@link commands.executeCommand manually} or from a UI gesture. Those are: - * - * * palette - Use the `commands`-section in `package.json` to make a command show in - * the [command palette](https://code.visualstudio.com/docs/getstarted/userinterface#_command-palette). - * * keybinding - Use the `keybindings`-section in `package.json` to enable - * [keybindings](https://code.visualstudio.com/docs/getstarted/keybindings#_advanced-customization) - * for your extension. - * - * Commands from other extensions and from the editor itself are accessible to an extension. However, - * when invoking an editor command not all argument types are supported. - * - * This is a sample that registers a command handler and adds an entry for that command to the palette. First - * register a command handler with the identifier `extension.sayHello`. - * ```javascript - * commands.registerCommand('extension.sayHello', () => { - * window.showInformationMessage('Hello World!'); - * }); - * ``` - * Second, bind the command identifier to a title under which it will show in the palette (`package.json`). - * ```json - * { - * "contributes": { - * "commands": [{ - * "command": "extension.sayHello", - * "title": "Hello World" - * }] - * } - * } - * ``` - */ - export namespace commands { - /** - * Registers a command that can be invoked via a keyboard shortcut, - * a menu item, an action, or directly. - * - * Registering a command with an existing command identifier twice - * will cause an error. - * - * @param command A unique identifier for the command. - * @param callback A command handler function. - * @param thisArg The `this` context used when invoking the handler function. - * @returns Disposable which unregisters this command on disposal. - */ - export function registerCommand( - command: string, - callback: (...args: any[]) => any, - thisArg?: any, - ): Disposable; - - /** - * Registers a text editor command that can be invoked via a keyboard shortcut, - * a menu item, an action, or directly. - * - * Text editor commands are different from ordinary {@link commands.registerCommand commands} as - * they only execute when there is an active editor when the command is called. Also, the - * command handler of an editor command has access to the active editor and to an - * {@link TextEditorEdit edit}-builder. Note that the edit-builder is only valid while the - * callback executes. - * - * @param command A unique identifier for the command. - * @param callback A command handler function with access to an {@link TextEditor editor} and an {@link TextEditorEdit edit}. - * @param thisArg The `this` context used when invoking the handler function. - * @returns Disposable which unregisters this command on disposal. - */ - export function registerTextEditorCommand( - command: string, - callback: ( - textEditor: TextEditor, - edit: TextEditorEdit, - ...args: any[] - ) => void, - thisArg?: any, - ): Disposable; - - /** - * Executes the command denoted by the given command identifier. - * - * * *Note 1:* When executing an editor command not all types are allowed to - * be passed as arguments. Allowed are the primitive types `string`, `boolean`, - * `number`, `undefined`, and `null`, as well as {@linkcode Position}, {@linkcode Range}, {@linkcode Uri} and {@linkcode Location}. - * * *Note 2:* There are no restrictions when executing commands that have been contributed - * by extensions. - * - * @param command Identifier of the command to execute. - * @param rest Parameters passed to the command function. - * @returns A thenable that resolves to the returned value of the given command. Returns `undefined` when - * the command handler function doesn't return anything. - */ - export function executeCommand( - command: string, - ...rest: any[] - ): Thenable; - - /** - * Retrieve the list of all available commands. Commands starting with an underscore are - * treated as internal commands. - * - * @param filterInternal Set `true` to not see internal commands (starting with an underscore) - * @returns Thenable that resolves to a list of command ids. - */ - export function getCommands( - filterInternal?: boolean, - ): Thenable; - } - - /** - * Represents the state of a window. - */ - export interface WindowState { - /** - * Whether the current window is focused. - */ - readonly focused: boolean; - - /** - * Whether the window has been interacted with recently. This will change - * immediately on activity, or after a short time of user inactivity. - */ - readonly active: boolean; - } - - /** - * A uri handler is responsible for handling system-wide {@link Uri uris}. - * - * @see {@link window.registerUriHandler}. - */ - export interface UriHandler { - /** - * Handle the provided system-wide {@link Uri}. - * - * @see {@link window.registerUriHandler}. - */ - handleUri(uri: Uri): ProviderResult; - } - - /** - * Namespace for dealing with the current window of the editor. That is visible - * and active editors, as well as, UI elements to show messages, selections, and - * asking for user input. - */ - export namespace window { - /** - * Represents the grid widget within the main editor area - */ - export const tabGroups: TabGroups; - - /** - * The currently active editor or `undefined`. The active editor is the one - * that currently has focus or, when none has focus, the one that has changed - * input most recently. - */ - export let activeTextEditor: TextEditor | undefined; - - /** - * The currently visible editors or an empty array. - */ - export let visibleTextEditors: readonly TextEditor[]; - - /** - * An {@link Event} which fires when the {@link window.activeTextEditor active editor} - * has changed. *Note* that the event also fires when the active editor changes - * to `undefined`. - */ - export const onDidChangeActiveTextEditor: Event; - - /** - * An {@link Event} which fires when the array of {@link window.visibleTextEditors visible editors} - * has changed. - */ - export const onDidChangeVisibleTextEditors: Event< - readonly TextEditor[] - >; - - /** - * An {@link Event} which fires when the selection in an editor has changed. - */ - export const onDidChangeTextEditorSelection: Event; - - /** - * An {@link Event} which fires when the visible ranges of an editor has changed. - */ - export const onDidChangeTextEditorVisibleRanges: Event; - - /** - * An {@link Event} which fires when the options of an editor have changed. - */ - export const onDidChangeTextEditorOptions: Event; - - /** - * An {@link Event} which fires when the view column of an editor has changed. - */ - export const onDidChangeTextEditorViewColumn: Event; - - /** - * The currently visible {@link NotebookEditor notebook editors} or an empty array. - */ - export const visibleNotebookEditors: readonly NotebookEditor[]; - - /** - * An {@link Event} which fires when the {@link window.visibleNotebookEditors visible notebook editors} - * has changed. - */ - export const onDidChangeVisibleNotebookEditors: Event< - readonly NotebookEditor[] - >; - - /** - * The currently active {@link NotebookEditor notebook editor} or `undefined`. The active editor is the one - * that currently has focus or, when none has focus, the one that has changed - * input most recently. - */ - export const activeNotebookEditor: NotebookEditor | undefined; - - /** - * An {@link Event} which fires when the {@link window.activeNotebookEditor active notebook editor} - * has changed. *Note* that the event also fires when the active editor changes - * to `undefined`. - */ - export const onDidChangeActiveNotebookEditor: Event< - NotebookEditor | undefined - >; - - /** - * An {@link Event} which fires when the {@link NotebookEditor.selections notebook editor selections} - * have changed. - */ - export const onDidChangeNotebookEditorSelection: Event; - - /** - * An {@link Event} which fires when the {@link NotebookEditor.visibleRanges notebook editor visible ranges} - * have changed. - */ - export const onDidChangeNotebookEditorVisibleRanges: Event; - - /** - * The currently opened terminals or an empty array. - */ - export const terminals: readonly Terminal[]; - - /** - * The currently active terminal or `undefined`. The active terminal is the one that - * currently has focus or most recently had focus. - */ - export const activeTerminal: Terminal | undefined; - - /** - * An {@link Event} which fires when the {@link window.activeTerminal active terminal} - * has changed. *Note* that the event also fires when the active terminal changes - * to `undefined`. - */ - export const onDidChangeActiveTerminal: Event; - - /** - * An {@link Event} which fires when a terminal has been created, either through the - * {@link window.createTerminal createTerminal} API or commands. - */ - export const onDidOpenTerminal: Event; - - /** - * An {@link Event} which fires when a terminal is disposed. - */ - export const onDidCloseTerminal: Event; - - /** - * An {@link Event} which fires when a {@link Terminal.state terminal's state} has changed. - */ - export const onDidChangeTerminalState: Event; - - /** - * Fires when shell integration activates or one of its properties changes in a terminal. - */ - export const onDidChangeTerminalShellIntegration: Event; - - /** - * This will be fired when a terminal command is started. This event will fire only when - * [shell integration](https://code.visualstudio.com/docs/terminal/shell-integration) is - * activated for the terminal. - */ - export const onDidStartTerminalShellExecution: Event; - - /** - * This will be fired when a terminal command is ended. This event will fire only when - * [shell integration](https://code.visualstudio.com/docs/terminal/shell-integration) is - * activated for the terminal. - */ - export const onDidEndTerminalShellExecution: Event; - - /** - * Represents the current window's state. - */ - export const state: WindowState; - - /** - * An {@link Event} which fires when the focus or activity state of the current window - * changes. The value of the event represents whether the window is focused. - */ - export const onDidChangeWindowState: Event; - - /** - * Show the given document in a text editor. A {@link ViewColumn column} can be provided - * to control where the editor is being shown. Might change the {@link window.activeTextEditor active editor}. - * - * @param document A text document to be shown. - * @param column A view column in which the {@link TextEditor editor} should be shown. The default is the {@link ViewColumn.Active active}. - * Columns that do not exist will be created as needed up to the maximum of {@linkcode ViewColumn.Nine}. Use {@linkcode ViewColumn.Beside} - * to open the editor to the side of the currently active one. - * @param preserveFocus When `true` the editor will not take focus. - * @returns A promise that resolves to an {@link TextEditor editor}. - */ - export function showTextDocument( - document: TextDocument, - column?: ViewColumn, - preserveFocus?: boolean, - ): Thenable; - - /** - * Show the given document in a text editor. {@link TextDocumentShowOptions Options} can be provided - * to control options of the editor is being shown. Might change the {@link window.activeTextEditor active editor}. - * - * @param document A text document to be shown. - * @param options {@link TextDocumentShowOptions Editor options} to configure the behavior of showing the {@link TextEditor editor}. - * @returns A promise that resolves to an {@link TextEditor editor}. - */ - export function showTextDocument( - document: TextDocument, - options?: TextDocumentShowOptions, - ): Thenable; - - /** - * A short-hand for `openTextDocument(uri).then(document => showTextDocument(document, options))`. - * - * @see {@link workspace.openTextDocument} - * - * @param uri A resource identifier. - * @param options {@link TextDocumentShowOptions Editor options} to configure the behavior of showing the {@link TextEditor editor}. - * @returns A promise that resolves to an {@link TextEditor editor}. - */ - export function showTextDocument( - uri: Uri, - options?: TextDocumentShowOptions, - ): Thenable; - - /** - * Show the given {@link NotebookDocument} in a {@link NotebookEditor notebook editor}. - * - * @param document A text document to be shown. - * @param options {@link NotebookDocumentShowOptions Editor options} to configure the behavior of showing the {@link NotebookEditor notebook editor}. - * - * @returns A promise that resolves to an {@link NotebookEditor notebook editor}. - */ - export function showNotebookDocument( - document: NotebookDocument, - options?: NotebookDocumentShowOptions, - ): Thenable; - - /** - * Create a TextEditorDecorationType that can be used to add decorations to text editors. - * - * @param options Rendering options for the decoration type. - * @returns A new decoration type instance. - */ - export function createTextEditorDecorationType( - options: DecorationRenderOptions, - ): TextEditorDecorationType; - - /** - * Show an information message to users. Optionally provide an array of items which will be presented as - * clickable buttons. - * - * @param message The message to show. - * @param items A set of items that will be rendered as actions in the message. - * @returns A thenable that resolves to the selected item or `undefined` when being dismissed. - */ - export function showInformationMessage( - message: string, - ...items: T[] - ): Thenable; - - /** - * Show an information message to users. Optionally provide an array of items which will be presented as - * clickable buttons. - * - * @param message The message to show. - * @param options Configures the behaviour of the message. - * @param items A set of items that will be rendered as actions in the message. - * @returns A thenable that resolves to the selected item or `undefined` when being dismissed. - */ - export function showInformationMessage( - message: string, - options: MessageOptions, - ...items: T[] - ): Thenable; - - /** - * Show an information message. - * - * @see {@link window.showInformationMessage showInformationMessage} - * - * @param message The message to show. - * @param items A set of items that will be rendered as actions in the message. - * @returns A thenable that resolves to the selected item or `undefined` when being dismissed. - */ - export function showInformationMessage( - message: string, - ...items: T[] - ): Thenable; - - /** - * Show an information message. - * - * @see {@link window.showInformationMessage showInformationMessage} - * - * @param message The message to show. - * @param options Configures the behaviour of the message. - * @param items A set of items that will be rendered as actions in the message. - * @returns A thenable that resolves to the selected item or `undefined` when being dismissed. - */ - export function showInformationMessage( - message: string, - options: MessageOptions, - ...items: T[] - ): Thenable; - - /** - * Show a warning message. - * - * @see {@link window.showInformationMessage showInformationMessage} - * - * @param message The message to show. - * @param items A set of items that will be rendered as actions in the message. - * @returns A thenable that resolves to the selected item or `undefined` when being dismissed. - */ - export function showWarningMessage( - message: string, - ...items: T[] - ): Thenable; - - /** - * Show a warning message. - * - * @see {@link window.showInformationMessage showInformationMessage} - * - * @param message The message to show. - * @param options Configures the behaviour of the message. - * @param items A set of items that will be rendered as actions in the message. - * @returns A thenable that resolves to the selected item or `undefined` when being dismissed. - */ - export function showWarningMessage( - message: string, - options: MessageOptions, - ...items: T[] - ): Thenable; - - /** - * Show a warning message. - * - * @see {@link window.showInformationMessage showInformationMessage} - * - * @param message The message to show. - * @param items A set of items that will be rendered as actions in the message. - * @returns A thenable that resolves to the selected item or `undefined` when being dismissed. - */ - export function showWarningMessage( - message: string, - ...items: T[] - ): Thenable; - - /** - * Show a warning message. - * - * @see {@link window.showInformationMessage showInformationMessage} - * - * @param message The message to show. - * @param options Configures the behaviour of the message. - * @param items A set of items that will be rendered as actions in the message. - * @returns A thenable that resolves to the selected item or `undefined` when being dismissed. - */ - export function showWarningMessage( - message: string, - options: MessageOptions, - ...items: T[] - ): Thenable; - - /** - * Show an error message. - * - * @see {@link window.showInformationMessage showInformationMessage} - * - * @param message The message to show. - * @param items A set of items that will be rendered as actions in the message. - * @returns A thenable that resolves to the selected item or `undefined` when being dismissed. - */ - export function showErrorMessage( - message: string, - ...items: T[] - ): Thenable; - - /** - * Show an error message. - * - * @see {@link window.showInformationMessage showInformationMessage} - * - * @param message The message to show. - * @param options Configures the behaviour of the message. - * @param items A set of items that will be rendered as actions in the message. - * @returns A thenable that resolves to the selected item or `undefined` when being dismissed. - */ - export function showErrorMessage( - message: string, - options: MessageOptions, - ...items: T[] - ): Thenable; - - /** - * Show an error message. - * - * @see {@link window.showInformationMessage showInformationMessage} - * - * @param message The message to show. - * @param items A set of items that will be rendered as actions in the message. - * @returns A thenable that resolves to the selected item or `undefined` when being dismissed. - */ - export function showErrorMessage( - message: string, - ...items: T[] - ): Thenable; - - /** - * Show an error message. - * - * @see {@link window.showInformationMessage showInformationMessage} - * - * @param message The message to show. - * @param options Configures the behaviour of the message. - * @param items A set of items that will be rendered as actions in the message. - * @returns A thenable that resolves to the selected item or `undefined` when being dismissed. - */ - export function showErrorMessage( - message: string, - options: MessageOptions, - ...items: T[] - ): Thenable; - - /** - * Shows a selection list allowing multiple selections. - * - * @param items An array of strings, or a promise that resolves to an array of strings. - * @param options Configures the behavior of the selection list. - * @param token A token that can be used to signal cancellation. - * @returns A promise that resolves to the selected items or `undefined`. - */ - export function showQuickPick( - items: readonly string[] | Thenable, - options: QuickPickOptions & { - /** literal-type defines return type */ canPickMany: true; - }, - token?: CancellationToken, - ): Thenable; - - /** - * Shows a selection list. - * - * @param items An array of strings, or a promise that resolves to an array of strings. - * @param options Configures the behavior of the selection list. - * @param token A token that can be used to signal cancellation. - * @returns A promise that resolves to the selection or `undefined`. - */ - export function showQuickPick( - items: readonly string[] | Thenable, - options?: QuickPickOptions, - token?: CancellationToken, - ): Thenable; - - /** - * Shows a selection list allowing multiple selections. - * - * @param items An array of items, or a promise that resolves to an array of items. - * @param options Configures the behavior of the selection list. - * @param token A token that can be used to signal cancellation. - * @returns A promise that resolves to the selected items or `undefined`. - */ - export function showQuickPick( - items: readonly T[] | Thenable, - options: QuickPickOptions & { - /** literal-type defines return type */ canPickMany: true; - }, - token?: CancellationToken, - ): Thenable; - - /** - * Shows a selection list. - * - * @param items An array of items, or a promise that resolves to an array of items. - * @param options Configures the behavior of the selection list. - * @param token A token that can be used to signal cancellation. - * @returns A promise that resolves to the selected item or `undefined`. - */ - export function showQuickPick( - items: readonly T[] | Thenable, - options?: QuickPickOptions, - token?: CancellationToken, - ): Thenable; - - /** - * Shows a selection list of {@link workspace.workspaceFolders workspace folders} to pick from. - * Returns `undefined` if no folder is open. - * - * @param options Configures the behavior of the workspace folder list. - * @returns A promise that resolves to the workspace folder or `undefined`. - */ - export function showWorkspaceFolderPick( - options?: WorkspaceFolderPickOptions, - ): Thenable; - - /** - * Shows a file open dialog to the user which allows to select a file - * for opening-purposes. - * - * @param options Options that control the dialog. - * @returns A promise that resolves to the selected resources or `undefined`. - */ - export function showOpenDialog( - options?: OpenDialogOptions, - ): Thenable; - - /** - * Shows a file save dialog to the user which allows to select a file - * for saving-purposes. - * - * @param options Options that control the dialog. - * @returns A promise that resolves to the selected resource or `undefined`. - */ - export function showSaveDialog( - options?: SaveDialogOptions, - ): Thenable; - - /** - * Opens an input box to ask the user for input. - * - * The returned value will be `undefined` if the input box was canceled (e.g. pressing ESC). Otherwise the - * returned value will be the string typed by the user or an empty string if the user did not type - * anything but dismissed the input box with OK. - * - * @param options Configures the behavior of the input box. - * @param token A token that can be used to signal cancellation. - * @returns A promise that resolves to a string the user provided or to `undefined` in case of dismissal. - */ - export function showInputBox( - options?: InputBoxOptions, - token?: CancellationToken, - ): Thenable; - - /** - * Creates a {@link QuickPick} to let the user pick an item from a list - * of items of type T. - * - * Note that in many cases the more convenient {@link window.showQuickPick} - * is easier to use. {@link window.createQuickPick} should be used - * when {@link window.showQuickPick} does not offer the required flexibility. - * - * @returns A new {@link QuickPick}. - */ - export function createQuickPick< - T extends QuickPickItem, - >(): QuickPick; - - /** - * Creates a {@link InputBox} to let the user enter some text input. - * - * Note that in many cases the more convenient {@link window.showInputBox} - * is easier to use. {@link window.createInputBox} should be used - * when {@link window.showInputBox} does not offer the required flexibility. - * - * @returns A new {@link InputBox}. - */ - export function createInputBox(): InputBox; - - /** - * Creates a new {@link OutputChannel output channel} with the given name and language id - * If language id is not provided, then **Log** is used as default language id. - * - * You can access the visible or active output channel as a {@link TextDocument text document} from {@link window.visibleTextEditors visible editors} or {@link window.activeTextEditor active editor} - * and use the language id to contribute language features like syntax coloring, code lens etc., - * - * @param name Human-readable string which will be used to represent the channel in the UI. - * @param languageId The identifier of the language associated with the channel. - * @returns A new output channel. - */ - export function createOutputChannel( - name: string, - languageId?: string, - ): OutputChannel; - - /** - * Creates a new {@link LogOutputChannel log output channel} with the given name. - * - * @param name Human-readable string which will be used to represent the channel in the UI. - * @param options Options for the log output channel. - * @returns A new log output channel. - */ - export function createOutputChannel( - name: string, - options: { /** literal-type defines return type */ log: true }, - ): LogOutputChannel; - - /** - * Create and show a new webview panel. - * - * @param viewType Identifies the type of the webview panel. - * @param title Title of the panel. - * @param showOptions Where to show the webview in the editor. If preserveFocus is set, the new webview will not take focus. - * @param options Settings for the new panel. - * - * @returns New webview panel. - */ - export function createWebviewPanel( - viewType: string, - title: string, - showOptions: - | ViewColumn - | { - /** - * The view column in which the {@link WebviewPanel} should be shown. - */ - readonly viewColumn: ViewColumn; - /** - * An optional flag that when `true` will stop the panel from taking focus. - */ - readonly preserveFocus?: boolean; - }, - options?: WebviewPanelOptions & WebviewOptions, - ): WebviewPanel; - - /** - * Set a message to the status bar. This is a short hand for the more powerful - * status bar {@link window.createStatusBarItem items}. - * - * @param text The message to show, supports icon substitution as in status bar {@link StatusBarItem.text items}. - * @param hideAfterTimeout Timeout in milliseconds after which the message will be disposed. - * @returns A disposable which hides the status bar message. - */ - export function setStatusBarMessage( - text: string, - hideAfterTimeout: number, - ): Disposable; - - /** - * Set a message to the status bar. This is a short hand for the more powerful - * status bar {@link window.createStatusBarItem items}. - * - * @param text The message to show, supports icon substitution as in status bar {@link StatusBarItem.text items}. - * @param hideWhenDone Thenable on which completion (resolve or reject) the message will be disposed. - * @returns A disposable which hides the status bar message. - */ - export function setStatusBarMessage( - text: string, - hideWhenDone: Thenable, - ): Disposable; - - /** - * Set a message to the status bar. This is a short hand for the more powerful - * status bar {@link window.createStatusBarItem items}. - * - * *Note* that status bar messages stack and that they must be disposed when no - * longer used. - * - * @param text The message to show, supports icon substitution as in status bar {@link StatusBarItem.text items}. - * @returns A disposable which hides the status bar message. - */ - export function setStatusBarMessage(text: string): Disposable; - - /** - * Show progress in the Source Control viewlet while running the given callback and while - * its returned promise isn't resolve or rejected. - * - * @deprecated Use `withProgress` instead. - * - * @param task A callback returning a promise. Progress increments can be reported with - * the provided {@link Progress}-object. - * @returns The thenable the task did return. - */ - export function withScmProgress( - task: (progress: Progress) => Thenable, - ): Thenable; - - /** - * Show progress in the editor. Progress is shown while running the given callback - * and while the promise it returned isn't resolved nor rejected. The location at which - * progress should show (and other details) is defined via the passed {@linkcode ProgressOptions}. - * - * @param options A {@linkcode ProgressOptions}-object describing the options to use for showing progress, like its location - * @param task A callback returning a promise. Progress state can be reported with - * the provided {@link Progress}-object. - * - * To report discrete progress, use `increment` to indicate how much work has been completed. Each call with - * a `increment` value will be summed up and reflected as overall progress until 100% is reached (a value of - * e.g. `10` accounts for `10%` of work done). - * Note that currently only `ProgressLocation.Notification` is capable of showing discrete progress. - * - * To monitor if the operation has been cancelled by the user, use the provided {@linkcode CancellationToken}. - * Note that currently only `ProgressLocation.Notification` is supporting to show a cancel button to cancel the - * long running operation. - * - * @returns The thenable the task-callback returned. - */ - export function withProgress( - options: ProgressOptions, - task: ( - progress: Progress<{ - /** - * A progress message that represents a chunk of work - */ - message?: string; - /** - * An increment for discrete progress. Increments will be summed up until 100% is reached - */ - increment?: number; - }>, - token: CancellationToken, - ) => Thenable, - ): Thenable; - - /** - * Creates a status bar {@link StatusBarItem item}. - * - * @param id The identifier of the item. Must be unique within the extension. - * @param alignment The alignment of the item. - * @param priority The priority of the item. Higher values mean the item should be shown more to the left. - * @returns A new status bar item. - */ - export function createStatusBarItem( - id: string, - alignment?: StatusBarAlignment, - priority?: number, - ): StatusBarItem; - - /** - * Creates a status bar {@link StatusBarItem item}. - * - * @see {@link createStatusBarItem} for creating a status bar item with an identifier. - * @param alignment The alignment of the item. - * @param priority The priority of the item. Higher values mean the item should be shown more to the left. - * @returns A new status bar item. - */ - export function createStatusBarItem( - alignment?: StatusBarAlignment, - priority?: number, - ): StatusBarItem; - - /** - * Creates a {@link Terminal} with a backing shell process. The cwd of the terminal will be the workspace - * directory if it exists. - * - * @param name Optional human-readable string which will be used to represent the terminal in the UI. - * @param shellPath Optional path to a custom shell executable to be used in the terminal. - * @param shellArgs Optional args for the custom shell executable. A string can be used on Windows only which - * allows specifying shell args in - * [command-line format](https://msdn.microsoft.com/en-au/08dfcab2-eb6e-49a4-80eb-87d4076c98c6). - * @returns A new Terminal. - * @throws When running in an environment where a new process cannot be started. - */ - export function createTerminal( - name?: string, - shellPath?: string, - shellArgs?: readonly string[] | string, - ): Terminal; - - /** - * Creates a {@link Terminal} with a backing shell process. - * - * @param options A TerminalOptions object describing the characteristics of the new terminal. - * @returns A new Terminal. - * @throws When running in an environment where a new process cannot be started. - */ - export function createTerminal(options: TerminalOptions): Terminal; - - /** - * Creates a {@link Terminal} where an extension controls its input and output. - * - * @param options An {@link ExtensionTerminalOptions} object describing - * the characteristics of the new terminal. - * @returns A new Terminal. - */ - export function createTerminal( - options: ExtensionTerminalOptions, - ): Terminal; - - /** - * Register a {@link TreeDataProvider} for the view contributed using the extension point `views`. - * This will allow you to contribute data to the {@link TreeView} and update if the data changes. - * - * **Note:** To get access to the {@link TreeView} and perform operations on it, use {@link window.createTreeView createTreeView}. - * - * @param viewId Id of the view contributed using the extension point `views`. - * @param treeDataProvider A {@link TreeDataProvider} that provides tree data for the view - * @returns A {@link Disposable disposable} that unregisters the {@link TreeDataProvider}. - */ - export function registerTreeDataProvider( - viewId: string, - treeDataProvider: TreeDataProvider, - ): Disposable; - - /** - * Create a {@link TreeView} for the view contributed using the extension point `views`. - * @param viewId Id of the view contributed using the extension point `views`. - * @param options Options for creating the {@link TreeView} - * @returns a {@link TreeView}. - */ - export function createTreeView( - viewId: string, - options: TreeViewOptions, - ): TreeView; - - /** - * Registers a {@link UriHandler uri handler} capable of handling system-wide {@link Uri uris}. - * In case there are multiple windows open, the topmost window will handle the uri. - * A uri handler is scoped to the extension it is contributed from; it will only - * be able to handle uris which are directed to the extension itself. A uri must respect - * the following rules: - * - * - The uri-scheme must be `vscode.env.uriScheme`; - * - The uri-authority must be the extension id (e.g. `my.extension`); - * - The uri-path, -query and -fragment parts are arbitrary. - * - * For example, if the `my.extension` extension registers a uri handler, it will only - * be allowed to handle uris with the prefix `product-name://my.extension`. - * - * An extension can only register a single uri handler in its entire activation lifetime. - * - * * *Note:* There is an activation event `onUri` that fires when a uri directed for - * the current extension is about to be handled. - * - * @param handler The uri handler to register for this extension. - * @returns A {@link Disposable disposable} that unregisters the handler. - */ - export function registerUriHandler(handler: UriHandler): Disposable; - - /** - * Registers a webview panel serializer. - * - * Extensions that support reviving should have an `"onWebviewPanel:viewType"` activation event and - * make sure that `registerWebviewPanelSerializer` is called during activation. - * - * Only a single serializer may be registered at a time for a given `viewType`. - * - * @param viewType Type of the webview panel that can be serialized. - * @param serializer Webview serializer. - * @returns A {@link Disposable disposable} that unregisters the serializer. - */ - export function registerWebviewPanelSerializer( - viewType: string, - serializer: WebviewPanelSerializer, - ): Disposable; - - /** - * Register a new provider for webview views. - * - * @param viewId Unique id of the view. This should match the `id` from the - * `views` contribution in the package.json. - * @param provider Provider for the webview views. - * - * @returns Disposable that unregisters the provider. - */ - export function registerWebviewViewProvider( - viewId: string, - provider: WebviewViewProvider, - options?: { - /** - * Content settings for the webview created for this view. - */ - readonly webviewOptions?: { - /** - * Controls if the webview element itself (iframe) is kept around even when the view - * is no longer visible. - * - * Normally the webview's html context is created when the view becomes visible - * and destroyed when it is hidden. Extensions that have complex state - * or UI can set the `retainContextWhenHidden` to make the editor keep the webview - * context around, even when the webview moves to a background tab. When a webview using - * `retainContextWhenHidden` becomes hidden, its scripts and other dynamic content are suspended. - * When the view becomes visible again, the context is automatically restored - * in the exact same state it was in originally. You cannot send messages to a - * hidden webview, even with `retainContextWhenHidden` enabled. - * - * `retainContextWhenHidden` has a high memory overhead and should only be used if - * your view's context cannot be quickly saved and restored. - */ - readonly retainContextWhenHidden?: boolean; - }; - }, - ): Disposable; - - /** - * Register a provider for custom editors for the `viewType` contributed by the `customEditors` extension point. - * - * When a custom editor is opened, an `onCustomEditor:viewType` activation event is fired. Your extension - * must register a {@linkcode CustomTextEditorProvider}, {@linkcode CustomReadonlyEditorProvider}, - * {@linkcode CustomEditorProvider}for `viewType` as part of activation. - * - * @param viewType Unique identifier for the custom editor provider. This should match the `viewType` from the - * `customEditors` contribution point. - * @param provider Provider that resolves custom editors. - * @param options Options for the provider. - * - * @returns Disposable that unregisters the provider. - */ - export function registerCustomEditorProvider( - viewType: string, - provider: - | CustomTextEditorProvider - | CustomReadonlyEditorProvider - | CustomEditorProvider, - options?: { - /** - * Content settings for the webview panels created for this custom editor. - */ - readonly webviewOptions?: WebviewPanelOptions; - - /** - * Only applies to `CustomReadonlyEditorProvider | CustomEditorProvider`. - * - * Indicates that the provider allows multiple editor instances to be open at the same time for - * the same resource. - * - * By default, the editor only allows one editor instance to be open at a time for each resource. If the - * user tries to open a second editor instance for the resource, the first one is instead moved to where - * the second one was to be opened. - * - * When `supportsMultipleEditorsPerDocument` is enabled, users can split and create copies of the custom - * editor. In this case, the custom editor must make sure it can properly synchronize the states of all - * editor instances for a resource so that they are consistent. - */ - readonly supportsMultipleEditorsPerDocument?: boolean; - }, - ): Disposable; - - /** - * Register provider that enables the detection and handling of links within the terminal. - * @param provider The provider that provides the terminal links. - * @returns Disposable that unregisters the provider. - */ - export function registerTerminalLinkProvider( - provider: TerminalLinkProvider, - ): Disposable; - - /** - * Registers a provider for a contributed terminal profile. - * - * @param id The ID of the contributed terminal profile. - * @param provider The terminal profile provider. - * @returns A {@link Disposable disposable} that unregisters the provider. - */ - export function registerTerminalProfileProvider( - id: string, - provider: TerminalProfileProvider, - ): Disposable; - /** - * Register a file decoration provider. - * - * @param provider A {@link FileDecorationProvider}. - * @returns A {@link Disposable} that unregisters the provider. - */ - export function registerFileDecorationProvider( - provider: FileDecorationProvider, - ): Disposable; - - /** - * The currently active color theme as configured in the settings. The active - * theme can be changed via the `workbench.colorTheme` setting. - */ - export let activeColorTheme: ColorTheme; - - /** - * An {@link Event} which fires when the active color theme is changed or has changes. - */ - export const onDidChangeActiveColorTheme: Event; - } - - /** - * Options for creating a {@link TreeView} - */ - export interface TreeViewOptions { - /** - * A data provider that provides tree data. - */ - treeDataProvider: TreeDataProvider; - - /** - * Whether to show collapse all action or not. - */ - showCollapseAll?: boolean; - - /** - * Whether the tree supports multi-select. When the tree supports multi-select and a command is executed from the tree, - * the first argument to the command is the tree item that the command was executed on and the second argument is an - * array containing all selected tree items. - */ - canSelectMany?: boolean; - - /** - * An optional interface to implement drag and drop in the tree view. - */ - dragAndDropController?: TreeDragAndDropController; - - /** - * By default, when the children of a tree item have already been fetched, child checkboxes are automatically managed based on the checked state of the parent tree item. - * If the tree item is collapsed by default (meaning that the children haven't yet been fetched) then child checkboxes will not be updated. - * To override this behavior and manage child and parent checkbox state in the extension, set this to `true`. - * - * Examples where {@link TreeViewOptions.manageCheckboxStateManually} is false, the default behavior: - * - * 1. A tree item is checked, then its children are fetched. The children will be checked. - * - * 2. A tree item's parent is checked. The tree item and all of it's siblings will be checked. - * - [ ] Parent - * - [ ] Child 1 - * - [ ] Child 2 - * When the user checks Parent, the tree will look like this: - * - [x] Parent - * - [x] Child 1 - * - [x] Child 2 - * - * 3. A tree item and all of it's siblings are checked. The parent will be checked. - * - [ ] Parent - * - [ ] Child 1 - * - [ ] Child 2 - * When the user checks Child 1 and Child 2, the tree will look like this: - * - [x] Parent - * - [x] Child 1 - * - [x] Child 2 - * - * 4. A tree item is unchecked. The parent will be unchecked. - * - [x] Parent - * - [x] Child 1 - * - [x] Child 2 - * When the user unchecks Child 1, the tree will look like this: - * - [ ] Parent - * - [ ] Child 1 - * - [x] Child 2 - */ - manageCheckboxStateManually?: boolean; - } - - /** - * The event that is fired when an element in the {@link TreeView} is expanded or collapsed - */ - export interface TreeViewExpansionEvent { - /** - * Element that is expanded or collapsed. - */ - readonly element: T; - } - - /** - * The event that is fired when there is a change in {@link TreeView.selection tree view's selection} - */ - export interface TreeViewSelectionChangeEvent { - /** - * Selected elements. - */ - readonly selection: readonly T[]; - } - - /** - * The event that is fired when there is a change in {@link TreeView.visible tree view's visibility} - */ - export interface TreeViewVisibilityChangeEvent { - /** - * `true` if the {@link TreeView tree view} is visible otherwise `false`. - */ - readonly visible: boolean; - } - - /** - * A file associated with a {@linkcode DataTransferItem}. - * - * Instances of this type can only be created by the editor and not by extensions. - */ - export interface DataTransferFile { - /** - * The name of the file. - */ - readonly name: string; - - /** - * The full file path of the file. - * - * May be `undefined` on web. - */ - readonly uri?: Uri; - - /** - * The full file contents of the file. - */ - data(): Thenable; - } - - /** - * Encapsulates data transferred during drag and drop operations. - */ - export class DataTransferItem { - /** - * Get a string representation of this item. - * - * If {@linkcode DataTransferItem.value} is an object, this returns the result of json stringifying {@linkcode DataTransferItem.value} value. - */ - asString(): Thenable; - - /** - * Try getting the {@link DataTransferFile file} associated with this data transfer item. - * - * Note that the file object is only valid for the scope of the drag and drop operation. - * - * @returns The file for the data transfer or `undefined` if the item is either not a file or the - * file data cannot be accessed. - */ - asFile(): DataTransferFile | undefined; - - /** - * Custom data stored on this item. - * - * You can use `value` to share data across operations. The original object can be retrieved so long as the extension that - * created the `DataTransferItem` runs in the same extension host. - */ - readonly value: any; - - /** - * @param value Custom data stored on this item. Can be retrieved using {@linkcode DataTransferItem.value}. - */ - constructor(value: any); - } - - /** - * A map containing a mapping of the mime type of the corresponding transferred data. - * - * Drag and drop controllers that implement {@link TreeDragAndDropController.handleDrag `handleDrag`} can add additional mime types to the - * data transfer. These additional mime types will only be included in the `handleDrop` when the the drag was initiated from - * an element in the same drag and drop controller. - */ - export class DataTransfer - implements Iterable<[mimeType: string, item: DataTransferItem]> - { - /** - * Retrieves the data transfer item for a given mime type. - * - * @param mimeType The mime type to get the data transfer item for, such as `text/plain` or `image/png`. - * Mimes type look ups are case-insensitive. - * - * Special mime types: - * - `text/uri-list` — A string with `toString()`ed Uris separated by `\r\n`. To specify a cursor position in the file, - * set the Uri's fragment to `L3,5`, where 3 is the line number and 5 is the column number. - */ - get(mimeType: string): DataTransferItem | undefined; - - /** - * Sets a mime type to data transfer item mapping. - * - * @param mimeType The mime type to set the data for. Mimes types stored in lower case, with case-insensitive looks up. - * @param value The data transfer item for the given mime type. - */ - set(mimeType: string, value: DataTransferItem): void; - - /** - * Allows iteration through the data transfer items. - * - * @param callbackfn Callback for iteration through the data transfer items. - * @param thisArg The `this` context used when invoking the handler function. - */ - forEach( - callbackfn: ( - item: DataTransferItem, - mimeType: string, - dataTransfer: DataTransfer, - ) => void, - thisArg?: any, - ): void; - - /** - * Get a new iterator with the `[mime, item]` pairs for each element in this data transfer. - */ - [Symbol.iterator](): IterableIterator< - [mimeType: string, item: DataTransferItem] - >; - } - - /** - * Provides support for drag and drop in `TreeView`. - */ - export interface TreeDragAndDropController { - /** - * The mime types that the {@link TreeDragAndDropController.handleDrop `handleDrop`} method of this `DragAndDropController` supports. - * This could be well-defined, existing, mime types, and also mime types defined by the extension. - * - * To support drops from trees, you will need to add the mime type of that tree. - * This includes drops from within the same tree. - * The mime type of a tree is recommended to be of the format `application/vnd.code.tree.`. - * - * Use the special `files` mime type to support all types of dropped files {@link DataTransferFile files}, regardless of the file's actual mime type. - * - * To learn the mime type of a dragged item: - * 1. Set up your `DragAndDropController` - * 2. Use the Developer: Set Log Level... command to set the level to "Debug" - * 3. Open the developer tools and drag the item with unknown mime type over your tree. The mime types will be logged to the developer console - * - * Note that mime types that cannot be sent to the extension will be omitted. - */ - readonly dropMimeTypes: readonly string[]; - - /** - * The mime types that the {@link TreeDragAndDropController.handleDrag `handleDrag`} method of this `TreeDragAndDropController` may add to the tree data transfer. - * This could be well-defined, existing, mime types, and also mime types defined by the extension. - * - * The recommended mime type of the tree (`application/vnd.code.tree.`) will be automatically added. - */ - readonly dragMimeTypes: readonly string[]; - - /** - * When the user starts dragging items from this `DragAndDropController`, `handleDrag` will be called. - * Extensions can use `handleDrag` to add their {@link DataTransferItem `DataTransferItem`} items to the drag and drop. - * - * When the items are dropped on **another tree item** in **the same tree**, your `DataTransferItem` objects - * will be preserved. Use the recommended mime type for the tree (`application/vnd.code.tree.`) to add - * tree objects in a data transfer. See the documentation for `DataTransferItem` for how best to take advantage of this. - * - * To add a data transfer item that can be dragged into the editor, use the application specific mime type "text/uri-list". - * The data for "text/uri-list" should be a string with `toString()`ed Uris separated by `\r\n`. To specify a cursor position in the file, - * set the Uri's fragment to `L3,5`, where 3 is the line number and 5 is the column number. - * - * @param source The source items for the drag and drop operation. - * @param dataTransfer The data transfer associated with this drag. - * @param token A cancellation token indicating that drag has been cancelled. - */ - handleDrag?( - source: readonly T[], - dataTransfer: DataTransfer, - token: CancellationToken, - ): Thenable | void; - - /** - * Called when a drag and drop action results in a drop on the tree that this `DragAndDropController` belongs to. - * - * Extensions should fire {@link TreeDataProvider.onDidChangeTreeData onDidChangeTreeData} for any elements that need to be refreshed. - * - * @param target The target tree element that the drop is occurring on. When undefined, the target is the root. - * @param dataTransfer The data transfer items of the source of the drag. - * @param token A cancellation token indicating that the drop has been cancelled. - */ - handleDrop?( - target: T | undefined, - dataTransfer: DataTransfer, - token: CancellationToken, - ): Thenable | void; - } - - /** - * A badge presenting a value for a view - */ - export interface ViewBadge { - /** - * A label to present in tooltip for the badge. - */ - readonly tooltip: string; - - /** - * The value to present in the badge. - */ - readonly value: number; - } - - /** - * An event describing the change in a tree item's checkbox state. - */ - export interface TreeCheckboxChangeEvent { - /** - * The items that were checked or unchecked. - */ - readonly items: ReadonlyArray<[T, TreeItemCheckboxState]>; - } - - /** - * Represents a Tree view - */ - export interface TreeView extends Disposable { - /** - * Event that is fired when an element is expanded - */ - readonly onDidExpandElement: Event>; - - /** - * Event that is fired when an element is collapsed - */ - readonly onDidCollapseElement: Event>; - - /** - * Currently selected elements. - */ - readonly selection: readonly T[]; - - /** - * Event that is fired when the {@link TreeView.selection selection} has changed - */ - readonly onDidChangeSelection: Event>; - - /** - * `true` if the {@link TreeView tree view} is visible otherwise `false`. - */ - readonly visible: boolean; - - /** - * Event that is fired when {@link TreeView.visible visibility} has changed - */ - readonly onDidChangeVisibility: Event; - - /** - * An event to signal that an element or root has either been checked or unchecked. - */ - readonly onDidChangeCheckboxState: Event>; - - /** - * An optional human-readable message that will be rendered in the view. - * Setting the message to null, undefined, or empty string will remove the message from the view. - */ - message?: string; - - /** - * The tree view title is initially taken from the extension package.json - * Changes to the title property will be properly reflected in the UI in the title of the view. - */ - title?: string; - - /** - * An optional human-readable description which is rendered less prominently in the title of the view. - * Setting the title description to null, undefined, or empty string will remove the description from the view. - */ - description?: string; - - /** - * The badge to display for this TreeView. - * To remove the badge, set to undefined. - */ - badge?: ViewBadge | undefined; - - /** - * Reveals the given element in the tree view. - * If the tree view is not visible then the tree view is shown and element is revealed. - * - * By default revealed element is selected. - * In order to not to select, set the option `select` to `false`. - * In order to focus, set the option `focus` to `true`. - * In order to expand the revealed element, set the option `expand` to `true`. To expand recursively set `expand` to the number of levels to expand. - * - * * *NOTE:* You can expand only to 3 levels maximum. - * * *NOTE:* The {@link TreeDataProvider} that the `TreeView` {@link window.createTreeView is registered with} with must implement {@link TreeDataProvider.getParent getParent} method to access this API. - */ - reveal( - element: T, - options?: { - /** - * If true, then the element will be selected. - */ - readonly select?: boolean; - /** - * If true, then the element will be focused. - */ - readonly focus?: boolean; - /** - * If true, then the element will be expanded. If a number is passed, then up to that number of levels of children will be expanded - */ - readonly expand?: boolean | number; - }, - ): Thenable; - } - - /** - * A data provider that provides tree data - */ - export interface TreeDataProvider { - /** - * An optional event to signal that an element or root has changed. - * This will trigger the view to update the changed element/root and its children recursively (if shown). - * To signal that root has changed, do not pass any argument or pass `undefined` or `null`. - */ - onDidChangeTreeData?: Event; - - /** - * Get {@link TreeItem} representation of the `element` - * - * @param element The element for which {@link TreeItem} representation is asked for. - * @returns TreeItem representation of the element. - */ - getTreeItem(element: T): TreeItem | Thenable; - - /** - * Get the children of `element` or root if no element is passed. - * - * @param element The element from which the provider gets children. Can be `undefined`. - * @returns Children of `element` or root if no element is passed. - */ - getChildren(element?: T): ProviderResult; - - /** - * Optional method to return the parent of `element`. - * Return `null` or `undefined` if `element` is a child of root. - * - * **NOTE:** This method should be implemented in order to access {@link TreeView.reveal reveal} API. - * - * @param element The element for which the parent has to be returned. - * @returns Parent of `element`. - */ - getParent?(element: T): ProviderResult; - - /** - * Called on hover to resolve the {@link TreeItem.tooltip TreeItem} property if it is undefined. - * Called on tree item click/open to resolve the {@link TreeItem.command TreeItem} property if it is undefined. - * Only properties that were undefined can be resolved in `resolveTreeItem`. - * Functionality may be expanded later to include being called to resolve other missing - * properties on selection and/or on open. - * - * Will only ever be called once per TreeItem. - * - * onDidChangeTreeData should not be triggered from within resolveTreeItem. - * - * *Note* that this function is called when tree items are already showing in the UI. - * Because of that, no property that changes the presentation (label, description, etc.) - * can be changed. - * - * @param item Undefined properties of `item` should be set then `item` should be returned. - * @param element The object associated with the TreeItem. - * @param token A cancellation token. - * @returns The resolved tree item or a thenable that resolves to such. It is OK to return the given - * `item`. When no result is returned, the given `item` will be used. - */ - resolveTreeItem?( - item: TreeItem, - element: T, - token: CancellationToken, - ): ProviderResult; - } - - /** - * A tree item is an UI element of the tree. Tree items are created by the {@link TreeDataProvider data provider}. - */ - export class TreeItem { - /** - * A human-readable string describing this item. When `falsy`, it is derived from {@link TreeItem.resourceUri resourceUri}. - */ - label?: string | TreeItemLabel; - - /** - * Optional id for the tree item that has to be unique across tree. The id is used to preserve the selection and expansion state of the tree item. - * - * If not provided, an id is generated using the tree item's label. **Note** that when labels change, ids will change and that selection and expansion state cannot be kept stable anymore. - */ - id?: string; - - /** - * The icon path or {@link ThemeIcon} for the tree item. - * When `falsy`, {@link ThemeIcon.Folder Folder Theme Icon} is assigned, if item is collapsible otherwise {@link ThemeIcon.File File Theme Icon}. - * When a file or folder {@link ThemeIcon} is specified, icon is derived from the current file icon theme for the specified theme icon using {@link TreeItem.resourceUri resourceUri} (if provided). - */ - iconPath?: IconPath; - - /** - * A human-readable string which is rendered less prominent. - * When `true`, it is derived from {@link TreeItem.resourceUri resourceUri} and when `falsy`, it is not shown. - */ - description?: string | boolean; - - /** - * The {@link Uri} of the resource representing this item. - * - * Will be used to derive the {@link TreeItem.label label}, when it is not provided. - * Will be used to derive the icon from current file icon theme, when {@link TreeItem.iconPath iconPath} has {@link ThemeIcon} value. - */ - resourceUri?: Uri; - - /** - * The tooltip text when you hover over this item. - */ - tooltip?: string | MarkdownString | undefined; - - /** - * The {@link Command} that should be executed when the tree item is selected. - * - * Please use `vscode.open` or `vscode.diff` as command IDs when the tree item is opening - * something in the editor. Using these commands ensures that the resulting editor will - * appear consistent with how other built-in trees open editors. - */ - command?: Command; - - /** - * {@link TreeItemCollapsibleState} of the tree item. - */ - collapsibleState?: TreeItemCollapsibleState; - - /** - * Context value of the tree item. This can be used to contribute item specific actions in the tree. - * For example, a tree item is given a context value as `folder`. When contributing actions to `view/item/context` - * using `menus` extension point, you can specify context value for key `viewItem` in `when` expression like `viewItem == folder`. - * ```json - * "contributes": { - * "menus": { - * "view/item/context": [ - * { - * "command": "extension.deleteFolder", - * "when": "viewItem == folder" - * } - * ] - * } - * } - * ``` - * This will show action `extension.deleteFolder` only for items with `contextValue` is `folder`. - */ - contextValue?: string; - - /** - * Accessibility information used when screen reader interacts with this tree item. - * Generally, a TreeItem has no need to set the `role` of the accessibilityInformation; - * however, there are cases where a TreeItem is not displayed in a tree-like way where setting the `role` may make sense. - */ - accessibilityInformation?: AccessibilityInformation; - - /** - * {@link TreeItemCheckboxState TreeItemCheckboxState} of the tree item. - * {@link TreeDataProvider.onDidChangeTreeData onDidChangeTreeData} should be fired when {@link TreeItem.checkboxState checkboxState} changes. - */ - checkboxState?: - | TreeItemCheckboxState - | { - /** - * The {@link TreeItemCheckboxState} of the tree item - */ - readonly state: TreeItemCheckboxState; - /** - * A tooltip for the checkbox - */ - readonly tooltip?: string; - /** - * Accessibility information used when screen readers interact with this checkbox - */ - readonly accessibilityInformation?: AccessibilityInformation; - }; - - /** - * @param label A human-readable string describing this item - * @param collapsibleState {@link TreeItemCollapsibleState} of the tree item. Default is {@link TreeItemCollapsibleState.None} - */ - constructor( - label: string | TreeItemLabel, - collapsibleState?: TreeItemCollapsibleState, - ); - - /** - * @param resourceUri The {@link Uri} of the resource representing this item. - * @param collapsibleState {@link TreeItemCollapsibleState} of the tree item. Default is {@link TreeItemCollapsibleState.None} - */ - constructor( - resourceUri: Uri, - collapsibleState?: TreeItemCollapsibleState, - ); - } - - /** - * Collapsible state of the tree item - */ - export enum TreeItemCollapsibleState { - /** - * Determines an item can be neither collapsed nor expanded. Implies it has no children. - */ - None = 0, - /** - * Determines an item is collapsed - */ - Collapsed = 1, - /** - * Determines an item is expanded - */ - Expanded = 2, - } - - /** - * Label describing the {@link TreeItem Tree item} - */ - export interface TreeItemLabel { - /** - * A human-readable string describing the {@link TreeItem Tree item}. - */ - label: string; - - /** - * Ranges in the label to highlight. A range is defined as a tuple of two number where the - * first is the inclusive start index and the second the exclusive end index - */ - highlights?: [number, number][]; - } - - /** - * Checkbox state of the tree item - */ - export enum TreeItemCheckboxState { - /** - * Determines an item is unchecked - */ - Unchecked = 0, - /** - * Determines an item is checked - */ - Checked = 1, - } - - /** - * Value-object describing what options a terminal should use. - */ - export interface TerminalOptions { - /** - * A human-readable string which will be used to represent the terminal in the UI. - */ - name?: string; - - /** - * A path to a custom shell executable to be used in the terminal. - */ - shellPath?: string; - - /** - * Args for the custom shell executable. A string can be used on Windows only which allows - * specifying shell args in [command-line format](https://msdn.microsoft.com/en-au/08dfcab2-eb6e-49a4-80eb-87d4076c98c6). - */ - shellArgs?: string[] | string; - - /** - * A path or Uri for the current working directory to be used for the terminal. - */ - cwd?: string | Uri; - - /** - * Object with environment variables that will be added to the editor process. - */ - env?: { [key: string]: string | null | undefined }; - - /** - * Whether the terminal process environment should be exactly as provided in - * `TerminalOptions.env`. When this is false (default), the environment will be based on the - * window's environment and also apply configured platform settings like - * `terminal.integrated.env.windows` on top. When this is true, the complete environment - * must be provided as nothing will be inherited from the process or any configuration. - */ - strictEnv?: boolean; - - /** - * When enabled the terminal will run the process as normal but not be surfaced to the user - * until `Terminal.show` is called. The typical usage for this is when you need to run - * something that may need interactivity but only want to tell the user about it when - * interaction is needed. Note that the terminals will still be exposed to all extensions - * as normal. The hidden terminals will not be restored when the workspace is next opened. - */ - hideFromUser?: boolean; - - /** - * A message to write to the terminal on first launch, note that this is not sent to the - * process but, rather written directly to the terminal. This supports escape sequences such - * a setting text style. - */ - message?: string; - - /** - * The icon path or {@link ThemeIcon} for the terminal. - */ - iconPath?: IconPath; - - /** - * The icon {@link ThemeColor} for the terminal. - * The `terminal.ansi*` theme keys are - * recommended for the best contrast and consistency across themes. - */ - color?: ThemeColor; - - /** - * The {@link TerminalLocation} or {@link TerminalEditorLocationOptions} or {@link TerminalSplitLocationOptions} for the terminal. - */ - location?: - | TerminalLocation - | TerminalEditorLocationOptions - | TerminalSplitLocationOptions; - - /** - * Opt-out of the default terminal persistence on restart and reload. - * This will only take effect when `terminal.integrated.enablePersistentSessions` is enabled. - */ - isTransient?: boolean; - } - - /** - * Value-object describing what options a virtual process terminal should use. - */ - export interface ExtensionTerminalOptions { - /** - * A human-readable string which will be used to represent the terminal in the UI. - */ - name: string; - - /** - * An implementation of {@link Pseudoterminal} that allows an extension to - * control a terminal. - */ - pty: Pseudoterminal; - - /** - * The icon path or {@link ThemeIcon} for the terminal. - */ - iconPath?: IconPath; - - /** - * The icon {@link ThemeColor} for the terminal. - * The standard `terminal.ansi*` theme keys are - * recommended for the best contrast and consistency across themes. - */ - color?: ThemeColor; - - /** - * The {@link TerminalLocation} or {@link TerminalEditorLocationOptions} or {@link TerminalSplitLocationOptions} for the terminal. - */ - location?: - | TerminalLocation - | TerminalEditorLocationOptions - | TerminalSplitLocationOptions; - - /** - * Opt-out of the default terminal persistence on restart and reload. - * This will only take effect when `terminal.integrated.enablePersistentSessions` is enabled. - */ - isTransient?: boolean; - } - - /** - * Defines the interface of a terminal pty, enabling extensions to control a terminal. - */ - interface Pseudoterminal { - /** - * An event that when fired will write data to the terminal. Unlike - * {@link Terminal.sendText} which sends text to the underlying child - * pseudo-device (the child), this will write the text to parent pseudo-device (the - * _terminal_ itself). - * - * Note writing `\n` will just move the cursor down 1 row, you need to write `\r` as well - * to move the cursor to the left-most cell. - * - * Events fired before {@link Pseudoterminal.open} is called will be be ignored. - * - * **Example:** Write red text to the terminal - * ```typescript - * const writeEmitter = new vscode.EventEmitter(); - * const pty: vscode.Pseudoterminal = { - * onDidWrite: writeEmitter.event, - * open: () => writeEmitter.fire('\x1b[31mHello world\x1b[0m'), - * close: () => {} - * }; - * vscode.window.createTerminal({ name: 'My terminal', pty }); - * ``` - * - * **Example:** Move the cursor to the 10th row and 20th column and write an asterisk - * ```typescript - * writeEmitter.fire('\x1b[10;20H*'); - * ``` - */ - onDidWrite: Event; - - /** - * An event that when fired allows overriding the {@link Pseudoterminal.setDimensions dimensions} of the - * terminal. Note that when set, the overridden dimensions will only take effect when they - * are lower than the actual dimensions of the terminal (ie. there will never be a scroll - * bar). Set to `undefined` for the terminal to go back to the regular dimensions (fit to - * the size of the panel). - * - * Events fired before {@link Pseudoterminal.open} is called will be be ignored. - * - * **Example:** Override the dimensions of a terminal to 20 columns and 10 rows - * ```typescript - * const dimensionsEmitter = new vscode.EventEmitter(); - * const pty: vscode.Pseudoterminal = { - * onDidWrite: writeEmitter.event, - * onDidOverrideDimensions: dimensionsEmitter.event, - * open: () => { - * dimensionsEmitter.fire({ - * columns: 20, - * rows: 10 - * }); - * }, - * close: () => {} - * }; - * vscode.window.createTerminal({ name: 'My terminal', pty }); - * ``` - */ - onDidOverrideDimensions?: Event; - - /** - * An event that when fired will signal that the pty is closed and dispose of the terminal. - * - * Events fired before {@link Pseudoterminal.open} is called will be be ignored. - * - * A number can be used to provide an exit code for the terminal. Exit codes must be - * positive and a non-zero exit codes signals failure which shows a notification for a - * regular terminal and allows dependent tasks to proceed when used with the - * `CustomExecution` API. - * - * **Example:** Exit the terminal when "y" is pressed, otherwise show a notification. - * ```typescript - * const writeEmitter = new vscode.EventEmitter(); - * const closeEmitter = new vscode.EventEmitter(); - * const pty: vscode.Pseudoterminal = { - * onDidWrite: writeEmitter.event, - * onDidClose: closeEmitter.event, - * open: () => writeEmitter.fire('Press y to exit successfully'), - * close: () => {}, - * handleInput: data => { - * if (data !== 'y') { - * vscode.window.showInformationMessage('Something went wrong'); - * } - * closeEmitter.fire(); - * } - * }; - * const terminal = vscode.window.createTerminal({ name: 'Exit example', pty }); - * terminal.show(true); - * ``` - */ - onDidClose?: Event; - - /** - * An event that when fired allows changing the name of the terminal. - * - * Events fired before {@link Pseudoterminal.open} is called will be be ignored. - * - * **Example:** Change the terminal name to "My new terminal". - * ```typescript - * const writeEmitter = new vscode.EventEmitter(); - * const changeNameEmitter = new vscode.EventEmitter(); - * const pty: vscode.Pseudoterminal = { - * onDidWrite: writeEmitter.event, - * onDidChangeName: changeNameEmitter.event, - * open: () => changeNameEmitter.fire('My new terminal'), - * close: () => {} - * }; - * vscode.window.createTerminal({ name: 'My terminal', pty }); - * ``` - */ - onDidChangeName?: Event; - - /** - * Implement to handle when the pty is open and ready to start firing events. - * - * @param initialDimensions The dimensions of the terminal, this will be undefined if the - * terminal panel has not been opened before this is called. - */ - open(initialDimensions: TerminalDimensions | undefined): void; - - /** - * Implement to handle when the terminal is closed by an act of the user. - */ - close(): void; - - /** - * Implement to handle incoming keystrokes in the terminal or when an extension calls - * {@link Terminal.sendText}. `data` contains the keystrokes/text serialized into - * their corresponding VT sequence representation. - * - * @param data The incoming data. - * - * **Example:** Echo input in the terminal. The sequence for enter (`\r`) is translated to - * CRLF to go to a new line and move the cursor to the start of the line. - * ```typescript - * const writeEmitter = new vscode.EventEmitter(); - * const pty: vscode.Pseudoterminal = { - * onDidWrite: writeEmitter.event, - * open: () => {}, - * close: () => {}, - * handleInput: data => writeEmitter.fire(data === '\r' ? '\r\n' : data) - * }; - * vscode.window.createTerminal({ name: 'Local echo', pty }); - * ``` - */ - handleInput?(data: string): void; - - /** - * Implement to handle when the number of rows and columns that fit into the terminal panel - * changes, for example when font size changes or when the panel is resized. The initial - * state of a terminal's dimensions should be treated as `undefined` until this is triggered - * as the size of a terminal isn't known until it shows up in the user interface. - * - * When dimensions are overridden by - * {@link Pseudoterminal.onDidOverrideDimensions onDidOverrideDimensions}, `setDimensions` will - * continue to be called with the regular panel dimensions, allowing the extension continue - * to react dimension changes. - * - * @param dimensions The new dimensions. - */ - setDimensions?(dimensions: TerminalDimensions): void; - } - - /** - * Represents the dimensions of a terminal. - */ - export interface TerminalDimensions { - /** - * The number of columns in the terminal. - */ - readonly columns: number; - - /** - * The number of rows in the terminal. - */ - readonly rows: number; - } - - /** - * Represents how a terminal exited. - */ - export interface TerminalExitStatus { - /** - * The exit code that a terminal exited with, it can have the following values: - * - Zero: the terminal process or custom execution succeeded. - * - Non-zero: the terminal process or custom execution failed. - * - `undefined`: the user forcibly closed the terminal or a custom execution exited - * without providing an exit code. - */ - readonly code: number | undefined; - - /** - * The reason that triggered the exit of a terminal. - */ - readonly reason: TerminalExitReason; - } - - /** - * Terminal exit reason kind. - */ - export enum TerminalExitReason { - /** - * Unknown reason. - */ - Unknown = 0, - - /** - * The window closed/reloaded. - */ - Shutdown = 1, - - /** - * The shell process exited. - */ - Process = 2, - - /** - * The user closed the terminal. - */ - User = 3, - - /** - * An extension disposed the terminal. - */ - Extension = 4, - } - - /** - * A type of mutation that can be applied to an environment variable. - */ - export enum EnvironmentVariableMutatorType { - /** - * Replace the variable's existing value. - */ - Replace = 1, - /** - * Append to the end of the variable's existing value. - */ - Append = 2, - /** - * Prepend to the start of the variable's existing value. - */ - Prepend = 3, - } - - /** - * Options applied to the mutator. - */ - export interface EnvironmentVariableMutatorOptions { - /** - * Apply to the environment just before the process is created. Defaults to false. - */ - applyAtProcessCreation?: boolean; - - /** - * Apply to the environment in the shell integration script. Note that this _will not_ apply - * the mutator if shell integration is disabled or not working for some reason. Defaults to - * false. - */ - applyAtShellIntegration?: boolean; - } - - /** - * A type of mutation and its value to be applied to an environment variable. - */ - export interface EnvironmentVariableMutator { - /** - * The type of mutation that will occur to the variable. - */ - readonly type: EnvironmentVariableMutatorType; - - /** - * The value to use for the variable. - */ - readonly value: string; - - /** - * Options applied to the mutator. - */ - readonly options: EnvironmentVariableMutatorOptions; - } - - /** - * A collection of mutations that an extension can apply to a process environment. - */ - export interface EnvironmentVariableCollection - extends Iterable< - [variable: string, mutator: EnvironmentVariableMutator] - > { - /** - * Whether the collection should be cached for the workspace and applied to the terminal - * across window reloads. When true the collection will be active immediately such when the - * window reloads. Additionally, this API will return the cached version if it exists. The - * collection will be invalidated when the extension is uninstalled or when the collection - * is cleared. Defaults to true. - */ - persistent: boolean; - - /** - * A description for the environment variable collection, this will be used to describe the - * changes in the UI. - */ - description: string | MarkdownString | undefined; - - /** - * Replace an environment variable with a value. - * - * Note that an extension can only make a single change to any one variable, so this will - * overwrite any previous calls to replace, append or prepend. - * - * @param variable The variable to replace. - * @param value The value to replace the variable with. - * @param options Options applied to the mutator, when no options are provided this will - * default to `{ applyAtProcessCreation: true }`. - */ - replace( - variable: string, - value: string, - options?: EnvironmentVariableMutatorOptions, - ): void; - - /** - * Append a value to an environment variable. - * - * Note that an extension can only make a single change to any one variable, so this will - * overwrite any previous calls to replace, append or prepend. - * - * @param variable The variable to append to. - * @param value The value to append to the variable. - * @param options Options applied to the mutator, when no options are provided this will - * default to `{ applyAtProcessCreation: true }`. - */ - append( - variable: string, - value: string, - options?: EnvironmentVariableMutatorOptions, - ): void; - - /** - * Prepend a value to an environment variable. - * - * Note that an extension can only make a single change to any one variable, so this will - * overwrite any previous calls to replace, append or prepend. - * - * @param variable The variable to prepend. - * @param value The value to prepend to the variable. - * @param options Options applied to the mutator, when no options are provided this will - * default to `{ applyAtProcessCreation: true }`. - */ - prepend( - variable: string, - value: string, - options?: EnvironmentVariableMutatorOptions, - ): void; - - /** - * Gets the mutator that this collection applies to a variable, if any. - * - * @param variable The variable to get the mutator for. - */ - get(variable: string): EnvironmentVariableMutator | undefined; - - /** - * Iterate over each mutator in this collection. - * - * @param callback Function to execute for each entry. - * @param thisArg The `this` context used when invoking the handler function. - */ - forEach( - callback: ( - variable: string, - mutator: EnvironmentVariableMutator, - collection: EnvironmentVariableCollection, - ) => any, - thisArg?: any, - ): void; - - /** - * Deletes this collection's mutator for a variable. - * - * @param variable The variable to delete the mutator for. - */ - delete(variable: string): void; - - /** - * Clears all mutators from this collection. - */ - clear(): void; - } - - /** - * A collection of mutations that an extension can apply to a process environment. Applies to all scopes. - */ - export interface GlobalEnvironmentVariableCollection - extends EnvironmentVariableCollection { - /** - * Gets scope-specific environment variable collection for the extension. This enables alterations to - * terminal environment variables solely within the designated scope, and is applied in addition to (and - * after) the global collection. - * - * Each object obtained through this method is isolated and does not impact objects for other scopes, - * including the global collection. - * - * @param scope The scope to which the environment variable collection applies to. - * - * If a scope parameter is omitted, collection applicable to all relevant scopes for that parameter is - * returned. For instance, if the 'workspaceFolder' parameter is not specified, the collection that applies - * across all workspace folders will be returned. - * - * @returns Environment variable collection for the passed in scope. - */ - getScoped( - scope: EnvironmentVariableScope, - ): EnvironmentVariableCollection; - } - - /** - * The scope object to which the environment variable collection applies. - */ - export interface EnvironmentVariableScope { - /** - * Any specific workspace folder to get collection for. - */ - workspaceFolder?: WorkspaceFolder; - } - - /** - * A location in the editor at which progress information can be shown. It depends on the - * location how progress is visually represented. - */ - export enum ProgressLocation { - /** - * Show progress for the source control viewlet, as overlay for the icon and as progress bar - * inside the viewlet (when visible). Neither supports cancellation nor discrete progress nor - * a label to describe the operation. - */ - SourceControl = 1, - - /** - * Show progress in the status bar of the editor. Neither supports cancellation nor discrete progress. - * Supports rendering of {@link ThemeIcon theme icons} via the `$()`-syntax in the progress label. - */ - Window = 10, - - /** - * Show progress as notification with an optional cancel button. Supports to show infinite and discrete - * progress but does not support rendering of icons. - */ - Notification = 15, - } - - /** - * Value-object describing where and how progress should show. - */ - export interface ProgressOptions { - /** - * The location at which progress should show. - */ - location: - | ProgressLocation - | { - /** - * The identifier of a view for which progress should be shown. - */ - viewId: string; - }; - - /** - * A human-readable string which will be used to describe the - * operation. - */ - title?: string; - - /** - * Controls if a cancel button should show to allow the user to - * cancel the long running operation. Note that currently only - * `ProgressLocation.Notification` is supporting to show a cancel - * button. - */ - cancellable?: boolean; - } - - /** - * A light-weight user input UI that is initially not visible. After - * configuring it through its properties the extension can make it - * visible by calling {@link QuickInput.show}. - * - * There are several reasons why this UI might have to be hidden and - * the extension will be notified through {@link QuickInput.onDidHide}. - * (Examples include: an explicit call to {@link QuickInput.hide}, - * the user pressing Esc, some other input UI opening, etc.) - * - * A user pressing Enter or some other gesture implying acceptance - * of the current state does not automatically hide this UI component. - * It is up to the extension to decide whether to accept the user's input - * and if the UI should indeed be hidden through a call to {@link QuickInput.hide}. - * - * When the extension no longer needs this input UI, it should - * {@link QuickInput.dispose} it to allow for freeing up - * any resources associated with it. - * - * See {@link QuickPick} and {@link InputBox} for concrete UIs. - */ - export interface QuickInput { - /** - * An optional title. - */ - title: string | undefined; - - /** - * An optional current step count. - */ - step: number | undefined; - - /** - * An optional total step count. - */ - totalSteps: number | undefined; - - /** - * If the UI should allow for user input. Defaults to true. - * - * Change this to false, e.g., while validating user input or - * loading data for the next step in user input. - */ - enabled: boolean; - - /** - * If the UI should show a progress indicator. Defaults to false. - * - * Change this to true, e.g., while loading more data or validating - * user input. - */ - busy: boolean; - - /** - * If the UI should stay open even when loosing UI focus. Defaults to false. - * This setting is ignored on iPad and is always false. - */ - ignoreFocusOut: boolean; - - /** - * Makes the input UI visible in its current configuration. Any other input - * UI will first fire an {@link QuickInput.onDidHide} event. - */ - show(): void; - - /** - * Hides this input UI. This will also fire an {@link QuickInput.onDidHide} - * event. - */ - hide(): void; - - /** - * An event signaling when this input UI is hidden. - * - * There are several reasons why this UI might have to be hidden and - * the extension will be notified through {@link QuickInput.onDidHide}. - * (Examples include: an explicit call to {@link QuickInput.hide}, - * the user pressing Esc, some other input UI opening, etc.) - */ - onDidHide: Event; - - /** - * Dispose of this input UI and any associated resources. If it is still - * visible, it is first hidden. After this call the input UI is no longer - * functional and no additional methods or properties on it should be - * accessed. Instead a new input UI should be created. - */ - dispose(): void; - } - - /** - * A concrete {@link QuickInput} to let the user pick an item from a - * list of items of type T. The items can be filtered through a filter text field and - * there is an option {@link QuickPick.canSelectMany canSelectMany} to allow for - * selecting multiple items. - * - * Note that in many cases the more convenient {@link window.showQuickPick} - * is easier to use. {@link window.createQuickPick} should be used - * when {@link window.showQuickPick} does not offer the required flexibility. - */ - export interface QuickPick extends QuickInput { - /** - * Current value of the filter text. - */ - value: string; - - /** - * Optional placeholder shown in the filter textbox when no filter has been entered. - */ - placeholder: string | undefined; - - /** - * An event signaling when the value of the filter text has changed. - */ - readonly onDidChangeValue: Event; - - /** - * An event signaling when the user indicated acceptance of the selected item(s). - */ - readonly onDidAccept: Event; - - /** - * Buttons for actions in the UI. - */ - buttons: readonly QuickInputButton[]; - - /** - * An event signaling when a top level button (buttons stored in {@link buttons}) was triggered. - * This event does not fire for buttons on a {@link QuickPickItem}. - */ - readonly onDidTriggerButton: Event; - - /** - * An event signaling when a button in a particular {@link QuickPickItem} was triggered. - * This event does not fire for buttons in the title bar. - */ - readonly onDidTriggerItemButton: Event>; - - /** - * Items to pick from. This can be read and updated by the extension. - */ - items: readonly T[]; - - /** - * If multiple items can be selected at the same time. Defaults to false. - */ - canSelectMany: boolean; - - /** - * If the filter text should also be matched against the description of the items. Defaults to false. - */ - matchOnDescription: boolean; - - /** - * If the filter text should also be matched against the detail of the items. Defaults to false. - */ - matchOnDetail: boolean; - - /** - * An optional flag to maintain the scroll position of the quick pick when the quick pick items are updated. Defaults to false. - */ - keepScrollPosition?: boolean; - - /** - * Active items. This can be read and updated by the extension. - */ - activeItems: readonly T[]; - - /** - * An event signaling when the active items have changed. - */ - readonly onDidChangeActive: Event; - - /** - * Selected items. This can be read and updated by the extension. - */ - selectedItems: readonly T[]; - - /** - * An event signaling when the selected items have changed. - */ - readonly onDidChangeSelection: Event; - } - - /** - * A concrete {@link QuickInput} to let the user input a text value. - * - * Note that in many cases the more convenient {@link window.showInputBox} - * is easier to use. {@link window.createInputBox} should be used - * when {@link window.showInputBox} does not offer the required flexibility. - */ - export interface InputBox extends QuickInput { - /** - * Current input value. - */ - value: string; - - /** - * Selection range in the input value. Defined as tuple of two number where the - * first is the inclusive start index and the second the exclusive end index. When `undefined` the whole - * pre-filled value will be selected, when empty (start equals end) only the cursor will be set, - * otherwise the defined range will be selected. - * - * This property does not get updated when the user types or makes a selection, - * but it can be updated by the extension. - */ - valueSelection: readonly [number, number] | undefined; - - /** - * Optional placeholder shown when no value has been input. - */ - placeholder: string | undefined; - - /** - * If the input value should be hidden. Defaults to false. - */ - password: boolean; - - /** - * An event signaling when the value has changed. - */ - readonly onDidChangeValue: Event; - - /** - * An event signaling when the user indicated acceptance of the input value. - */ - readonly onDidAccept: Event; - - /** - * Buttons for actions in the UI. - */ - buttons: readonly QuickInputButton[]; - - /** - * An event signaling when a button was triggered. - */ - readonly onDidTriggerButton: Event; - - /** - * An optional prompt text providing some ask or explanation to the user. - */ - prompt: string | undefined; - - /** - * An optional validation message indicating a problem with the current input value. - * By returning a string, the InputBox will use a default {@link InputBoxValidationSeverity} of Error. - * Returning undefined clears the validation message. - */ - validationMessage: string | InputBoxValidationMessage | undefined; - } - - /** - * Button for an action in a {@link QuickPick} or {@link InputBox}. - */ - export interface QuickInputButton { - /** - * Icon for the button. - */ - readonly iconPath: IconPath; - /** - * An optional tooltip. - */ - readonly tooltip?: string | undefined; - } - - /** - * Predefined buttons for {@link QuickPick} and {@link InputBox}. - */ - export class QuickInputButtons { - /** - * A back button for {@link QuickPick} and {@link InputBox}. - * - * When a navigation 'back' button is needed this one should be used for consistency. - * It comes with a predefined icon, tooltip and location. - */ - static readonly Back: QuickInputButton; - - /** - * @hidden - */ - private constructor(); - } - - /** - * An event signaling when a button in a particular {@link QuickPickItem} was triggered. - * This event does not fire for buttons in the title bar. - */ - export interface QuickPickItemButtonEvent { - /** - * The button that was clicked. - */ - readonly button: QuickInputButton; - /** - * The item that the button belongs to. - */ - readonly item: T; - } - - /** - * An event describing an individual change in the text of a {@link TextDocument document}. - */ - export interface TextDocumentContentChangeEvent { - /** - * The range that got replaced. - */ - readonly range: Range; - /** - * The offset of the range that got replaced. - */ - readonly rangeOffset: number; - /** - * The length of the range that got replaced. - */ - readonly rangeLength: number; - /** - * The new text for the range. - */ - readonly text: string; - } - - /** - * Reasons for why a text document has changed. - */ - export enum TextDocumentChangeReason { - /** The text change is caused by an undo operation. */ - Undo = 1, - - /** The text change is caused by an redo operation. */ - Redo = 2, - } - - /** - * An event describing a transactional {@link TextDocument document} change. - */ - export interface TextDocumentChangeEvent { - /** - * The affected document. - */ - readonly document: TextDocument; - - /** - * An array of content changes. - */ - readonly contentChanges: readonly TextDocumentContentChangeEvent[]; - - /** - * The reason why the document was changed. - * Is `undefined` if the reason is not known. - */ - readonly reason: TextDocumentChangeReason | undefined; - } - - /** - * Represents reasons why a text document is saved. - */ - export enum TextDocumentSaveReason { - /** - * Manually triggered, e.g. by the user pressing save, by starting debugging, - * or by an API call. - */ - Manual = 1, - - /** - * Automatic after a delay. - */ - AfterDelay = 2, - - /** - * When the editor lost focus. - */ - FocusOut = 3, - } - - /** - * An event that is fired when a {@link TextDocument document} will be saved. - * - * To make modifications to the document before it is being saved, call the - * {@linkcode TextDocumentWillSaveEvent.waitUntil waitUntil}-function with a thenable - * that resolves to an array of {@link TextEdit text edits}. - */ - export interface TextDocumentWillSaveEvent { - /** - * The document that will be saved. - */ - readonly document: TextDocument; - - /** - * The reason why save was triggered. - */ - readonly reason: TextDocumentSaveReason; - - /** - * Allows to pause the event loop and to apply {@link TextEdit pre-save-edits}. - * Edits of subsequent calls to this function will be applied in order. The - * edits will be *ignored* if concurrent modifications of the document happened. - * - * *Note:* This function can only be called during event dispatch and not - * in an asynchronous manner: - * - * ```ts - * workspace.onWillSaveTextDocument(event => { - * // async, will *throw* an error - * setTimeout(() => event.waitUntil(promise)); - * - * // sync, OK - * event.waitUntil(promise); - * }) - * ``` - * - * @param thenable A thenable that resolves to {@link TextEdit pre-save-edits}. - */ - waitUntil(thenable: Thenable): void; - - /** - * Allows to pause the event loop until the provided thenable resolved. - * - * *Note:* This function can only be called during event dispatch. - * - * @param thenable A thenable that delays saving. - */ - waitUntil(thenable: Thenable): void; - } - - /** - * An event that is fired when files are going to be created. - * - * To make modifications to the workspace before the files are created, - * call the {@linkcode FileWillCreateEvent.waitUntil waitUntil}-function with a - * thenable that resolves to a {@link WorkspaceEdit workspace edit}. - */ - export interface FileWillCreateEvent { - /** - * A cancellation token. - */ - readonly token: CancellationToken; - - /** - * The files that are going to be created. - */ - readonly files: readonly Uri[]; - - /** - * Allows to pause the event and to apply a {@link WorkspaceEdit workspace edit}. - * - * *Note:* This function can only be called during event dispatch and not - * in an asynchronous manner: - * - * ```ts - * workspace.onWillCreateFiles(event => { - * // async, will *throw* an error - * setTimeout(() => event.waitUntil(promise)); - * - * // sync, OK - * event.waitUntil(promise); - * }) - * ``` - * - * @param thenable A thenable that delays saving. - */ - waitUntil(thenable: Thenable): void; - - /** - * Allows to pause the event until the provided thenable resolves. - * - * *Note:* This function can only be called during event dispatch. - * - * @param thenable A thenable that delays saving. - */ - waitUntil(thenable: Thenable): void; - } - - /** - * An event that is fired after files are created. - */ - export interface FileCreateEvent { - /** - * The files that got created. - */ - readonly files: readonly Uri[]; - } - - /** - * An event that is fired when files are going to be deleted. - * - * To make modifications to the workspace before the files are deleted, - * call the {@link FileWillCreateEvent.waitUntil `waitUntil`}-function with a - * thenable that resolves to a {@link WorkspaceEdit workspace edit}. - */ - export interface FileWillDeleteEvent { - /** - * A cancellation token. - */ - readonly token: CancellationToken; - - /** - * The files that are going to be deleted. - */ - readonly files: readonly Uri[]; - - /** - * Allows to pause the event and to apply a {@link WorkspaceEdit workspace edit}. - * - * *Note:* This function can only be called during event dispatch and not - * in an asynchronous manner: - * - * ```ts - * workspace.onWillCreateFiles(event => { - * // async, will *throw* an error - * setTimeout(() => event.waitUntil(promise)); - * - * // sync, OK - * event.waitUntil(promise); - * }) - * ``` - * - * @param thenable A thenable that delays saving. - */ - waitUntil(thenable: Thenable): void; - - /** - * Allows to pause the event until the provided thenable resolves. - * - * *Note:* This function can only be called during event dispatch. - * - * @param thenable A thenable that delays saving. - */ - waitUntil(thenable: Thenable): void; - } - - /** - * An event that is fired after files are deleted. - */ - export interface FileDeleteEvent { - /** - * The files that got deleted. - */ - readonly files: readonly Uri[]; - } - - /** - * An event that is fired when files are going to be renamed. - * - * To make modifications to the workspace before the files are renamed, - * call the {@link FileWillCreateEvent.waitUntil `waitUntil`}-function with a - * thenable that resolves to a {@link WorkspaceEdit workspace edit}. - */ - export interface FileWillRenameEvent { - /** - * A cancellation token. - */ - readonly token: CancellationToken; - - /** - * The files that are going to be renamed. - */ - readonly files: ReadonlyArray<{ - /** - * The old uri of a file. - */ - readonly oldUri: Uri; - /** - * The new uri of a file. - */ - readonly newUri: Uri; - }>; - - /** - * Allows to pause the event and to apply a {@link WorkspaceEdit workspace edit}. - * - * *Note:* This function can only be called during event dispatch and not - * in an asynchronous manner: - * - * ```ts - * workspace.onWillCreateFiles(event => { - * // async, will *throw* an error - * setTimeout(() => event.waitUntil(promise)); - * - * // sync, OK - * event.waitUntil(promise); - * }) - * ``` - * - * @param thenable A thenable that delays saving. - */ - waitUntil(thenable: Thenable): void; - - /** - * Allows to pause the event until the provided thenable resolves. - * - * *Note:* This function can only be called during event dispatch. - * - * @param thenable A thenable that delays saving. - */ - waitUntil(thenable: Thenable): void; - } - - /** - * An event that is fired after files are renamed. - */ - export interface FileRenameEvent { - /** - * The files that got renamed. - */ - readonly files: ReadonlyArray<{ - /** - * The old uri of a file. - */ - readonly oldUri: Uri; - /** - * The new uri of a file. - */ - readonly newUri: Uri; - }>; - } - - /** - * An event describing a change to the set of {@link workspace.workspaceFolders workspace folders}. - */ - export interface WorkspaceFoldersChangeEvent { - /** - * Added workspace folders. - */ - readonly added: readonly WorkspaceFolder[]; - - /** - * Removed workspace folders. - */ - readonly removed: readonly WorkspaceFolder[]; - } - - /** - * A workspace folder is one of potentially many roots opened by the editor. All workspace folders - * are equal which means there is no notion of an active or primary workspace folder. - */ - export interface WorkspaceFolder { - /** - * The associated uri for this workspace folder. - * - * *Note:* The {@link Uri}-type was intentionally chosen such that future releases of the editor can support - * workspace folders that are not stored on the local disk, e.g. `ftp://server/workspaces/foo`. - */ - readonly uri: Uri; - - /** - * The name of this workspace folder. Defaults to - * the basename of its {@link Uri.path uri-path} - */ - readonly name: string; - - /** - * The ordinal number of this workspace folder. - */ - readonly index: number; - } - - /** - * Namespace for dealing with the current workspace. A workspace is the collection of one - * or more folders that are opened in an editor window (instance). - * - * It is also possible to open an editor without a workspace. For example, when you open a - * new editor window by selecting a file from your platform's File menu, you will not be - * inside a workspace. In this mode, some of the editor's capabilities are reduced but you can - * still open text files and edit them. - * - * Refer to https://code.visualstudio.com/docs/editor/workspaces for more information on - * the concept of workspaces. - * - * The workspace offers support for {@link workspace.createFileSystemWatcher listening} to fs - * events and for {@link workspace.findFiles finding} files. Both perform well and run _outside_ - * the editor-process so that they should be always used instead of nodejs-equivalents. - */ - export namespace workspace { - /** - * A {@link FileSystem file system} instance that allows to interact with local and remote - * files, e.g. `vscode.workspace.fs.readDirectory(someUri)` allows to retrieve all entries - * of a directory or `vscode.workspace.fs.stat(anotherUri)` returns the meta data for a - * file. - */ - export const fs: FileSystem; - - /** - * The uri of the first entry of {@linkcode workspace.workspaceFolders workspaceFolders} - * as `string`. `undefined` if there is no first entry. - * - * Refer to https://code.visualstudio.com/docs/editor/workspaces for more information - * on workspaces. - * - * @deprecated Use {@linkcode workspace.workspaceFolders workspaceFolders} instead. - */ - export const rootPath: string | undefined; - - /** - * List of workspace folders (0-N) that are open in the editor. `undefined` when no workspace - * has been opened. - * - * Refer to https://code.visualstudio.com/docs/editor/workspaces for more information - * on workspaces. - */ - export const workspaceFolders: readonly WorkspaceFolder[] | undefined; - - /** - * The name of the workspace. `undefined` when no workspace - * has been opened. - * - * Refer to https://code.visualstudio.com/docs/editor/workspaces for more information on - * the concept of workspaces. - */ - export const name: string | undefined; - - /** - * The location of the workspace file, for example: - * - * `file:///Users/name/Development/myProject.code-workspace` - * - * or - * - * `untitled:1555503116870` - * - * for a workspace that is untitled and not yet saved. - * - * Depending on the workspace that is opened, the value will be: - * * `undefined` when no workspace is opened - * * the path of the workspace file as `Uri` otherwise. if the workspace - * is untitled, the returned URI will use the `untitled:` scheme - * - * The location can e.g. be used with the `vscode.openFolder` command to - * open the workspace again after it has been closed. - * - * **Example:** - * ```typescript - * vscode.commands.executeCommand('vscode.openFolder', uriOfWorkspace); - * ``` - * - * Refer to https://code.visualstudio.com/docs/editor/workspaces for more information on - * the concept of workspaces. - * - * **Note:** it is not advised to use `workspace.workspaceFile` to write - * configuration data into the file. You can use `workspace.getConfiguration().update()` - * for that purpose which will work both when a single folder is opened as - * well as an untitled or saved workspace. - */ - export const workspaceFile: Uri | undefined; - - /** - * An event that is emitted when a workspace folder is added or removed. - * - * **Note:** this event will not fire if the first workspace folder is added, removed or changed, - * because in that case the currently executing extensions (including the one that listens to this - * event) will be terminated and restarted so that the (deprecated) `rootPath` property is updated - * to point to the first workspace folder. - */ - export const onDidChangeWorkspaceFolders: Event; - - /** - * Returns the {@link WorkspaceFolder workspace folder} that contains a given uri. - * * returns `undefined` when the given uri doesn't match any workspace folder - * * returns the *input* when the given uri is a workspace folder itself - * - * @param uri An uri. - * @returns A workspace folder or `undefined` - */ - export function getWorkspaceFolder( - uri: Uri, - ): WorkspaceFolder | undefined; - - /** - * Returns a path that is relative to the workspace folder or folders. - * - * When there are no {@link workspace.workspaceFolders workspace folders} or when the path - * is not contained in them, the input is returned. - * - * @param pathOrUri A path or uri. When a uri is given its {@link Uri.fsPath fsPath} is used. - * @param includeWorkspaceFolder When `true` and when the given path is contained inside a - * workspace folder the name of the workspace is prepended. Defaults to `true` when there are - * multiple workspace folders and `false` otherwise. - * @returns A path relative to the root or the input. - */ - export function asRelativePath( - pathOrUri: string | Uri, - includeWorkspaceFolder?: boolean, - ): string; - - /** - * This method replaces `deleteCount` {@link workspace.workspaceFolders workspace folders} starting at index `start` - * by an optional set of `workspaceFoldersToAdd` on the `vscode.workspace.workspaceFolders` array. This "splice" - * behavior can be used to add, remove and change workspace folders in a single operation. - * - * **Note:** in some cases calling this method may result in the currently executing extensions (including the - * one that called this method) to be terminated and restarted. For example when the first workspace folder is - * added, removed or changed the (deprecated) `rootPath` property is updated to point to the first workspace - * folder. Another case is when transitioning from an empty or single-folder workspace into a multi-folder - * workspace (see also: https://code.visualstudio.com/docs/editor/workspaces). - * - * Use the {@linkcode onDidChangeWorkspaceFolders onDidChangeWorkspaceFolders()} event to get notified when the - * workspace folders have been updated. - * - * **Example:** adding a new workspace folder at the end of workspace folders - * ```typescript - * workspace.updateWorkspaceFolders(workspace.workspaceFolders ? workspace.workspaceFolders.length : 0, null, { uri: ...}); - * ``` - * - * **Example:** removing the first workspace folder - * ```typescript - * workspace.updateWorkspaceFolders(0, 1); - * ``` - * - * **Example:** replacing an existing workspace folder with a new one - * ```typescript - * workspace.updateWorkspaceFolders(0, 1, { uri: ...}); - * ``` - * - * It is valid to remove an existing workspace folder and add it again with a different name - * to rename that folder. - * - * **Note:** it is not valid to call {@link updateWorkspaceFolders updateWorkspaceFolders()} multiple times - * without waiting for the {@linkcode onDidChangeWorkspaceFolders onDidChangeWorkspaceFolders()} to fire. - * - * @param start the zero-based location in the list of currently opened {@link WorkspaceFolder workspace folders} - * from which to start deleting workspace folders. - * @param deleteCount the optional number of workspace folders to remove. - * @param workspaceFoldersToAdd the optional variable set of workspace folders to add in place of the deleted ones. - * Each workspace is identified with a mandatory URI and an optional name. - * @returns true if the operation was successfully started and false otherwise if arguments were used that would result - * in invalid workspace folder state (e.g. 2 folders with the same URI). - */ - export function updateWorkspaceFolders( - start: number, - deleteCount: number | undefined | null, - ...workspaceFoldersToAdd: { - /** - * The uri of a workspace folder that's to be added. - */ - readonly uri: Uri; - /** - * The name of a workspace folder that's to be added. - */ - readonly name?: string; - }[] - ): boolean; - - /** - * Creates a file system watcher that is notified on file events (create, change, delete) - * depending on the parameters provided. - * - * By default, all opened {@link workspace.workspaceFolders workspace folders} will be watched - * for file changes recursively. - * - * Additional paths can be added for file watching by providing a {@link RelativePattern} with - * a `base` path to watch. If the path is a folder and the `pattern` is complex (e.g. contains - * `**` or path segments), it will be watched recursively and otherwise will be watched - * non-recursively (i.e. only changes to the first level of the path will be reported). - * - * *Note* that paths that do not exist in the file system will be monitored with a delay until - * created and then watched depending on the parameters provided. If a watched path is deleted, - * the watcher will suspend and not report any events until the path is created again. - * - * If possible, keep the use of recursive watchers to a minimum because recursive file watching - * is quite resource intense. - * - * Providing a `string` as `globPattern` acts as convenience method for watching file events in - * all opened workspace folders. It cannot be used to add more folders for file watching, nor will - * it report any file events from folders that are not part of the opened workspace folders. - * - * Optionally, flags to ignore certain kinds of events can be provided. - * - * To stop listening to events the watcher must be disposed. - * - * *Note* that file events from recursive file watchers may be excluded based on user configuration. - * The setting `files.watcherExclude` helps to reduce the overhead of file events from folders - * that are known to produce many file changes at once (such as `.git` folders). As such, - * it is highly recommended to watch with simple patterns that do not require recursive watchers - * where the exclude settings are ignored and you have full control over the events. - * - * *Note* that symbolic links are not automatically followed for file watching unless the path to - * watch itself is a symbolic link. - * - * *Note* that the file paths that are reported for having changed may have a different path casing - * compared to the actual casing on disk on case-insensitive platforms (typically macOS and Windows - * but not Linux). We allow a user to open a workspace folder with any desired path casing and try - * to preserve that. This means: - * * if the path is within any of the workspace folders, the path will match the casing of the - * workspace folder up to that portion of the path and match the casing on disk for children - * * if the path is outside of any of the workspace folders, the casing will match the case of the - * path that was provided for watching - * In the same way, symbolic links are preserved, i.e. the file event will report the path of the - * symbolic link as it was provided for watching and not the target. - * - * ### Examples - * - * The basic anatomy of a file watcher is as follows: - * - * ```ts - * const watcher = vscode.workspace.createFileSystemWatcher(new vscode.RelativePattern(, )); - * - * watcher.onDidChange(uri => { ... }); // listen to files being changed - * watcher.onDidCreate(uri => { ... }); // listen to files/folders being created - * watcher.onDidDelete(uri => { ... }); // listen to files/folders getting deleted - * - * watcher.dispose(); // dispose after usage - * ``` - * - * #### Workspace file watching - * - * If you only care about file events in a specific workspace folder: - * - * ```ts - * vscode.workspace.createFileSystemWatcher(new vscode.RelativePattern(vscode.workspace.workspaceFolders[0], '**​/*.js')); - * ``` - * - * If you want to monitor file events across all opened workspace folders: - * - * ```ts - * vscode.workspace.createFileSystemWatcher('**​/*.js'); - * ``` - * - * *Note:* the array of workspace folders can be empty if no workspace is opened (empty window). - * - * #### Out of workspace file watching - * - * To watch a folder for changes to *.js files outside the workspace (non recursively), pass in a `Uri` to such - * a folder: - * - * ```ts - * vscode.workspace.createFileSystemWatcher(new vscode.RelativePattern(vscode.Uri.file(), '*.js')); - * ``` - * - * And use a complex glob pattern to watch recursively: - * - * ```ts - * vscode.workspace.createFileSystemWatcher(new vscode.RelativePattern(vscode.Uri.file(), '**​/*.js')); - * ``` - * - * Here is an example for watching the active editor for file changes: - * - * ```ts - * vscode.workspace.createFileSystemWatcher(new vscode.RelativePattern(vscode.window.activeTextEditor.document.uri, '*')); - * ``` - * - * @param globPattern A {@link GlobPattern glob pattern} that controls which file events the watcher should report. - * @param ignoreCreateEvents Ignore when files have been created. - * @param ignoreChangeEvents Ignore when files have been changed. - * @param ignoreDeleteEvents Ignore when files have been deleted. - * @returns A new file system watcher instance. Must be disposed when no longer needed. - */ - export function createFileSystemWatcher( - globPattern: GlobPattern, - ignoreCreateEvents?: boolean, - ignoreChangeEvents?: boolean, - ignoreDeleteEvents?: boolean, - ): FileSystemWatcher; - - /** - * Find files across all {@link workspace.workspaceFolders workspace folders} in the workspace. - * - * @example - * findFiles('**​/*.js', '**​/node_modules/**', 10) - * - * @param include A {@link GlobPattern glob pattern} that defines the files to search for. The glob pattern - * will be matched against the file paths of resulting matches relative to their workspace. Use a {@link RelativePattern relative pattern} - * to restrict the search results to a {@link WorkspaceFolder workspace folder}. - * @param exclude A {@link GlobPattern glob pattern} that defines files and folders to exclude. The glob pattern - * will be matched against the file paths of resulting matches relative to their workspace. When `undefined`, default file-excludes (e.g. the `files.exclude`-setting - * but not `search.exclude`) will apply. When `null`, no excludes will apply. - * @param maxResults An upper-bound for the result. - * @param token A token that can be used to signal cancellation to the underlying search engine. - * @returns A thenable that resolves to an array of resource identifiers. Will return no results if no - * {@link workspace.workspaceFolders workspace folders} are opened. - */ - export function findFiles( - include: GlobPattern, - exclude?: GlobPattern | null, - maxResults?: number, - token?: CancellationToken, - ): Thenable; - - /** - * Saves the editor identified by the given resource and returns the resulting resource or `undefined` - * if save was not successful or no editor with the given resource was found. - * - * **Note** that an editor with the provided resource must be opened in order to be saved. - * - * @param uri the associated uri for the opened editor to save. - * @returns A thenable that resolves when the save operation has finished. - */ - export function save(uri: Uri): Thenable; - - /** - * Saves the editor identified by the given resource to a new file name as provided by the user and - * returns the resulting resource or `undefined` if save was not successful or cancelled or no editor - * with the given resource was found. - * - * **Note** that an editor with the provided resource must be opened in order to be saved as. - * - * @param uri the associated uri for the opened editor to save as. - * @returns A thenable that resolves when the save-as operation has finished. - */ - export function saveAs(uri: Uri): Thenable; - - /** - * Save all dirty files. - * - * @param includeUntitled Also save files that have been created during this session. - * @returns A thenable that resolves when the files have been saved. Will return `false` - * for any file that failed to save. - */ - export function saveAll(includeUntitled?: boolean): Thenable; - - /** - * Make changes to one or many resources or create, delete, and rename resources as defined by the given - * {@link WorkspaceEdit workspace edit}. - * - * All changes of a workspace edit are applied in the same order in which they have been added. If - * multiple textual inserts are made at the same position, these strings appear in the resulting text - * in the order the 'inserts' were made, unless that are interleaved with resource edits. Invalid sequences - * like 'delete file a' -> 'insert text in file a' cause failure of the operation. - * - * When applying a workspace edit that consists only of text edits an 'all-or-nothing'-strategy is used. - * A workspace edit with resource creations or deletions aborts the operation, e.g. consecutive edits will - * not be attempted, when a single edit fails. - * - * @param edit A workspace edit. - * @param metadata Optional {@link WorkspaceEditMetadata metadata} for the edit. - * @returns A thenable that resolves when the edit could be applied. - */ - export function applyEdit( - edit: WorkspaceEdit, - metadata?: WorkspaceEditMetadata, - ): Thenable; - - /** - * All text documents currently known to the editor. - */ - export const textDocuments: readonly TextDocument[]; - - /** - * Opens a document. Will return early if this document is already open. Otherwise - * the document is loaded and the {@link workspace.onDidOpenTextDocument didOpen}-event fires. - * - * The document is denoted by an {@link Uri}. Depending on the {@link Uri.scheme scheme} the - * following rules apply: - * * `file`-scheme: Open a file on disk (`openTextDocument(Uri.file(path))`). Will be rejected if the file - * does not exist or cannot be loaded. - * * `untitled`-scheme: Open a blank untitled file with associated path (`openTextDocument(Uri.file(path).with({ scheme: 'untitled' }))`). - * The language will be derived from the file name. - * * For all other schemes contributed {@link TextDocumentContentProvider text document content providers} and - * {@link FileSystemProvider file system providers} are consulted. - * - * *Note* that the lifecycle of the returned document is owned by the editor and not by the extension. That means an - * {@linkcode workspace.onDidCloseTextDocument onDidClose}-event can occur at any time after opening it. - * - * @param uri Identifies the resource to open. - * @returns A promise that resolves to a {@link TextDocument document}. - */ - export function openTextDocument(uri: Uri): Thenable; - - /** - * A short-hand for `openTextDocument(Uri.file(path))`. - * - * @see {@link workspace.openTextDocument} - * @param path A path of a file on disk. - * @returns A promise that resolves to a {@link TextDocument document}. - */ - export function openTextDocument(path: string): Thenable; - - /** - * Opens an untitled text document. The editor will prompt the user for a file - * path when the document is to be saved. The `options` parameter allows to - * specify the *language* and/or the *content* of the document. - * - * @param options Options to control how the document will be created. - * @returns A promise that resolves to a {@link TextDocument document}. - */ - export function openTextDocument(options?: { - /** - * The {@link TextDocument.languageId language} of the document. - */ - language?: string; - /** - * The initial contents of the document. - */ - content?: string; - }): Thenable; - - /** - * Register a text document content provider. - * - * Only one provider can be registered per scheme. - * - * @param scheme The uri-scheme to register for. - * @param provider A content provider. - * @returns A {@link Disposable} that unregisters this provider when being disposed. - */ - export function registerTextDocumentContentProvider( - scheme: string, - provider: TextDocumentContentProvider, - ): Disposable; - - /** - * An event that is emitted when a {@link TextDocument text document} is opened or when the language id - * of a text document {@link languages.setTextDocumentLanguage has been changed}. - * - * To add an event listener when a visible text document is opened, use the {@link TextEditor} events in the - * {@link window} namespace. Note that: - * - * - The event is emitted before the {@link TextDocument document} is updated in the - * {@link window.activeTextEditor active text editor} - * - When a {@link TextDocument text document} is already open (e.g.: open in another {@link window.visibleTextEditors visible text editor}) this event is not emitted - * - */ - export const onDidOpenTextDocument: Event; - - /** - * An event that is emitted when a {@link TextDocument text document} is disposed or when the language id - * of a text document {@link languages.setTextDocumentLanguage has been changed}. - * - * *Note 1:* There is no guarantee that this event fires when an editor tab is closed, use the - * {@linkcode window.onDidChangeVisibleTextEditors onDidChangeVisibleTextEditors}-event to know when editors change. - * - * *Note 2:* A document can be open but not shown in an editor which means this event can fire - * for a document that has not been shown in an editor. - */ - export const onDidCloseTextDocument: Event; - - /** - * An event that is emitted when a {@link TextDocument text document} is changed. This usually happens - * when the {@link TextDocument.getText contents} changes but also when other things like the - * {@link TextDocument.isDirty dirty}-state changes. - */ - export const onDidChangeTextDocument: Event; - - /** - * An event that is emitted when a {@link TextDocument text document} will be saved to disk. - * - * *Note 1:* Subscribers can delay saving by registering asynchronous work. For the sake of data integrity the editor - * might save without firing this event. For instance when shutting down with dirty files. - * - * *Note 2:* Subscribers are called sequentially and they can {@link TextDocumentWillSaveEvent.waitUntil delay} saving - * by registering asynchronous work. Protection against misbehaving listeners is implemented as such: - * * there is an overall time budget that all listeners share and if that is exhausted no further listener is called - * * listeners that take a long time or produce errors frequently will not be called anymore - * - * The current thresholds are 1.5 seconds as overall time budget and a listener can misbehave 3 times before being ignored. - */ - export const onWillSaveTextDocument: Event; - - /** - * An event that is emitted when a {@link TextDocument text document} is saved to disk. - */ - export const onDidSaveTextDocument: Event; - - /** - * All notebook documents currently known to the editor. - */ - export const notebookDocuments: readonly NotebookDocument[]; - - /** - * Open a notebook. Will return early if this notebook is already {@link notebookDocuments loaded}. Otherwise - * the notebook is loaded and the {@linkcode onDidOpenNotebookDocument}-event fires. - * - * *Note* that the lifecycle of the returned notebook is owned by the editor and not by the extension. That means an - * {@linkcode onDidCloseNotebookDocument}-event can occur at any time after. - * - * *Note* that opening a notebook does not show a notebook editor. This function only returns a notebook document which - * can be shown in a notebook editor but it can also be used for other things. - * - * @param uri The resource to open. - * @returns A promise that resolves to a {@link NotebookDocument notebook} - */ - export function openNotebookDocument( - uri: Uri, - ): Thenable; - - /** - * Open an untitled notebook. The editor will prompt the user for a file - * path when the document is to be saved. - * - * @see {@link workspace.openNotebookDocument} - * @param notebookType The notebook type that should be used. - * @param content The initial contents of the notebook. - * @returns A promise that resolves to a {@link NotebookDocument notebook}. - */ - export function openNotebookDocument( - notebookType: string, - content?: NotebookData, - ): Thenable; - - /** - * An event that is emitted when a {@link NotebookDocument notebook} has changed. - */ - export const onDidChangeNotebookDocument: Event; - - /** - * An event that is emitted when a {@link NotebookDocument notebook document} will be saved to disk. - * - * *Note 1:* Subscribers can delay saving by registering asynchronous work. For the sake of data integrity the editor - * might save without firing this event. For instance when shutting down with dirty files. - * - * *Note 2:* Subscribers are called sequentially and they can {@link NotebookDocumentWillSaveEvent.waitUntil delay} saving - * by registering asynchronous work. Protection against misbehaving listeners is implemented as such: - * * there is an overall time budget that all listeners share and if that is exhausted no further listener is called - * * listeners that take a long time or produce errors frequently will not be called anymore - * - * The current thresholds are 1.5 seconds as overall time budget and a listener can misbehave 3 times before being ignored. - */ - export const onWillSaveNotebookDocument: Event; - - /** - * An event that is emitted when a {@link NotebookDocument notebook} is saved. - */ - export const onDidSaveNotebookDocument: Event; - - /** - * Register a {@link NotebookSerializer notebook serializer}. - * - * A notebook serializer must be contributed through the `notebooks` extension point. When opening a notebook file, the editor will send - * the `onNotebook:` activation event, and extensions must register their serializer in return. - * - * @param notebookType A notebook. - * @param serializer A notebook serializer. - * @param options Optional context options that define what parts of a notebook should be persisted - * @returns A {@link Disposable} that unregisters this serializer when being disposed. - */ - export function registerNotebookSerializer( - notebookType: string, - serializer: NotebookSerializer, - options?: NotebookDocumentContentOptions, - ): Disposable; - - /** - * An event that is emitted when a {@link NotebookDocument notebook} is opened. - */ - export const onDidOpenNotebookDocument: Event; - - /** - * An event that is emitted when a {@link NotebookDocument notebook} is disposed. - * - * *Note 1:* There is no guarantee that this event fires when an editor tab is closed. - * - * *Note 2:* A notebook can be open but not shown in an editor which means this event can fire - * for a notebook that has not been shown in an editor. - */ - export const onDidCloseNotebookDocument: Event; - - /** - * An event that is emitted when files are being created. - * - * *Note 1:* This event is triggered by user gestures, like creating a file from the - * explorer, or from the {@linkcode workspace.applyEdit}-api. This event is *not* fired when - * files change on disk, e.g triggered by another application, or when using the - * {@linkcode FileSystem workspace.fs}-api. - * - * *Note 2:* When this event is fired, edits to files that are are being created cannot be applied. - */ - export const onWillCreateFiles: Event; - - /** - * An event that is emitted when files have been created. - * - * *Note:* This event is triggered by user gestures, like creating a file from the - * explorer, or from the {@linkcode workspace.applyEdit}-api, but this event is *not* fired when - * files change on disk, e.g triggered by another application, or when using the - * {@linkcode FileSystem workspace.fs}-api. - */ - export const onDidCreateFiles: Event; - - /** - * An event that is emitted when files are being deleted. - * - * *Note 1:* This event is triggered by user gestures, like deleting a file from the - * explorer, or from the {@linkcode workspace.applyEdit}-api, but this event is *not* fired when - * files change on disk, e.g triggered by another application, or when using the - * {@linkcode FileSystem workspace.fs}-api. - * - * *Note 2:* When deleting a folder with children only one event is fired. - */ - export const onWillDeleteFiles: Event; - - /** - * An event that is emitted when files have been deleted. - * - * *Note 1:* This event is triggered by user gestures, like deleting a file from the - * explorer, or from the {@linkcode workspace.applyEdit}-api, but this event is *not* fired when - * files change on disk, e.g triggered by another application, or when using the - * {@linkcode FileSystem workspace.fs}-api. - * - * *Note 2:* When deleting a folder with children only one event is fired. - */ - export const onDidDeleteFiles: Event; - - /** - * An event that is emitted when files are being renamed. - * - * *Note 1:* This event is triggered by user gestures, like renaming a file from the - * explorer, and from the {@linkcode workspace.applyEdit}-api, but this event is *not* fired when - * files change on disk, e.g triggered by another application, or when using the - * {@linkcode FileSystem workspace.fs}-api. - * - * *Note 2:* When renaming a folder with children only one event is fired. - */ - export const onWillRenameFiles: Event; - - /** - * An event that is emitted when files have been renamed. - * - * *Note 1:* This event is triggered by user gestures, like renaming a file from the - * explorer, and from the {@linkcode workspace.applyEdit}-api, but this event is *not* fired when - * files change on disk, e.g triggered by another application, or when using the - * {@linkcode FileSystem workspace.fs}-api. - * - * *Note 2:* When renaming a folder with children only one event is fired. - */ - export const onDidRenameFiles: Event; - - /** - * Get a workspace configuration object. - * - * When a section-identifier is provided only that part of the configuration - * is returned. Dots in the section-identifier are interpreted as child-access, - * like `{ myExt: { setting: { doIt: true }}}` and `getConfiguration('myExt.setting').get('doIt') === true`. - * - * When a scope is provided configuration confined to that scope is returned. Scope can be a resource or a language identifier or both. - * - * @param section A dot-separated identifier. - * @param scope A scope for which the configuration is asked for. - * @returns The full configuration or a subset. - */ - export function getConfiguration( - section?: string, - scope?: ConfigurationScope | null, - ): WorkspaceConfiguration; - - /** - * An event that is emitted when the {@link WorkspaceConfiguration configuration} changed. - */ - export const onDidChangeConfiguration: Event; - - /** - * Register a task provider. - * - * @deprecated Use the corresponding function on the `tasks` namespace instead - * - * @param type The task kind type this provider is registered for. - * @param provider A task provider. - * @returns A {@link Disposable} that unregisters this provider when being disposed. - */ - export function registerTaskProvider( - type: string, - provider: TaskProvider, - ): Disposable; - - /** - * Register a filesystem provider for a given scheme, e.g. `ftp`. - * - * There can only be one provider per scheme and an error is being thrown when a scheme - * has been claimed by another provider or when it is reserved. - * - * @param scheme The uri-{@link Uri.scheme scheme} the provider registers for. - * @param provider The filesystem provider. - * @param options Immutable metadata about the provider. - * @returns A {@link Disposable} that unregisters this provider when being disposed. - */ - export function registerFileSystemProvider( - scheme: string, - provider: FileSystemProvider, - options?: { - /** - * Whether the file system provider use case sensitive compare for {@link Uri.path paths} - */ - readonly isCaseSensitive?: boolean; - /** - * Whether the file system provider is readonly, no modifications like write, delete, create are possible. - * If a {@link MarkdownString} is given, it will be shown as the reason why the file system is readonly. - */ - readonly isReadonly?: boolean | MarkdownString; - }, - ): Disposable; - - /** - * When true, the user has explicitly trusted the contents of the workspace. - */ - export const isTrusted: boolean; - - /** - * Event that fires when the current workspace has been trusted. - */ - export const onDidGrantWorkspaceTrust: Event; - } - - /** - * The configuration scope which can be a - * a 'resource' or a languageId or both or - * a '{@link TextDocument}' or - * a '{@link WorkspaceFolder}' - */ - export type ConfigurationScope = - | Uri - | TextDocument - | WorkspaceFolder - | { - /** - * The uri of a {@link TextDocument text document} - */ - uri?: Uri; - /** - * The language of a text document - */ - languageId: string; - }; - - /** - * An event describing the change in Configuration - */ - export interface ConfigurationChangeEvent { - /** - * Checks if the given section has changed. - * If scope is provided, checks if the section has changed for resources under the given scope. - * - * @param section Configuration name, supports _dotted_ names. - * @param scope A scope in which to check. - * @returns `true` if the given section has changed. - */ - affectsConfiguration( - section: string, - scope?: ConfigurationScope, - ): boolean; - } - - /** - * Namespace for participating in language-specific editor [features](https://code.visualstudio.com/docs/editor/editingevolved), - * like IntelliSense, code actions, diagnostics etc. - * - * Many programming languages exist and there is huge variety in syntaxes, semantics, and paradigms. Despite that, features - * like automatic word-completion, code navigation, or code checking have become popular across different tools for different - * programming languages. - * - * The editor provides an API that makes it simple to provide such common features by having all UI and actions already in place and - * by allowing you to participate by providing data only. For instance, to contribute a hover all you have to do is provide a function - * that can be called with a {@link TextDocument} and a {@link Position} returning hover info. The rest, like tracking the - * mouse, positioning the hover, keeping the hover stable etc. is taken care of by the editor. - * - * ```javascript - * languages.registerHoverProvider('javascript', { - * provideHover(document, position, token) { - * return new Hover('I am a hover!'); - * } - * }); - * ``` - * - * Registration is done using a {@link DocumentSelector document selector} which is either a language id, like `javascript` or - * a more complex {@link DocumentFilter filter} like `{ language: 'typescript', scheme: 'file' }`. Matching a document against such - * a selector will result in a {@link languages.match score} that is used to determine if and how a provider shall be used. When - * scores are equal the provider that came last wins. For features that allow full arity, like {@link languages.registerHoverProvider hover}, - * the score is only checked to be `>0`, for other features, like {@link languages.registerCompletionItemProvider IntelliSense} the - * score is used for determining the order in which providers are asked to participate. - */ - export namespace languages { - /** - * Return the identifiers of all known languages. - * @returns Promise resolving to an array of identifier strings. - */ - export function getLanguages(): Thenable; - - /** - * Set (and change) the {@link TextDocument.languageId language} that is associated - * with the given document. - * - * *Note* that calling this function will trigger the {@linkcode workspace.onDidCloseTextDocument onDidCloseTextDocument} event - * followed by the {@linkcode workspace.onDidOpenTextDocument onDidOpenTextDocument} event. - * - * @param document The document which language is to be changed - * @param languageId The new language identifier. - * @returns A thenable that resolves with the updated document. - */ - export function setTextDocumentLanguage( - document: TextDocument, - languageId: string, - ): Thenable; - - /** - * Compute the match between a document {@link DocumentSelector selector} and a document. Values - * greater than zero mean the selector matches the document. - * - * A match is computed according to these rules: - * 1. When {@linkcode DocumentSelector} is an array, compute the match for each contained `DocumentFilter` or language identifier and take the maximum value. - * 2. A string will be desugared to become the `language`-part of a {@linkcode DocumentFilter}, so `"fooLang"` is like `{ language: "fooLang" }`. - * 3. A {@linkcode DocumentFilter} will be matched against the document by comparing its parts with the document. The following rules apply: - * 1. When the `DocumentFilter` is empty (`{}`) the result is `0` - * 2. When `scheme`, `language`, `pattern`, or `notebook` are defined but one doesn't match, the result is `0` - * 3. Matching against `*` gives a score of `5`, matching via equality or via a glob-pattern gives a score of `10` - * 4. The result is the maximum value of each match - * - * Samples: - * ```js - * // default document from disk (file-scheme) - * doc.uri; //'file:///my/file.js' - * doc.languageId; // 'javascript' - * match('javascript', doc); // 10; - * match({ language: 'javascript' }, doc); // 10; - * match({ language: 'javascript', scheme: 'file' }, doc); // 10; - * match('*', doc); // 5 - * match('fooLang', doc); // 0 - * match(['fooLang', '*'], doc); // 5 - * - * // virtual document, e.g. from git-index - * doc.uri; // 'git:/my/file.js' - * doc.languageId; // 'javascript' - * match('javascript', doc); // 10; - * match({ language: 'javascript', scheme: 'git' }, doc); // 10; - * match('*', doc); // 5 - * - * // notebook cell document - * doc.uri; // `vscode-notebook-cell:///my/notebook.ipynb#gl65s2pmha`; - * doc.languageId; // 'python' - * match({ notebookType: 'jupyter-notebook' }, doc) // 10 - * match({ notebookType: 'fooNotebook', language: 'python' }, doc) // 0 - * match({ language: 'python' }, doc) // 10 - * match({ notebookType: '*' }, doc) // 5 - * ``` - * - * @param selector A document selector. - * @param document A text document. - * @returns A number `>0` when the selector matches and `0` when the selector does not match. - */ - export function match( - selector: DocumentSelector, - document: TextDocument, - ): number; - - /** - * An {@link Event} which fires when the global set of diagnostics changes. This is - * newly added and removed diagnostics. - */ - export const onDidChangeDiagnostics: Event; - - /** - * Get all diagnostics for a given resource. - * - * @param resource A resource - * @returns An array of {@link Diagnostic diagnostics} objects or an empty array. - */ - export function getDiagnostics(resource: Uri): Diagnostic[]; - - /** - * Get all diagnostics. - * - * @returns An array of uri-diagnostics tuples or an empty array. - */ - export function getDiagnostics(): [Uri, Diagnostic[]][]; - - /** - * Create a diagnostics collection. - * - * @param name The {@link DiagnosticCollection.name name} of the collection. - * @returns A new diagnostic collection. - */ - export function createDiagnosticCollection( - name?: string, - ): DiagnosticCollection; - - /** - * Creates a new {@link LanguageStatusItem language status item}. - * - * @param id The identifier of the item. - * @param selector The document selector that defines for what editors the item shows. - * @returns A new language status item. - */ - export function createLanguageStatusItem( - id: string, - selector: DocumentSelector, - ): LanguageStatusItem; - - /** - * Register a completion provider. - * - * Multiple providers can be registered for a language. In that case providers are sorted - * by their {@link languages.match score} and groups of equal score are sequentially asked for - * completion items. The process stops when one or many providers of a group return a - * result. A failing provider (rejected promise or exception) will not fail the whole - * operation. - * - * A completion item provider can be associated with a set of `triggerCharacters`. When trigger - * characters are being typed, completions are requested but only from providers that registered - * the typed character. Because of that trigger characters should be different than {@link LanguageConfiguration.wordPattern word characters}, - * a common trigger character is `.` to trigger member completions. - * - * @param selector A selector that defines the documents this provider is applicable to. - * @param provider A completion provider. - * @param triggerCharacters Trigger completion when the user types one of the characters. - * @returns A {@link Disposable} that unregisters this provider when being disposed. - */ - export function registerCompletionItemProvider( - selector: DocumentSelector, - provider: CompletionItemProvider, - ...triggerCharacters: string[] - ): Disposable; - - /** - * Registers an inline completion provider. - * - * Multiple providers can be registered for a language. In that case providers are asked in - * parallel and the results are merged. A failing provider (rejected promise or exception) will - * not cause a failure of the whole operation. - * - * @param selector A selector that defines the documents this provider is applicable to. - * @param provider An inline completion provider. - * @returns A {@link Disposable} that unregisters this provider when being disposed. - */ - export function registerInlineCompletionItemProvider( - selector: DocumentSelector, - provider: InlineCompletionItemProvider, - ): Disposable; - - /** - * Register a code action provider. - * - * Multiple providers can be registered for a language. In that case providers are asked in - * parallel and the results are merged. A failing provider (rejected promise or exception) will - * not cause a failure of the whole operation. - * - * @param selector A selector that defines the documents this provider is applicable to. - * @param provider A code action provider. - * @param metadata Metadata about the kind of code actions the provider provides. - * @returns A {@link Disposable} that unregisters this provider when being disposed. - */ - export function registerCodeActionsProvider( - selector: DocumentSelector, - provider: CodeActionProvider, - metadata?: CodeActionProviderMetadata, - ): Disposable; - - /** - * Register a code lens provider. - * - * Multiple providers can be registered for a language. In that case providers are asked in - * parallel and the results are merged. A failing provider (rejected promise or exception) will - * not cause a failure of the whole operation. - * - * @param selector A selector that defines the documents this provider is applicable to. - * @param provider A code lens provider. - * @returns A {@link Disposable} that unregisters this provider when being disposed. - */ - export function registerCodeLensProvider( - selector: DocumentSelector, - provider: CodeLensProvider, - ): Disposable; - - /** - * Register a definition provider. - * - * Multiple providers can be registered for a language. In that case providers are asked in - * parallel and the results are merged. A failing provider (rejected promise or exception) will - * not cause a failure of the whole operation. - * - * @param selector A selector that defines the documents this provider is applicable to. - * @param provider A definition provider. - * @returns A {@link Disposable} that unregisters this provider when being disposed. - */ - export function registerDefinitionProvider( - selector: DocumentSelector, - provider: DefinitionProvider, - ): Disposable; - - /** - * Register an implementation provider. - * - * Multiple providers can be registered for a language. In that case providers are asked in - * parallel and the results are merged. A failing provider (rejected promise or exception) will - * not cause a failure of the whole operation. - * - * @param selector A selector that defines the documents this provider is applicable to. - * @param provider An implementation provider. - * @returns A {@link Disposable} that unregisters this provider when being disposed. - */ - export function registerImplementationProvider( - selector: DocumentSelector, - provider: ImplementationProvider, - ): Disposable; - - /** - * Register a type definition provider. - * - * Multiple providers can be registered for a language. In that case providers are asked in - * parallel and the results are merged. A failing provider (rejected promise or exception) will - * not cause a failure of the whole operation. - * - * @param selector A selector that defines the documents this provider is applicable to. - * @param provider A type definition provider. - * @returns A {@link Disposable} that unregisters this provider when being disposed. - */ - export function registerTypeDefinitionProvider( - selector: DocumentSelector, - provider: TypeDefinitionProvider, - ): Disposable; - - /** - * Register a declaration provider. - * - * Multiple providers can be registered for a language. In that case providers are asked in - * parallel and the results are merged. A failing provider (rejected promise or exception) will - * not cause a failure of the whole operation. - * - * @param selector A selector that defines the documents this provider is applicable to. - * @param provider A declaration provider. - * @returns A {@link Disposable} that unregisters this provider when being disposed. - */ - export function registerDeclarationProvider( - selector: DocumentSelector, - provider: DeclarationProvider, - ): Disposable; - - /** - * Register a hover provider. - * - * Multiple providers can be registered for a language. In that case providers are asked in - * parallel and the results are merged. A failing provider (rejected promise or exception) will - * not cause a failure of the whole operation. - * - * @param selector A selector that defines the documents this provider is applicable to. - * @param provider A hover provider. - * @returns A {@link Disposable} that unregisters this provider when being disposed. - */ - export function registerHoverProvider( - selector: DocumentSelector, - provider: HoverProvider, - ): Disposable; - - /** - * Register a provider that locates evaluatable expressions in text documents. - * The editor will evaluate the expression in the active debug session and will show the result in the debug hover. - * - * If multiple providers are registered for a language an arbitrary provider will be used. - * - * @param selector A selector that defines the documents this provider is applicable to. - * @param provider An evaluatable expression provider. - * @returns A {@link Disposable} that unregisters this provider when being disposed. - */ - export function registerEvaluatableExpressionProvider( - selector: DocumentSelector, - provider: EvaluatableExpressionProvider, - ): Disposable; - - /** - * Register a provider that returns data for the debugger's 'inline value' feature. - * Whenever the generic debugger has stopped in a source file, providers registered for the language of the file - * are called to return textual data that will be shown in the editor at the end of lines. - * - * Multiple providers can be registered for a language. In that case providers are asked in - * parallel and the results are merged. A failing provider (rejected promise or exception) will - * not cause a failure of the whole operation. - * - * @param selector A selector that defines the documents this provider is applicable to. - * @param provider An inline values provider. - * @returns A {@link Disposable} that unregisters this provider when being disposed. - */ - export function registerInlineValuesProvider( - selector: DocumentSelector, - provider: InlineValuesProvider, - ): Disposable; - - /** - * Register a document highlight provider. - * - * Multiple providers can be registered for a language. In that case providers are sorted - * by their {@link languages.match score} and groups sequentially asked for document highlights. - * The process stops when a provider returns a `non-falsy` or `non-failure` result. - * - * @param selector A selector that defines the documents this provider is applicable to. - * @param provider A document highlight provider. - * @returns A {@link Disposable} that unregisters this provider when being disposed. - */ - export function registerDocumentHighlightProvider( - selector: DocumentSelector, - provider: DocumentHighlightProvider, - ): Disposable; - - /** - * Register a document symbol provider. - * - * Multiple providers can be registered for a language. In that case providers are asked in - * parallel and the results are merged. A failing provider (rejected promise or exception) will - * not cause a failure of the whole operation. - * - * @param selector A selector that defines the documents this provider is applicable to. - * @param provider A document symbol provider. - * @param metaData metadata about the provider - * @returns A {@link Disposable} that unregisters this provider when being disposed. - */ - export function registerDocumentSymbolProvider( - selector: DocumentSelector, - provider: DocumentSymbolProvider, - metaData?: DocumentSymbolProviderMetadata, - ): Disposable; - - /** - * Register a workspace symbol provider. - * - * Multiple providers can be registered. In that case providers are asked in parallel and - * the results are merged. A failing provider (rejected promise or exception) will not cause - * a failure of the whole operation. - * - * @param provider A workspace symbol provider. - * @returns A {@link Disposable} that unregisters this provider when being disposed. - */ - export function registerWorkspaceSymbolProvider( - provider: WorkspaceSymbolProvider, - ): Disposable; - - /** - * Register a reference provider. - * - * Multiple providers can be registered for a language. In that case providers are asked in - * parallel and the results are merged. A failing provider (rejected promise or exception) will - * not cause a failure of the whole operation. - * - * @param selector A selector that defines the documents this provider is applicable to. - * @param provider A reference provider. - * @returns A {@link Disposable} that unregisters this provider when being disposed. - */ - export function registerReferenceProvider( - selector: DocumentSelector, - provider: ReferenceProvider, - ): Disposable; - - /** - * Register a rename provider. - * - * Multiple providers can be registered for a language. In that case providers are sorted - * by their {@link languages.match score} and asked in sequence. The first provider producing a result - * defines the result of the whole operation. - * - * @param selector A selector that defines the documents this provider is applicable to. - * @param provider A rename provider. - * @returns A {@link Disposable} that unregisters this provider when being disposed. - */ - export function registerRenameProvider( - selector: DocumentSelector, - provider: RenameProvider, - ): Disposable; - - /** - * Register a semantic tokens provider for a whole document. - * - * Multiple providers can be registered for a language. In that case providers are sorted - * by their {@link languages.match score} and the best-matching provider is used. Failure - * of the selected provider will cause a failure of the whole operation. - * - * @param selector A selector that defines the documents this provider is applicable to. - * @param provider A document semantic tokens provider. - * @returns A {@link Disposable} that unregisters this provider when being disposed. - */ - export function registerDocumentSemanticTokensProvider( - selector: DocumentSelector, - provider: DocumentSemanticTokensProvider, - legend: SemanticTokensLegend, - ): Disposable; - - /** - * Register a semantic tokens provider for a document range. - * - * *Note:* If a document has both a `DocumentSemanticTokensProvider` and a `DocumentRangeSemanticTokensProvider`, - * the range provider will be invoked only initially, for the time in which the full document provider takes - * to resolve the first request. Once the full document provider resolves the first request, the semantic tokens - * provided via the range provider will be discarded and from that point forward, only the document provider - * will be used. - * - * Multiple providers can be registered for a language. In that case providers are sorted - * by their {@link languages.match score} and the best-matching provider is used. Failure - * of the selected provider will cause a failure of the whole operation. - * - * @param selector A selector that defines the documents this provider is applicable to. - * @param provider A document range semantic tokens provider. - * @returns A {@link Disposable} that unregisters this provider when being disposed. - */ - export function registerDocumentRangeSemanticTokensProvider( - selector: DocumentSelector, - provider: DocumentRangeSemanticTokensProvider, - legend: SemanticTokensLegend, - ): Disposable; - - /** - * Register a formatting provider for a document. - * - * Multiple providers can be registered for a language. In that case providers are sorted - * by their {@link languages.match score} and the best-matching provider is used. Failure - * of the selected provider will cause a failure of the whole operation. - * - * @param selector A selector that defines the documents this provider is applicable to. - * @param provider A document formatting edit provider. - * @returns A {@link Disposable} that unregisters this provider when being disposed. - */ - export function registerDocumentFormattingEditProvider( - selector: DocumentSelector, - provider: DocumentFormattingEditProvider, - ): Disposable; - - /** - * Register a formatting provider for a document range. - * - * *Note:* A document range provider is also a {@link DocumentFormattingEditProvider document formatter} - * which means there is no need to {@link languages.registerDocumentFormattingEditProvider register} a document - * formatter when also registering a range provider. - * - * Multiple providers can be registered for a language. In that case providers are sorted - * by their {@link languages.match score} and the best-matching provider is used. Failure - * of the selected provider will cause a failure of the whole operation. - * - * @param selector A selector that defines the documents this provider is applicable to. - * @param provider A document range formatting edit provider. - * @returns A {@link Disposable} that unregisters this provider when being disposed. - */ - export function registerDocumentRangeFormattingEditProvider( - selector: DocumentSelector, - provider: DocumentRangeFormattingEditProvider, - ): Disposable; - - /** - * Register a formatting provider that works on type. The provider is active when the user enables the setting `editor.formatOnType`. - * - * Multiple providers can be registered for a language. In that case providers are sorted - * by their {@link languages.match score} and the best-matching provider is used. Failure - * of the selected provider will cause a failure of the whole operation. - * - * @param selector A selector that defines the documents this provider is applicable to. - * @param provider An on type formatting edit provider. - * @param firstTriggerCharacter A character on which formatting should be triggered, like `}`. - * @param moreTriggerCharacter More trigger characters. - * @returns A {@link Disposable} that unregisters this provider when being disposed. - */ - export function registerOnTypeFormattingEditProvider( - selector: DocumentSelector, - provider: OnTypeFormattingEditProvider, - firstTriggerCharacter: string, - ...moreTriggerCharacter: string[] - ): Disposable; - - /** - * Register a signature help provider. - * - * Multiple providers can be registered for a language. In that case providers are sorted - * by their {@link languages.match score} and called sequentially until a provider returns a - * valid result. - * - * @param selector A selector that defines the documents this provider is applicable to. - * @param provider A signature help provider. - * @param triggerCharacters Trigger signature help when the user types one of the characters, like `,` or `(`. - * @returns A {@link Disposable} that unregisters this provider when being disposed. - */ - export function registerSignatureHelpProvider( - selector: DocumentSelector, - provider: SignatureHelpProvider, - ...triggerCharacters: string[] - ): Disposable; - - /** - * @see {@link languages.registerSignatureHelpProvider} - * - * @param selector A selector that defines the documents this provider is applicable to. - * @param provider A signature help provider. - * @param metadata Information about the provider. - * @returns A {@link Disposable} that unregisters this provider when being disposed. - */ - export function registerSignatureHelpProvider( - selector: DocumentSelector, - provider: SignatureHelpProvider, - metadata: SignatureHelpProviderMetadata, - ): Disposable; - - /** - * Register a document link provider. - * - * Multiple providers can be registered for a language. In that case providers are asked in - * parallel and the results are merged. A failing provider (rejected promise or exception) will - * not cause a failure of the whole operation. - * - * @param selector A selector that defines the documents this provider is applicable to. - * @param provider A document link provider. - * @returns A {@link Disposable} that unregisters this provider when being disposed. - */ - export function registerDocumentLinkProvider( - selector: DocumentSelector, - provider: DocumentLinkProvider, - ): Disposable; - - /** - * Register a color provider. - * - * Multiple providers can be registered for a language. In that case providers are asked in - * parallel and the results are merged. A failing provider (rejected promise or exception) will - * not cause a failure of the whole operation. - * - * @param selector A selector that defines the documents this provider is applicable to. - * @param provider A color provider. - * @returns A {@link Disposable} that unregisters this provider when being disposed. - */ - export function registerColorProvider( - selector: DocumentSelector, - provider: DocumentColorProvider, - ): Disposable; - - /** - * Register a inlay hints provider. - * - * Multiple providers can be registered for a language. In that case providers are asked in - * parallel and the results are merged. A failing provider (rejected promise or exception) will - * not cause a failure of the whole operation. - * - * @param selector A selector that defines the documents this provider is applicable to. - * @param provider An inlay hints provider. - * @returns A {@link Disposable} that unregisters this provider when being disposed. - */ - export function registerInlayHintsProvider( - selector: DocumentSelector, - provider: InlayHintsProvider, - ): Disposable; - - /** - * Register a folding range provider. - * - * Multiple providers can be registered for a language. In that case providers are asked in - * parallel and the results are merged. - * If multiple folding ranges start at the same position, only the range of the first registered provider is used. - * If a folding range overlaps with an other range that has a smaller position, it is also ignored. - * - * A failing provider (rejected promise or exception) will - * not cause a failure of the whole operation. - * - * @param selector A selector that defines the documents this provider is applicable to. - * @param provider A folding range provider. - * @returns A {@link Disposable} that unregisters this provider when being disposed. - */ - export function registerFoldingRangeProvider( - selector: DocumentSelector, - provider: FoldingRangeProvider, - ): Disposable; - - /** - * Register a selection range provider. - * - * Multiple providers can be registered for a language. In that case providers are asked in - * parallel and the results are merged. A failing provider (rejected promise or exception) will - * not cause a failure of the whole operation. - * - * @param selector A selector that defines the documents this provider is applicable to. - * @param provider A selection range provider. - * @returns A {@link Disposable} that unregisters this provider when being disposed. - */ - export function registerSelectionRangeProvider( - selector: DocumentSelector, - provider: SelectionRangeProvider, - ): Disposable; - - /** - * Register a call hierarchy provider. - * - * @param selector A selector that defines the documents this provider is applicable to. - * @param provider A call hierarchy provider. - * @returns A {@link Disposable} that unregisters this provider when being disposed. - */ - export function registerCallHierarchyProvider( - selector: DocumentSelector, - provider: CallHierarchyProvider, - ): Disposable; - - /** - * Register a type hierarchy provider. - * - * @param selector A selector that defines the documents this provider is applicable to. - * @param provider A type hierarchy provider. - * @returns A {@link Disposable} that unregisters this provider when being disposed. - */ - export function registerTypeHierarchyProvider( - selector: DocumentSelector, - provider: TypeHierarchyProvider, - ): Disposable; - - /** - * Register a linked editing range provider. - * - * Multiple providers can be registered for a language. In that case providers are sorted - * by their {@link languages.match score} and the best-matching provider that has a result is used. Failure - * of the selected provider will cause a failure of the whole operation. - * - * @param selector A selector that defines the documents this provider is applicable to. - * @param provider A linked editing range provider. - * @returns A {@link Disposable} that unregisters this provider when being disposed. - */ - export function registerLinkedEditingRangeProvider( - selector: DocumentSelector, - provider: LinkedEditingRangeProvider, - ): Disposable; - - /** - * Registers a new {@link DocumentDropEditProvider}. - * - * @param selector A selector that defines the documents this provider applies to. - * @param provider A drop provider. - * - * @returns A {@link Disposable} that unregisters this provider when disposed of. - */ - export function registerDocumentDropEditProvider( - selector: DocumentSelector, - provider: DocumentDropEditProvider, - ): Disposable; - - /** - * Set a {@link LanguageConfiguration language configuration} for a language. - * - * @param language A language identifier like `typescript`. - * @param configuration Language configuration. - * @returns A {@link Disposable} that unsets this configuration. - */ - export function setLanguageConfiguration( - language: string, - configuration: LanguageConfiguration, - ): Disposable; - } - - /** - * Represents a notebook editor that is attached to a {@link NotebookDocument notebook}. - */ - export enum NotebookEditorRevealType { - /** - * The range will be revealed with as little scrolling as possible. - */ - Default = 0, - - /** - * The range will always be revealed in the center of the viewport. - */ - InCenter = 1, - - /** - * If the range is outside the viewport, it will be revealed in the center of the viewport. - * Otherwise, it will be revealed with as little scrolling as possible. - */ - InCenterIfOutsideViewport = 2, - - /** - * The range will always be revealed at the top of the viewport. - */ - AtTop = 3, - } - - /** - * Represents a notebook editor that is attached to a {@link NotebookDocument notebook}. - * Additional properties of the NotebookEditor are available in the proposed - * API, which will be finalized later. - */ - export interface NotebookEditor { - /** - * The {@link NotebookDocument notebook document} associated with this notebook editor. - */ - readonly notebook: NotebookDocument; - - /** - * The primary selection in this notebook editor. - */ - selection: NotebookRange; - - /** - * All selections in this notebook editor. - * - * The primary selection (or focused range) is `selections[0]`. When the document has no cells, the primary selection is empty `{ start: 0, end: 0 }`; - */ - selections: readonly NotebookRange[]; - - /** - * The current visible ranges in the editor (vertically). - */ - readonly visibleRanges: readonly NotebookRange[]; - - /** - * The column in which this editor shows. - */ - readonly viewColumn?: ViewColumn; - - /** - * Scroll as indicated by `revealType` in order to reveal the given range. - * - * @param range A range. - * @param revealType The scrolling strategy for revealing `range`. - */ - revealRange( - range: NotebookRange, - revealType?: NotebookEditorRevealType, - ): void; - } - - /** - * Renderer messaging is used to communicate with a single renderer. It's returned from {@link notebooks.createRendererMessaging}. - */ - export interface NotebookRendererMessaging { - /** - * An event that fires when a message is received from a renderer. - */ - readonly onDidReceiveMessage: Event<{ - /** - * The {@link NotebookEditor editor} that sent the message. - */ - readonly editor: NotebookEditor; - /** - * The actual message. - */ - readonly message: any; - }>; - - /** - * Send a message to one or all renderer. - * - * @param message Message to send - * @param editor Editor to target with the message. If not provided, the - * message is sent to all renderers. - * @returns a boolean indicating whether the message was successfully - * delivered to any renderer. - */ - postMessage(message: any, editor?: NotebookEditor): Thenable; - } - - /** - * A notebook cell kind. - */ - export enum NotebookCellKind { - /** - * A markup-cell is formatted source that is used for display. - */ - Markup = 1, - - /** - * A code-cell is source that can be {@link NotebookController executed} and that - * produces {@link NotebookCellOutput output}. - */ - Code = 2, - } - - /** - * Represents a cell of a {@link NotebookDocument notebook}, either a {@link NotebookCellKind.Code code}-cell - * or {@link NotebookCellKind.Markup markup}-cell. - * - * NotebookCell instances are immutable and are kept in sync for as long as they are part of their notebook. - */ - export interface NotebookCell { - /** - * The index of this cell in its {@link NotebookDocument.cellAt containing notebook}. The - * index is updated when a cell is moved within its notebook. The index is `-1` - * when the cell has been removed from its notebook. - */ - readonly index: number; - - /** - * The {@link NotebookDocument notebook} that contains this cell. - */ - readonly notebook: NotebookDocument; - - /** - * The kind of this cell. - */ - readonly kind: NotebookCellKind; - - /** - * The {@link TextDocument text} of this cell, represented as text document. - */ - readonly document: TextDocument; - - /** - * The metadata of this cell. Can be anything but must be JSON-stringifyable. - */ - readonly metadata: { readonly [key: string]: any }; - - /** - * The outputs of this cell. - */ - readonly outputs: readonly NotebookCellOutput[]; - - /** - * The most recent {@link NotebookCellExecutionSummary execution summary} for this cell. - */ - readonly executionSummary: NotebookCellExecutionSummary | undefined; - } - - /** - * Represents a notebook which itself is a sequence of {@link NotebookCell code or markup cells}. Notebook documents are - * created from {@link NotebookData notebook data}. - */ - export interface NotebookDocument { - /** - * The associated uri for this notebook. - * - * *Note* that most notebooks use the `file`-scheme, which means they are files on disk. However, **not** all notebooks are - * saved on disk and therefore the `scheme` must be checked before trying to access the underlying file or siblings on disk. - * - * @see {@link FileSystemProvider} - */ - readonly uri: Uri; - - /** - * The type of notebook. - */ - readonly notebookType: string; - - /** - * The version number of this notebook (it will strictly increase after each - * change, including undo/redo). - */ - readonly version: number; - - /** - * `true` if there are unpersisted changes. - */ - readonly isDirty: boolean; - - /** - * Is this notebook representing an untitled file which has not been saved yet. - */ - readonly isUntitled: boolean; - - /** - * `true` if the notebook has been closed. A closed notebook isn't synchronized anymore - * and won't be re-used when the same resource is opened again. - */ - readonly isClosed: boolean; - - /** - * Arbitrary metadata for this notebook. Can be anything but must be JSON-stringifyable. - */ - readonly metadata: { [key: string]: any }; - - /** - * The number of cells in the notebook. - */ - readonly cellCount: number; - - /** - * Return the cell at the specified index. The index will be adjusted to the notebook. - * - * @param index - The index of the cell to retrieve. - * @returns A {@link NotebookCell cell}. - */ - cellAt(index: number): NotebookCell; - - /** - * Get the cells of this notebook. A subset can be retrieved by providing - * a range. The range will be adjusted to the notebook. - * - * @param range A notebook range. - * @returns The cells contained by the range or all cells. - */ - getCells(range?: NotebookRange): NotebookCell[]; - - /** - * Save the document. The saving will be handled by the corresponding {@link NotebookSerializer serializer}. - * - * @returns A promise that will resolve to true when the document - * has been saved. Will return false if the file was not dirty or when save failed. - */ - save(): Thenable; - } - - /** - * Describes a change to a notebook cell. - * - * @see {@link NotebookDocumentChangeEvent} - */ - export interface NotebookDocumentCellChange { - /** - * The affected cell. - */ - readonly cell: NotebookCell; - - /** - * The document of the cell or `undefined` when it did not change. - * - * *Note* that you should use the {@link workspace.onDidChangeTextDocument onDidChangeTextDocument}-event - * for detailed change information, like what edits have been performed. - */ - readonly document: TextDocument | undefined; - - /** - * The new metadata of the cell or `undefined` when it did not change. - */ - readonly metadata: { [key: string]: any } | undefined; - - /** - * The new outputs of the cell or `undefined` when they did not change. - */ - readonly outputs: readonly NotebookCellOutput[] | undefined; - - /** - * The new execution summary of the cell or `undefined` when it did not change. - */ - readonly executionSummary: NotebookCellExecutionSummary | undefined; - } - - /** - * Describes a structural change to a notebook document, e.g newly added and removed cells. - * - * @see {@link NotebookDocumentChangeEvent} - */ - export interface NotebookDocumentContentChange { - /** - * The range at which cells have been either added or removed. - * - * Note that no cells have been {@link NotebookDocumentContentChange.removedCells removed} - * when this range is {@link NotebookRange.isEmpty empty}. - */ - readonly range: NotebookRange; - - /** - * Cells that have been added to the document. - */ - readonly addedCells: readonly NotebookCell[]; - - /** - * Cells that have been removed from the document. - */ - readonly removedCells: readonly NotebookCell[]; - } - - /** - * An event describing a transactional {@link NotebookDocument notebook} change. - */ - export interface NotebookDocumentChangeEvent { - /** - * The affected notebook. - */ - readonly notebook: NotebookDocument; - - /** - * The new metadata of the notebook or `undefined` when it did not change. - */ - readonly metadata: { [key: string]: any } | undefined; - - /** - * An array of content changes describing added or removed {@link NotebookCell cells}. - */ - readonly contentChanges: readonly NotebookDocumentContentChange[]; - - /** - * An array of {@link NotebookDocumentCellChange cell changes}. - */ - readonly cellChanges: readonly NotebookDocumentCellChange[]; - } - - /** - * An event that is fired when a {@link NotebookDocument notebook document} will be saved. - * - * To make modifications to the document before it is being saved, call the - * {@linkcode NotebookDocumentWillSaveEvent.waitUntil waitUntil}-function with a thenable - * that resolves to a {@link WorkspaceEdit workspace edit}. - */ - export interface NotebookDocumentWillSaveEvent { - /** - * A cancellation token. - */ - readonly token: CancellationToken; - - /** - * The {@link NotebookDocument notebook document} that will be saved. - */ - readonly notebook: NotebookDocument; - - /** - * The reason why save was triggered. - */ - readonly reason: TextDocumentSaveReason; - - /** - * Allows to pause the event loop and to apply {@link WorkspaceEdit workspace edit}. - * Edits of subsequent calls to this function will be applied in order. The - * edits will be *ignored* if concurrent modifications of the notebook document happened. - * - * *Note:* This function can only be called during event dispatch and not - * in an asynchronous manner: - * - * ```ts - * workspace.onWillSaveNotebookDocument(event => { - * // async, will *throw* an error - * setTimeout(() => event.waitUntil(promise)); - * - * // sync, OK - * event.waitUntil(promise); - * }) - * ``` - * - * @param thenable A thenable that resolves to {@link WorkspaceEdit workspace edit}. - */ - waitUntil(thenable: Thenable): void; - - /** - * Allows to pause the event loop until the provided thenable resolved. - * - * *Note:* This function can only be called during event dispatch. - * - * @param thenable A thenable that delays saving. - */ - waitUntil(thenable: Thenable): void; - } - - /** - * The summary of a notebook cell execution. - */ - export interface NotebookCellExecutionSummary { - /** - * The order in which the execution happened. - */ - readonly executionOrder?: number; - - /** - * If the execution finished successfully. - */ - readonly success?: boolean; - - /** - * The times at which execution started and ended, as unix timestamps - */ - readonly timing?: { - /** - * Execution start time. - */ - readonly startTime: number; - /** - * Execution end time. - */ - readonly endTime: number; - }; - } - - /** - * A notebook range represents an ordered pair of two cell indices. - * It is guaranteed that start is less than or equal to end. - */ - export class NotebookRange { - /** - * The zero-based start index of this range. - */ - readonly start: number; - - /** - * The exclusive end index of this range (zero-based). - */ - readonly end: number; - - /** - * `true` if `start` and `end` are equal. - */ - readonly isEmpty: boolean; - - /** - * Create a new notebook range. If `start` is not - * before or equal to `end`, the values will be swapped. - * - * @param start start index - * @param end end index. - */ - constructor(start: number, end: number); - - /** - * Derive a new range for this range. - * - * @param change An object that describes a change to this range. - * @returns A range that reflects the given change. Will return `this` range if the change - * is not changing anything. - */ - with(change: { - /** - * New start index, defaults to `this.start`. - */ - start?: number; - /** - * New end index, defaults to `this.end`. - */ - end?: number; - }): NotebookRange; - } - - /** - * One representation of a {@link NotebookCellOutput notebook output}, defined by MIME type and data. - */ - export class NotebookCellOutputItem { - /** - * Factory function to create a `NotebookCellOutputItem` from a string. - * - * *Note* that an UTF-8 encoder is used to create bytes for the string. - * - * @param value A string. - * @param mime Optional MIME type, defaults to `text/plain`. - * @returns A new output item object. - */ - static text(value: string, mime?: string): NotebookCellOutputItem; - - /** - * Factory function to create a `NotebookCellOutputItem` from - * a JSON object. - * - * *Note* that this function is not expecting "stringified JSON" but - * an object that can be stringified. This function will throw an error - * when the passed value cannot be JSON-stringified. - * - * @param value A JSON-stringifyable value. - * @param mime Optional MIME type, defaults to `application/json` - * @returns A new output item object. - */ - static json(value: any, mime?: string): NotebookCellOutputItem; - - /** - * Factory function to create a `NotebookCellOutputItem` that uses - * uses the `application/vnd.code.notebook.stdout` mime type. - * - * @param value A string. - * @returns A new output item object. - */ - static stdout(value: string): NotebookCellOutputItem; - - /** - * Factory function to create a `NotebookCellOutputItem` that uses - * uses the `application/vnd.code.notebook.stderr` mime type. - * - * @param value A string. - * @returns A new output item object. - */ - static stderr(value: string): NotebookCellOutputItem; - - /** - * Factory function to create a `NotebookCellOutputItem` that uses - * uses the `application/vnd.code.notebook.error` mime type. - * - * @param value An error object. - * @returns A new output item object. - */ - static error(value: Error): NotebookCellOutputItem; - - /** - * The mime type which determines how the {@linkcode NotebookCellOutputItem.data data}-property - * is interpreted. - * - * Notebooks have built-in support for certain mime-types, extensions can add support for new - * types and override existing types. - */ - mime: string; - - /** - * The data of this output item. Must always be an array of unsigned 8-bit integers. - */ - data: Uint8Array; - - /** - * Create a new notebook cell output item. - * - * @param data The value of the output item. - * @param mime The mime type of the output item. - */ - constructor(data: Uint8Array, mime: string); - } - - /** - * Notebook cell output represents a result of executing a cell. It is a container type for multiple - * {@link NotebookCellOutputItem output items} where contained items represent the same result but - * use different MIME types. - */ - export class NotebookCellOutput { - /** - * The output items of this output. Each item must represent the same result. _Note_ that repeated - * MIME types per output is invalid and that the editor will just pick one of them. - * - * ```ts - * new vscode.NotebookCellOutput([ - * vscode.NotebookCellOutputItem.text('Hello', 'text/plain'), - * vscode.NotebookCellOutputItem.text('Hello', 'text/html'), - * vscode.NotebookCellOutputItem.text('_Hello_', 'text/markdown'), - * vscode.NotebookCellOutputItem.text('Hey', 'text/plain'), // INVALID: repeated type, editor will pick just one - * ]) - * ``` - */ - items: NotebookCellOutputItem[]; - - /** - * Arbitrary metadata for this cell output. Can be anything but must be JSON-stringifyable. - */ - metadata?: { [key: string]: any }; - - /** - * Create new notebook output. - * - * @param items Notebook output items. - * @param metadata Optional metadata. - */ - constructor( - items: NotebookCellOutputItem[], - metadata?: { [key: string]: any }, - ); - } - - /** - * NotebookCellData is the raw representation of notebook cells. Its is part of {@linkcode NotebookData}. - */ - export class NotebookCellData { - /** - * The {@link NotebookCellKind kind} of this cell data. - */ - kind: NotebookCellKind; - - /** - * The source value of this cell data - either source code or formatted text. - */ - value: string; - - /** - * The language identifier of the source value of this cell data. Any value from - * {@linkcode languages.getLanguages getLanguages} is possible. - */ - languageId: string; - - /** - * The outputs of this cell data. - */ - outputs?: NotebookCellOutput[]; - - /** - * Arbitrary metadata of this cell data. Can be anything but must be JSON-stringifyable. - */ - metadata?: { [key: string]: any }; - - /** - * The execution summary of this cell data. - */ - executionSummary?: NotebookCellExecutionSummary; - - /** - * Create new cell data. Minimal cell data specifies its kind, its source value, and the - * language identifier of its source. - * - * @param kind The kind. - * @param value The source value. - * @param languageId The language identifier of the source value. - */ - constructor(kind: NotebookCellKind, value: string, languageId: string); - } - - /** - * Raw representation of a notebook. - * - * Extensions are responsible for creating {@linkcode NotebookData} so that the editor - * can create a {@linkcode NotebookDocument}. - * - * @see {@link NotebookSerializer} - */ - export class NotebookData { - /** - * The cell data of this notebook data. - */ - cells: NotebookCellData[]; - - /** - * Arbitrary metadata of notebook data. - */ - metadata?: { [key: string]: any }; - - /** - * Create new notebook data. - * - * @param cells An array of cell data. - */ - constructor(cells: NotebookCellData[]); - } - - /** - * The notebook serializer enables the editor to open notebook files. - * - * At its core the editor only knows a {@link NotebookData notebook data structure} but not - * how that data structure is written to a file, nor how it is read from a file. The - * notebook serializer bridges this gap by deserializing bytes into notebook data and - * vice versa. - */ - export interface NotebookSerializer { - /** - * Deserialize contents of a notebook file into the notebook data structure. - * - * @param content Contents of a notebook file. - * @param token A cancellation token. - * @returns Notebook data or a thenable that resolves to such. - */ - deserializeNotebook( - content: Uint8Array, - token: CancellationToken, - ): NotebookData | Thenable; - - /** - * Serialize notebook data into file contents. - * - * @param data A notebook data structure. - * @param token A cancellation token. - * @returns An array of bytes or a thenable that resolves to such. - */ - serializeNotebook( - data: NotebookData, - token: CancellationToken, - ): Uint8Array | Thenable; - } - - /** - * Notebook content options define what parts of a notebook are persisted. Note - * - * For instance, a notebook serializer can opt-out of saving outputs and in that case the editor doesn't mark a - * notebooks as {@link NotebookDocument.isDirty dirty} when its output has changed. - */ - export interface NotebookDocumentContentOptions { - /** - * Controls if output change events will trigger notebook document content change events and - * if it will be used in the diff editor, defaults to false. If the content provider doesn't - * persist the outputs in the file document, this should be set to true. - */ - transientOutputs?: boolean; - - /** - * Controls if a cell metadata property change event will trigger notebook document content - * change events and if it will be used in the diff editor, defaults to false. If the - * content provider doesn't persist a metadata property in the file document, it should be - * set to true. - */ - transientCellMetadata?: { [key: string]: boolean | undefined }; - - /** - * Controls if a document metadata property change event will trigger notebook document - * content change event and if it will be used in the diff editor, defaults to false. If the - * content provider doesn't persist a metadata property in the file document, it should be - * set to true. - */ - transientDocumentMetadata?: { [key: string]: boolean | undefined }; - } - - /** - * Notebook controller affinity for notebook documents. - * - * @see {@link NotebookController.updateNotebookAffinity} - */ - export enum NotebookControllerAffinity { - /** - * Default affinity. - */ - Default = 1, - /** - * A controller is preferred for a notebook. - */ - Preferred = 2, - } - - /** - * A notebook controller represents an entity that can execute notebook cells. This is often referred to as a kernel. - * - * There can be multiple controllers and the editor will let users choose which controller to use for a certain notebook. The - * {@linkcode NotebookController.notebookType notebookType}-property defines for what kind of notebooks a controller is for and - * the {@linkcode NotebookController.updateNotebookAffinity updateNotebookAffinity}-function allows controllers to set a preference - * for specific notebook documents. When a controller has been selected its - * {@link NotebookController.onDidChangeSelectedNotebooks onDidChangeSelectedNotebooks}-event fires. - * - * When a cell is being run the editor will invoke the {@linkcode NotebookController.executeHandler executeHandler} and a controller - * is expected to create and finalize a {@link NotebookCellExecution notebook cell execution}. However, controllers are also free - * to create executions by themselves. - */ - export interface NotebookController { - /** - * The identifier of this notebook controller. - * - * _Note_ that controllers are remembered by their identifier and that extensions should use - * stable identifiers across sessions. - */ - readonly id: string; - - /** - * The notebook type this controller is for. - */ - readonly notebookType: string; - - /** - * An array of language identifiers that are supported by this - * controller. Any language identifier from {@linkcode languages.getLanguages getLanguages} - * is possible. When falsy all languages are supported. - * - * Samples: - * ```js - * // support JavaScript and TypeScript - * myController.supportedLanguages = ['javascript', 'typescript'] - * - * // support all languages - * myController.supportedLanguages = undefined; // falsy - * myController.supportedLanguages = []; // falsy - * ``` - */ - supportedLanguages?: string[]; - - /** - * The human-readable label of this notebook controller. - */ - label: string; - - /** - * The human-readable description which is rendered less prominent. - */ - description?: string; - - /** - * The human-readable detail which is rendered less prominent. - */ - detail?: string; - - /** - * Whether this controller supports execution order so that the - * editor can render placeholders for them. - */ - supportsExecutionOrder?: boolean; - - /** - * Create a cell execution task. - * - * _Note_ that there can only be one execution per cell at a time and that an error is thrown if - * a cell execution is created while another is still active. - * - * This should be used in response to the {@link NotebookController.executeHandler execution handler} - * being called or when cell execution has been started else, e.g when a cell was already - * executing or when cell execution was triggered from another source. - * - * @param cell The notebook cell for which to create the execution. - * @returns A notebook cell execution. - */ - createNotebookCellExecution(cell: NotebookCell): NotebookCellExecution; - - /** - * The execute handler is invoked when the run gestures in the UI are selected, e.g Run Cell, Run All, - * Run Selection etc. The execute handler is responsible for creating and managing {@link NotebookCellExecution execution}-objects. - */ - executeHandler: ( - cells: NotebookCell[], - notebook: NotebookDocument, - controller: NotebookController, - ) => void | Thenable; - - /** - * Optional interrupt handler. - * - * By default cell execution is canceled via {@link NotebookCellExecution.token tokens}. Cancellation - * tokens require that a controller can keep track of its execution so that it can cancel a specific execution at a later - * point. Not all scenarios allow for that, eg. REPL-style controllers often work by interrupting whatever is currently - * running. For those cases the interrupt handler exists - it can be thought of as the equivalent of `SIGINT` - * or `Control+C` in terminals. - * - * _Note_ that supporting {@link NotebookCellExecution.token cancellation tokens} is preferred and that interrupt handlers should - * only be used when tokens cannot be supported. - */ - interruptHandler?: ( - notebook: NotebookDocument, - ) => void | Thenable; - - /** - * An event that fires whenever a controller has been selected or un-selected for a notebook document. - * - * There can be multiple controllers for a notebook and in that case a controllers needs to be _selected_. This is a user gesture - * and happens either explicitly or implicitly when interacting with a notebook for which a controller was _suggested_. When possible, - * the editor _suggests_ a controller that is most likely to be _selected_. - * - * _Note_ that controller selection is persisted (by the controllers {@link NotebookController.id id}) and restored as soon as a - * controller is re-created or as a notebook is {@link workspace.onDidOpenNotebookDocument opened}. - */ - readonly onDidChangeSelectedNotebooks: Event<{ - /** - * The notebook for which the controller has been selected or un-selected. - */ - readonly notebook: NotebookDocument; - /** - * Whether the controller has been selected or un-selected. - */ - readonly selected: boolean; - }>; - - /** - * A controller can set affinities for specific notebook documents. This allows a controller - * to be presented more prominent for some notebooks. - * - * @param notebook The notebook for which a priority is set. - * @param affinity A controller affinity - */ - updateNotebookAffinity( - notebook: NotebookDocument, - affinity: NotebookControllerAffinity, - ): void; - - /** - * Dispose and free associated resources. - */ - dispose(): void; - } - - /** - * A NotebookCellExecution is how {@link NotebookController notebook controller} modify a notebook cell as - * it is executing. - * - * When a cell execution object is created, the cell enters the {@linkcode NotebookCellExecutionState.Pending Pending} state. - * When {@linkcode NotebookCellExecution.start start(...)} is called on the execution task, it enters the {@linkcode NotebookCellExecutionState.Executing Executing} state. When - * {@linkcode NotebookCellExecution.end end(...)} is called, it enters the {@linkcode NotebookCellExecutionState.Idle Idle} state. - */ - export interface NotebookCellExecution { - /** - * The {@link NotebookCell cell} for which this execution has been created. - */ - readonly cell: NotebookCell; - - /** - * A cancellation token which will be triggered when the cell execution is canceled - * from the UI. - * - * _Note_ that the cancellation token will not be triggered when the {@link NotebookController controller} - * that created this execution uses an {@link NotebookController.interruptHandler interrupt-handler}. - */ - readonly token: CancellationToken; - - /** - * Set and unset the order of this cell execution. - */ - executionOrder: number | undefined; - - /** - * Signal that the execution has begun. - * - * @param startTime The time that execution began, in milliseconds in the Unix epoch. Used to drive the clock - * that shows for how long a cell has been running. If not given, the clock won't be shown. - */ - start(startTime?: number): void; - - /** - * Signal that execution has ended. - * - * @param success If true, a green check is shown on the cell status bar. - * If false, a red X is shown. - * If undefined, no check or X icon is shown. - * @param endTime The time that execution finished, in milliseconds in the Unix epoch. - */ - end(success: boolean | undefined, endTime?: number): void; - - /** - * Clears the output of the cell that is executing or of another cell that is affected by this execution. - * - * @param cell Cell for which output is cleared. Defaults to the {@link NotebookCellExecution.cell cell} of - * this execution. - * @returns A thenable that resolves when the operation finished. - */ - clearOutput(cell?: NotebookCell): Thenable; - - /** - * Replace the output of the cell that is executing or of another cell that is affected by this execution. - * - * @param out Output that replaces the current output. - * @param cell Cell for which output is cleared. Defaults to the {@link NotebookCellExecution.cell cell} of - * this execution. - * @returns A thenable that resolves when the operation finished. - */ - replaceOutput( - out: NotebookCellOutput | readonly NotebookCellOutput[], - cell?: NotebookCell, - ): Thenable; - - /** - * Append to the output of the cell that is executing or to another cell that is affected by this execution. - * - * @param out Output that is appended to the current output. - * @param cell Cell for which output is cleared. Defaults to the {@link NotebookCellExecution.cell cell} of - * this execution. - * @returns A thenable that resolves when the operation finished. - */ - appendOutput( - out: NotebookCellOutput | readonly NotebookCellOutput[], - cell?: NotebookCell, - ): Thenable; - - /** - * Replace all output items of existing cell output. - * - * @param items Output items that replace the items of existing output. - * @param output Output object that already exists. - * @returns A thenable that resolves when the operation finished. - */ - replaceOutputItems( - items: NotebookCellOutputItem | readonly NotebookCellOutputItem[], - output: NotebookCellOutput, - ): Thenable; - - /** - * Append output items to existing cell output. - * - * @param items Output items that are append to existing output. - * @param output Output object that already exists. - * @returns A thenable that resolves when the operation finished. - */ - appendOutputItems( - items: NotebookCellOutputItem | readonly NotebookCellOutputItem[], - output: NotebookCellOutput, - ): Thenable; - } - - /** - * Represents the alignment of status bar items. - */ - export enum NotebookCellStatusBarAlignment { - /** - * Aligned to the left side. - */ - Left = 1, - - /** - * Aligned to the right side. - */ - Right = 2, - } - - /** - * A contribution to a cell's status bar - */ - export class NotebookCellStatusBarItem { - /** - * The text to show for the item. - */ - text: string; - - /** - * Whether the item is aligned to the left or right. - */ - alignment: NotebookCellStatusBarAlignment; - - /** - * An optional {@linkcode Command} or identifier of a command to run on click. - * - * The command must be {@link commands.getCommands known}. - * - * Note that if this is a {@linkcode Command} object, only the {@linkcode Command.command command} and {@linkcode Command.arguments arguments} - * are used by the editor. - */ - command?: string | Command; - - /** - * A tooltip to show when the item is hovered. - */ - tooltip?: string; - - /** - * The priority of the item. A higher value item will be shown more to the left. - */ - priority?: number; - - /** - * Accessibility information used when a screen reader interacts with this item. - */ - accessibilityInformation?: AccessibilityInformation; - - /** - * Creates a new NotebookCellStatusBarItem. - * @param text The text to show for the item. - * @param alignment Whether the item is aligned to the left or right. - */ - constructor(text: string, alignment: NotebookCellStatusBarAlignment); - } - - /** - * A provider that can contribute items to the status bar that appears below a cell's editor. - */ - export interface NotebookCellStatusBarItemProvider { - /** - * An optional event to signal that statusbar items have changed. The provide method will be called again. - */ - onDidChangeCellStatusBarItems?: Event; - - /** - * The provider will be called when the cell scrolls into view, when its content, outputs, language, or metadata change, and when it changes execution state. - * @param cell The cell for which to return items. - * @param token A token triggered if this request should be cancelled. - * @returns One or more {@link NotebookCellStatusBarItem cell statusbar items} - */ - provideCellStatusBarItems( - cell: NotebookCell, - token: CancellationToken, - ): ProviderResult< - NotebookCellStatusBarItem | NotebookCellStatusBarItem[] - >; - } - - /** - * Namespace for notebooks. - * - * The notebooks functionality is composed of three loosely coupled components: - * - * 1. {@link NotebookSerializer} enable the editor to open, show, and save notebooks - * 2. {@link NotebookController} own the execution of notebooks, e.g they create output from code cells. - * 3. NotebookRenderer present notebook output in the editor. They run in a separate context. - */ - export namespace notebooks { - /** - * Creates a new notebook controller. - * - * @param id Identifier of the controller. Must be unique per extension. - * @param notebookType A notebook type for which this controller is for. - * @param label The label of the controller. - * @param handler The execute-handler of the controller. - * @returns A new notebook controller. - */ - export function createNotebookController( - id: string, - notebookType: string, - label: string, - handler?: ( - cells: NotebookCell[], - notebook: NotebookDocument, - controller: NotebookController, - ) => void | Thenable, - ): NotebookController; - - /** - * Register a {@link NotebookCellStatusBarItemProvider cell statusbar item provider} for the given notebook type. - * - * @param notebookType The notebook type to register for. - * @param provider A cell status bar provider. - * @returns A {@link Disposable} that unregisters this provider when being disposed. - */ - export function registerNotebookCellStatusBarItemProvider( - notebookType: string, - provider: NotebookCellStatusBarItemProvider, - ): Disposable; - - /** - * Creates a new messaging instance used to communicate with a specific renderer. - * - * * *Note 1:* Extensions can only create renderer that they have defined in their `package.json`-file - * * *Note 2:* A renderer only has access to messaging if `requiresMessaging` is set to `always` or `optional` in - * its `notebookRenderer` contribution. - * - * @param rendererId The renderer ID to communicate with - * @returns A new notebook renderer messaging object. - */ - export function createRendererMessaging( - rendererId: string, - ): NotebookRendererMessaging; - } - - /** - * Represents the input box in the Source Control viewlet. - */ - export interface SourceControlInputBox { - /** - * Setter and getter for the contents of the input box. - */ - value: string; - - /** - * A string to show as placeholder in the input box to guide the user. - */ - placeholder: string; - - /** - * Controls whether the input box is enabled (default is `true`). - */ - enabled: boolean; - - /** - * Controls whether the input box is visible (default is `true`). - */ - visible: boolean; - } - - /** - * A quick diff provider provides a {@link Uri uri} to the original state of a - * modified resource. The editor will use this information to render ad'hoc diffs - * within the text. - */ - export interface QuickDiffProvider { - /** - * Provide a {@link Uri} to the original resource of any given resource uri. - * - * @param uri The uri of the resource open in a text editor. - * @param token A cancellation token. - * @returns A thenable that resolves to uri of the matching original resource. - */ - provideOriginalResource?( - uri: Uri, - token: CancellationToken, - ): ProviderResult; - } - - /** - * The theme-aware decorations for a - * {@link SourceControlResourceState source control resource state}. - */ - export interface SourceControlResourceThemableDecorations { - /** - * The icon path for a specific - * {@link SourceControlResourceState source control resource state}. - */ - readonly iconPath?: string | Uri | ThemeIcon; - } - - /** - * The decorations for a {@link SourceControlResourceState source control resource state}. - * Can be independently specified for light and dark themes. - */ - export interface SourceControlResourceDecorations - extends SourceControlResourceThemableDecorations { - /** - * Whether the {@link SourceControlResourceState source control resource state} should - * be striked-through in the UI. - */ - readonly strikeThrough?: boolean; - - /** - * Whether the {@link SourceControlResourceState source control resource state} should - * be faded in the UI. - */ - readonly faded?: boolean; - - /** - * The title for a specific - * {@link SourceControlResourceState source control resource state}. - */ - readonly tooltip?: string; - - /** - * The light theme decorations. - */ - readonly light?: SourceControlResourceThemableDecorations; - - /** - * The dark theme decorations. - */ - readonly dark?: SourceControlResourceThemableDecorations; - } - - /** - * An source control resource state represents the state of an underlying workspace - * resource within a certain {@link SourceControlResourceGroup source control group}. - */ - export interface SourceControlResourceState { - /** - * The {@link Uri} of the underlying resource inside the workspace. - */ - readonly resourceUri: Uri; - - /** - * The {@link Command} which should be run when the resource - * state is open in the Source Control viewlet. - */ - readonly command?: Command; - - /** - * The {@link SourceControlResourceDecorations decorations} for this source control - * resource state. - */ - readonly decorations?: SourceControlResourceDecorations; - - /** - * Context value of the resource state. This can be used to contribute resource specific actions. - * For example, if a resource is given a context value as `diffable`. When contributing actions to `scm/resourceState/context` - * using `menus` extension point, you can specify context value for key `scmResourceState` in `when` expressions, like `scmResourceState == diffable`. - * ```json - * "contributes": { - * "menus": { - * "scm/resourceState/context": [ - * { - * "command": "extension.diff", - * "when": "scmResourceState == diffable" - * } - * ] - * } - * } - * ``` - * This will show action `extension.diff` only for resources with `contextValue` is `diffable`. - */ - readonly contextValue?: string; - } - - /** - * A source control resource group is a collection of - * {@link SourceControlResourceState source control resource states}. - */ - export interface SourceControlResourceGroup { - /** - * The id of this source control resource group. - */ - readonly id: string; - - /** - * The label of this source control resource group. - */ - label: string; - - /** - * Whether this source control resource group is hidden when it contains - * no {@link SourceControlResourceState source control resource states}. - */ - hideWhenEmpty?: boolean; - - /** - * This group's collection of - * {@link SourceControlResourceState source control resource states}. - */ - resourceStates: SourceControlResourceState[]; - - /** - * Dispose this source control resource group. - */ - dispose(): void; - } - - /** - * An source control is able to provide {@link SourceControlResourceState resource states} - * to the editor and interact with the editor in several source control related ways. - */ - export interface SourceControl { - /** - * The id of this source control. - */ - readonly id: string; - - /** - * The human-readable label of this source control. - */ - readonly label: string; - - /** - * The (optional) Uri of the root of this source control. - */ - readonly rootUri: Uri | undefined; - - /** - * The {@link SourceControlInputBox input box} for this source control. - */ - readonly inputBox: SourceControlInputBox; - - /** - * The UI-visible count of {@link SourceControlResourceState resource states} of - * this source control. - * - * If undefined, this source control will - * - display its UI-visible count as zero, and - * - contribute the count of its {@link SourceControlResourceState resource states} to the UI-visible aggregated count for all source controls - */ - count?: number; - - /** - * An optional {@link QuickDiffProvider quick diff provider}. - */ - quickDiffProvider?: QuickDiffProvider; - - /** - * Optional commit template string. - * - * The Source Control viewlet will populate the Source Control - * input with this value when appropriate. - */ - commitTemplate?: string; - - /** - * Optional accept input command. - * - * This command will be invoked when the user accepts the value - * in the Source Control input. - */ - acceptInputCommand?: Command; - - /** - * Optional status bar commands. - * - * These commands will be displayed in the editor's status bar. - */ - statusBarCommands?: Command[]; - - /** - * Create a new {@link SourceControlResourceGroup resource group}. - */ - createResourceGroup( - id: string, - label: string, - ): SourceControlResourceGroup; - - /** - * Dispose this source control. - */ - dispose(): void; - } - - /** - * Namespace for source control mangement. - */ - export namespace scm { - /** - * The {@link SourceControlInputBox input box} for the last source control - * created by the extension. - * - * @deprecated Use SourceControl.inputBox instead - */ - export const inputBox: SourceControlInputBox; - - /** - * Creates a new {@link SourceControl source control} instance. - * - * @param id An `id` for the source control. Something short, e.g.: `git`. - * @param label A human-readable string for the source control. E.g.: `Git`. - * @param rootUri An optional Uri of the root of the source control. E.g.: `Uri.parse(workspaceRoot)`. - * @returns An instance of {@link SourceControl source control}. - */ - export function createSourceControl( - id: string, - label: string, - rootUri?: Uri, - ): SourceControl; - } - - /** - * A DebugProtocolMessage is an opaque stand-in type for the [ProtocolMessage](https://microsoft.github.io/debug-adapter-protocol/specification#Base_Protocol_ProtocolMessage) type defined in the Debug Adapter Protocol. - */ - export interface DebugProtocolMessage { - // Properties: see [ProtocolMessage details](https://microsoft.github.io/debug-adapter-protocol/specification#Base_Protocol_ProtocolMessage). - } - - /** - * A DebugProtocolSource is an opaque stand-in type for the [Source](https://microsoft.github.io/debug-adapter-protocol/specification#Types_Source) type defined in the Debug Adapter Protocol. - */ - export interface DebugProtocolSource { - // Properties: see [Source details](https://microsoft.github.io/debug-adapter-protocol/specification#Types_Source). - } - - /** - * A DebugProtocolBreakpoint is an opaque stand-in type for the [Breakpoint](https://microsoft.github.io/debug-adapter-protocol/specification#Types_Breakpoint) type defined in the Debug Adapter Protocol. - */ - export interface DebugProtocolBreakpoint { - // Properties: see [Breakpoint details](https://microsoft.github.io/debug-adapter-protocol/specification#Types_Breakpoint). - } - - /** - * Configuration for a debug session. - */ - export interface DebugConfiguration { - /** - * The type of the debug session. - */ - type: string; - - /** - * The name of the debug session. - */ - name: string; - - /** - * The request type of the debug session. - */ - request: string; - - /** - * Additional debug type specific properties. - */ - [key: string]: any; - } - - /** - * A debug session. - */ - export interface DebugSession { - /** - * The unique ID of this debug session. - */ - readonly id: string; - - /** - * The debug session's type from the {@link DebugConfiguration debug configuration}. - */ - readonly type: string; - - /** - * The parent session of this debug session, if it was created as a child. - * @see DebugSessionOptions.parentSession - */ - readonly parentSession?: DebugSession; - - /** - * The debug session's name is initially taken from the {@link DebugConfiguration debug configuration}. - * Any changes will be properly reflected in the UI. - */ - name: string; - - /** - * The workspace folder of this session or `undefined` for a folderless setup. - */ - readonly workspaceFolder: WorkspaceFolder | undefined; - - /** - * The "resolved" {@link DebugConfiguration debug configuration} of this session. - * "Resolved" means that - * - all variables have been substituted and - * - platform specific attribute sections have been "flattened" for the matching platform and removed for non-matching platforms. - */ - readonly configuration: DebugConfiguration; - - /** - * Send a custom request to the debug adapter. - */ - customRequest(command: string, args?: any): Thenable; - - /** - * Maps a breakpoint in the editor to the corresponding Debug Adapter Protocol (DAP) breakpoint that is managed by the debug adapter of the debug session. - * If no DAP breakpoint exists (either because the editor breakpoint was not yet registered or because the debug adapter is not interested in the breakpoint), the value `undefined` is returned. - * - * @param breakpoint A {@link Breakpoint} in the editor. - * @returns A promise that resolves to the Debug Adapter Protocol breakpoint or `undefined`. - */ - getDebugProtocolBreakpoint( - breakpoint: Breakpoint, - ): Thenable; - } - - /** - * A custom Debug Adapter Protocol event received from a {@link DebugSession debug session}. - */ - export interface DebugSessionCustomEvent { - /** - * The {@link DebugSession debug session} for which the custom event was received. - */ - readonly session: DebugSession; - - /** - * Type of event. - */ - readonly event: string; - - /** - * Event specific information. - */ - readonly body: any; - } - - /** - * A debug configuration provider allows to add debug configurations to the debug service - * and to resolve launch configurations before they are used to start a debug session. - * A debug configuration provider is registered via {@link debug.registerDebugConfigurationProvider}. - */ - export interface DebugConfigurationProvider { - /** - * Provides {@link DebugConfiguration debug configuration} to the debug service. If more than one debug configuration provider is - * registered for the same type, debug configurations are concatenated in arbitrary order. - * - * @param folder The workspace folder for which the configurations are used or `undefined` for a folderless setup. - * @param token A cancellation token. - * @returns An array of {@link DebugConfiguration debug configurations}. - */ - provideDebugConfigurations?( - folder: WorkspaceFolder | undefined, - token?: CancellationToken, - ): ProviderResult; - - /** - * Resolves a {@link DebugConfiguration debug configuration} by filling in missing values or by adding/changing/removing attributes. - * If more than one debug configuration provider is registered for the same type, the resolveDebugConfiguration calls are chained - * in arbitrary order and the initial debug configuration is piped through the chain. - * Returning the value 'undefined' prevents the debug session from starting. - * Returning the value 'null' prevents the debug session from starting and opens the underlying debug configuration instead. - * - * @param folder The workspace folder from which the configuration originates from or `undefined` for a folderless setup. - * @param debugConfiguration The {@link DebugConfiguration debug configuration} to resolve. - * @param token A cancellation token. - * @returns The resolved debug configuration or undefined or null. - */ - resolveDebugConfiguration?( - folder: WorkspaceFolder | undefined, - debugConfiguration: DebugConfiguration, - token?: CancellationToken, - ): ProviderResult; - - /** - * This hook is directly called after 'resolveDebugConfiguration' but with all variables substituted. - * It can be used to resolve or verify a {@link DebugConfiguration debug configuration} by filling in missing values or by adding/changing/removing attributes. - * If more than one debug configuration provider is registered for the same type, the 'resolveDebugConfigurationWithSubstitutedVariables' calls are chained - * in arbitrary order and the initial debug configuration is piped through the chain. - * Returning the value 'undefined' prevents the debug session from starting. - * Returning the value 'null' prevents the debug session from starting and opens the underlying debug configuration instead. - * - * @param folder The workspace folder from which the configuration originates from or `undefined` for a folderless setup. - * @param debugConfiguration The {@link DebugConfiguration debug configuration} to resolve. - * @param token A cancellation token. - * @returns The resolved debug configuration or undefined or null. - */ - resolveDebugConfigurationWithSubstitutedVariables?( - folder: WorkspaceFolder | undefined, - debugConfiguration: DebugConfiguration, - token?: CancellationToken, - ): ProviderResult; - } - - /** - * Represents a debug adapter executable and optional arguments and runtime options passed to it. - */ - export class DebugAdapterExecutable { - /** - * Creates a description for a debug adapter based on an executable program. - * - * @param command The command or executable path that implements the debug adapter. - * @param args Optional arguments to be passed to the command or executable. - * @param options Optional options to be used when starting the command or executable. - */ - constructor( - command: string, - args?: string[], - options?: DebugAdapterExecutableOptions, - ); - - /** - * The command or path of the debug adapter executable. - * A command must be either an absolute path of an executable or the name of an command to be looked up via the PATH environment variable. - * The special value 'node' will be mapped to the editor's built-in Node.js runtime. - */ - readonly command: string; - - /** - * The arguments passed to the debug adapter executable. Defaults to an empty array. - */ - readonly args: string[]; - - /** - * Optional options to be used when the debug adapter is started. - * Defaults to undefined. - */ - readonly options?: DebugAdapterExecutableOptions; - } - - /** - * Options for a debug adapter executable. - */ - export interface DebugAdapterExecutableOptions { - /** - * The additional environment of the executed program or shell. If omitted - * the parent process' environment is used. If provided it is merged with - * the parent process' environment. - */ - env?: { [key: string]: string }; - - /** - * The current working directory for the executed debug adapter. - */ - cwd?: string; - } - - /** - * Represents a debug adapter running as a socket based server. - */ - export class DebugAdapterServer { - /** - * The port. - */ - readonly port: number; - - /** - * The host. - */ - readonly host?: string | undefined; - - /** - * Create a description for a debug adapter running as a socket based server. - */ - constructor(port: number, host?: string); - } - - /** - * Represents a debug adapter running as a Named Pipe (on Windows)/UNIX Domain Socket (on non-Windows) based server. - */ - export class DebugAdapterNamedPipeServer { - /** - * The path to the NamedPipe/UNIX Domain Socket. - */ - readonly path: string; - - /** - * Create a description for a debug adapter running as a Named Pipe (on Windows)/UNIX Domain Socket (on non-Windows) based server. - */ - constructor(path: string); - } - - /** - * A debug adapter that implements the Debug Adapter Protocol can be registered with the editor if it implements the DebugAdapter interface. - */ - export interface DebugAdapter extends Disposable { - /** - * An event which fires after the debug adapter has sent a Debug Adapter Protocol message to the editor. - * Messages can be requests, responses, or events. - */ - readonly onDidSendMessage: Event; - - /** - * Handle a Debug Adapter Protocol message. - * Messages can be requests, responses, or events. - * Results or errors are returned via onSendMessage events. - * @param message A Debug Adapter Protocol message - */ - handleMessage(message: DebugProtocolMessage): void; - } - - /** - * A debug adapter descriptor for an inline implementation. - */ - export class DebugAdapterInlineImplementation { - /** - * Create a descriptor for an inline implementation of a debug adapter. - */ - constructor(implementation: DebugAdapter); - } - - /** - * Represents the different types of debug adapters - */ - export type DebugAdapterDescriptor = - | DebugAdapterExecutable - | DebugAdapterServer - | DebugAdapterNamedPipeServer - | DebugAdapterInlineImplementation; - - /** - * A debug adaper factory that creates {@link DebugAdapterDescriptor debug adapter descriptors}. - */ - export interface DebugAdapterDescriptorFactory { - /** - * 'createDebugAdapterDescriptor' is called at the start of a debug session to provide details about the debug adapter to use. - * These details must be returned as objects of type {@link DebugAdapterDescriptor}. - * Currently two types of debug adapters are supported: - * - a debug adapter executable is specified as a command path and arguments (see {@link DebugAdapterExecutable}), - * - a debug adapter server reachable via a communication port (see {@link DebugAdapterServer}). - * If the method is not implemented the default behavior is this: - * createDebugAdapter(session: DebugSession, executable: DebugAdapterExecutable) { - * if (typeof session.configuration.debugServer === 'number') { - * return new DebugAdapterServer(session.configuration.debugServer); - * } - * return executable; - * } - * @param session The {@link DebugSession debug session} for which the debug adapter will be used. - * @param executable The debug adapter's executable information as specified in the package.json (or undefined if no such information exists). - * @returns a {@link DebugAdapterDescriptor debug adapter descriptor} or undefined. - */ - createDebugAdapterDescriptor( - session: DebugSession, - executable: DebugAdapterExecutable | undefined, - ): ProviderResult; - } - - /** - * A Debug Adapter Tracker is a means to track the communication between the editor and a Debug Adapter. - */ - export interface DebugAdapterTracker { - /** - * A session with the debug adapter is about to be started. - */ - onWillStartSession?(): void; - /** - * The debug adapter is about to receive a Debug Adapter Protocol message from the editor. - */ - onWillReceiveMessage?(message: any): void; - /** - * The debug adapter has sent a Debug Adapter Protocol message to the editor. - */ - onDidSendMessage?(message: any): void; - /** - * The debug adapter session is about to be stopped. - */ - onWillStopSession?(): void; - /** - * An error with the debug adapter has occurred. - */ - onError?(error: Error): void; - /** - * The debug adapter has exited with the given exit code or signal. - */ - onExit?(code: number | undefined, signal: string | undefined): void; - } - - /** - * A debug adaper factory that creates {@link DebugAdapterTracker debug adapter trackers}. - */ - export interface DebugAdapterTrackerFactory { - /** - * The method 'createDebugAdapterTracker' is called at the start of a debug session in order - * to return a "tracker" object that provides read-access to the communication between the editor and a debug adapter. - * - * @param session The {@link DebugSession debug session} for which the debug adapter tracker will be used. - * @returns A {@link DebugAdapterTracker debug adapter tracker} or undefined. - */ - createDebugAdapterTracker( - session: DebugSession, - ): ProviderResult; - } - - /** - * Represents the debug console. - */ - export interface DebugConsole { - /** - * Append the given value to the debug console. - * - * @param value A string, falsy values will not be printed. - */ - append(value: string): void; - - /** - * Append the given value and a line feed character - * to the debug console. - * - * @param value A string, falsy values will be printed. - */ - appendLine(value: string): void; - } - - /** - * An event describing the changes to the set of {@link Breakpoint breakpoints}. - */ - export interface BreakpointsChangeEvent { - /** - * Added breakpoints. - */ - readonly added: readonly Breakpoint[]; - - /** - * Removed breakpoints. - */ - readonly removed: readonly Breakpoint[]; - - /** - * Changed breakpoints. - */ - readonly changed: readonly Breakpoint[]; - } - - /** - * The base class of all breakpoint types. - */ - export class Breakpoint { - /** - * The unique ID of the breakpoint. - */ - readonly id: string; - /** - * Is breakpoint enabled. - */ - readonly enabled: boolean; - /** - * An optional expression for conditional breakpoints. - */ - readonly condition?: string | undefined; - /** - * An optional expression that controls how many hits of the breakpoint are ignored. - */ - readonly hitCondition?: string | undefined; - /** - * An optional message that gets logged when this breakpoint is hit. Embedded expressions within {} are interpolated by the debug adapter. - */ - readonly logMessage?: string | undefined; - - /** - * Creates a new breakpoint - * - * @param enabled Is breakpoint enabled. - * @param condition Expression for conditional breakpoints - * @param hitCondition Expression that controls how many hits of the breakpoint are ignored - * @param logMessage Log message to display when breakpoint is hit - */ - protected constructor( - enabled?: boolean, - condition?: string, - hitCondition?: string, - logMessage?: string, - ); - } - - /** - * A breakpoint specified by a source location. - */ - export class SourceBreakpoint extends Breakpoint { - /** - * The source and line position of this breakpoint. - */ - readonly location: Location; - - /** - * Create a new breakpoint for a source location. - */ - constructor( - location: Location, - enabled?: boolean, - condition?: string, - hitCondition?: string, - logMessage?: string, - ); - } - - /** - * A breakpoint specified by a function name. - */ - export class FunctionBreakpoint extends Breakpoint { - /** - * The name of the function to which this breakpoint is attached. - */ - readonly functionName: string; - - /** - * Create a new function breakpoint. - */ - constructor( - functionName: string, - enabled?: boolean, - condition?: string, - hitCondition?: string, - logMessage?: string, - ); - } - - /** - * Debug console mode used by debug session, see {@link DebugSessionOptions options}. - */ - export enum DebugConsoleMode { - /** - * Debug session should have a separate debug console. - */ - Separate = 0, - - /** - * Debug session should share debug console with its parent session. - * This value has no effect for sessions which do not have a parent session. - */ - MergeWithParent = 1, - } - - /** - * Options for {@link debug.startDebugging starting a debug session}. - */ - export interface DebugSessionOptions { - /** - * When specified the newly created debug session is registered as a "child" session of this - * "parent" debug session. - */ - parentSession?: DebugSession; - - /** - * Controls whether lifecycle requests like 'restart' are sent to the newly created session or its parent session. - * By default (if the property is false or missing), lifecycle requests are sent to the new session. - * This property is ignored if the session has no parent session. - */ - lifecycleManagedByParent?: boolean; - - /** - * Controls whether this session should have a separate debug console or share it - * with the parent session. Has no effect for sessions which do not have a parent session. - * Defaults to Separate. - */ - consoleMode?: DebugConsoleMode; - - /** - * Controls whether this session should run without debugging, thus ignoring breakpoints. - * When this property is not specified, the value from the parent session (if there is one) is used. - */ - noDebug?: boolean; - - /** - * Controls if the debug session's parent session is shown in the CALL STACK view even if it has only a single child. - * By default, the debug session will never hide its parent. - * If compact is true, debug sessions with a single child are hidden in the CALL STACK view to make the tree more compact. - */ - compact?: boolean; - - /** - * When true, a save will not be triggered for open editors when starting a debug session, regardless of the value of the `debug.saveBeforeStart` setting. - */ - suppressSaveBeforeStart?: boolean; - - /** - * When true, the debug toolbar will not be shown for this session. - */ - suppressDebugToolbar?: boolean; - - /** - * When true, the window statusbar color will not be changed for this session. - */ - suppressDebugStatusbar?: boolean; - - /** - * When true, the debug viewlet will not be automatically revealed for this session. - */ - suppressDebugView?: boolean; - - /** - * Signals to the editor that the debug session was started from a test run - * request. This is used to link the lifecycle of the debug session and - * test run in UI actions. - */ - testRun?: TestRun; - } - - /** - * A DebugConfigurationProviderTriggerKind specifies when the `provideDebugConfigurations` method of a `DebugConfigurationProvider` is triggered. - * Currently there are two situations: to provide the initial debug configurations for a newly created launch.json or - * to provide dynamically generated debug configurations when the user asks for them through the UI (e.g. via the "Select and Start Debugging" command). - * A trigger kind is used when registering a `DebugConfigurationProvider` with {@link debug.registerDebugConfigurationProvider}. - */ - export enum DebugConfigurationProviderTriggerKind { - /** - * `DebugConfigurationProvider.provideDebugConfigurations` is called to provide the initial debug configurations for a newly created launch.json. - */ - Initial = 1, - /** - * `DebugConfigurationProvider.provideDebugConfigurations` is called to provide dynamically generated debug configurations when the user asks for them through the UI (e.g. via the "Select and Start Debugging" command). - */ - Dynamic = 2, - } - - /** - * Represents a thread in a debug session. - */ - export class DebugThread { - /** - * Debug session for thread. - */ - readonly session: DebugSession; - - /** - * ID of the associated thread in the debug protocol. - */ - readonly threadId: number; - - /** - * @hidden - */ - private constructor(session: DebugSession, threadId: number); - } - - /** - * Represents a stack frame in a debug session. - */ - export class DebugStackFrame { - /** - * Debug session for thread. - */ - readonly session: DebugSession; - - /** - * ID of the associated thread in the debug protocol. - */ - readonly threadId: number; - /** - * ID of the stack frame in the debug protocol. - */ - readonly frameId: number; - - /** - * @hidden - */ - private constructor( - session: DebugSession, - threadId: number, - frameId: number, - ); - } - - /** - * Namespace for debug functionality. - */ - export namespace debug { - /** - * The currently active {@link DebugSession debug session} or `undefined`. The active debug session is the one - * represented by the debug action floating window or the one currently shown in the drop down menu of the debug action floating window. - * If no debug session is active, the value is `undefined`. - */ - export let activeDebugSession: DebugSession | undefined; - - /** - * The currently active {@link DebugConsole debug console}. - * If no debug session is active, output sent to the debug console is not shown. - */ - export let activeDebugConsole: DebugConsole; - - /** - * List of breakpoints. - */ - export let breakpoints: readonly Breakpoint[]; - - /** - * An {@link Event} which fires when the {@link debug.activeDebugSession active debug session} - * has changed. *Note* that the event also fires when the active debug session changes - * to `undefined`. - */ - export const onDidChangeActiveDebugSession: Event< - DebugSession | undefined - >; - - /** - * An {@link Event} which fires when a new {@link DebugSession debug session} has been started. - */ - export const onDidStartDebugSession: Event; - - /** - * An {@link Event} which fires when a custom DAP event is received from the {@link DebugSession debug session}. - */ - export const onDidReceiveDebugSessionCustomEvent: Event; - - /** - * An {@link Event} which fires when a {@link DebugSession debug session} has terminated. - */ - export const onDidTerminateDebugSession: Event; - - /** - * An {@link Event} that is emitted when the set of breakpoints is added, removed, or changed. - */ - export const onDidChangeBreakpoints: Event; - - /** - * The currently focused thread or stack frame, or `undefined` if no - * thread or stack is focused. A thread can be focused any time there is - * an active debug session, while a stack frame can only be focused when - * a session is paused and the call stack has been retrieved. - */ - export const activeStackItem: DebugThread | DebugStackFrame | undefined; - - /** - * An event which fires when the {@link debug.activeStackItem} has changed. - */ - export const onDidChangeActiveStackItem: Event< - DebugThread | DebugStackFrame | undefined - >; - - /** - * Register a {@link DebugConfigurationProvider debug configuration provider} for a specific debug type. - * The optional {@link DebugConfigurationProviderTriggerKind triggerKind} can be used to specify when the `provideDebugConfigurations` method of the provider is triggered. - * Currently two trigger kinds are possible: with the value `Initial` (or if no trigger kind argument is given) the `provideDebugConfigurations` method is used to provide the initial debug configurations to be copied into a newly created launch.json. - * With the trigger kind `Dynamic` the `provideDebugConfigurations` method is used to dynamically determine debug configurations to be presented to the user (in addition to the static configurations from the launch.json). - * Please note that the `triggerKind` argument only applies to the `provideDebugConfigurations` method: so the `resolveDebugConfiguration` methods are not affected at all. - * Registering a single provider with resolve methods for different trigger kinds, results in the same resolve methods called multiple times. - * More than one provider can be registered for the same type. - * - * @param debugType The debug type for which the provider is registered. - * @param provider The {@link DebugConfigurationProvider debug configuration provider} to register. - * @param triggerKind The {@link DebugConfigurationProviderTriggerKind trigger} for which the 'provideDebugConfiguration' method of the provider is registered. If `triggerKind` is missing, the value `DebugConfigurationProviderTriggerKind.Initial` is assumed. - * @returns A {@link Disposable} that unregisters this provider when being disposed. - */ - export function registerDebugConfigurationProvider( - debugType: string, - provider: DebugConfigurationProvider, - triggerKind?: DebugConfigurationProviderTriggerKind, - ): Disposable; - - /** - * Register a {@link DebugAdapterDescriptorFactory debug adapter descriptor factory} for a specific debug type. - * An extension is only allowed to register a DebugAdapterDescriptorFactory for the debug type(s) defined by the extension. Otherwise an error is thrown. - * Registering more than one DebugAdapterDescriptorFactory for a debug type results in an error. - * - * @param debugType The debug type for which the factory is registered. - * @param factory The {@link DebugAdapterDescriptorFactory debug adapter descriptor factory} to register. - * @returns A {@link Disposable} that unregisters this factory when being disposed. - */ - export function registerDebugAdapterDescriptorFactory( - debugType: string, - factory: DebugAdapterDescriptorFactory, - ): Disposable; - - /** - * Register a debug adapter tracker factory for the given debug type. - * - * @param debugType The debug type for which the factory is registered or '*' for matching all debug types. - * @param factory The {@link DebugAdapterTrackerFactory debug adapter tracker factory} to register. - * @returns A {@link Disposable} that unregisters this factory when being disposed. - */ - export function registerDebugAdapterTrackerFactory( - debugType: string, - factory: DebugAdapterTrackerFactory, - ): Disposable; - - /** - * Start debugging by using either a named launch or named compound configuration, - * or by directly passing a {@link DebugConfiguration}. - * The named configurations are looked up in '.vscode/launch.json' found in the given folder. - * Before debugging starts, all unsaved files are saved and the launch configurations are brought up-to-date. - * Folder specific variables used in the configuration (e.g. '${workspaceFolder}') are resolved against the given folder. - * @param folder The {@link WorkspaceFolder workspace folder} for looking up named configurations and resolving variables or `undefined` for a non-folder setup. - * @param nameOrConfiguration Either the name of a debug or compound configuration or a {@link DebugConfiguration} object. - * @param parentSessionOrOptions Debug session options. When passed a parent {@link DebugSession debug session}, assumes options with just this parent session. - * @returns A thenable that resolves when debugging could be successfully started. - */ - export function startDebugging( - folder: WorkspaceFolder | undefined, - nameOrConfiguration: string | DebugConfiguration, - parentSessionOrOptions?: DebugSession | DebugSessionOptions, - ): Thenable; - - /** - * Stop the given debug session or stop all debug sessions if session is omitted. - * - * @param session The {@link DebugSession debug session} to stop; if omitted all sessions are stopped. - * @returns A thenable that resolves when the session(s) have been stopped. - */ - export function stopDebugging(session?: DebugSession): Thenable; - - /** - * Add breakpoints. - * @param breakpoints The breakpoints to add. - */ - export function addBreakpoints( - breakpoints: readonly Breakpoint[], - ): void; - - /** - * Remove breakpoints. - * @param breakpoints The breakpoints to remove. - */ - export function removeBreakpoints( - breakpoints: readonly Breakpoint[], - ): void; - - /** - * Converts a "Source" descriptor object received via the Debug Adapter Protocol into a Uri that can be used to load its contents. - * If the source descriptor is based on a path, a file Uri is returned. - * If the source descriptor uses a reference number, a specific debug Uri (scheme 'debug') is constructed that requires a corresponding ContentProvider and a running debug session - * - * If the "Source" descriptor has insufficient information for creating the Uri, an error is thrown. - * - * @param source An object conforming to the [Source](https://microsoft.github.io/debug-adapter-protocol/specification#Types_Source) type defined in the Debug Adapter Protocol. - * @param session An optional debug session that will be used when the source descriptor uses a reference number to load the contents from an active debug session. - * @returns A uri that can be used to load the contents of the source. - */ - export function asDebugSourceUri( - source: DebugProtocolSource, - session?: DebugSession, - ): Uri; - } - - /** - * Namespace for dealing with installed extensions. Extensions are represented - * by an {@link Extension}-interface which enables reflection on them. - * - * Extension writers can provide APIs to other extensions by returning their API public - * surface from the `activate`-call. - * - * ```javascript - * export function activate(context: vscode.ExtensionContext) { - * let api = { - * sum(a, b) { - * return a + b; - * }, - * mul(a, b) { - * return a * b; - * } - * }; - * // 'export' public api-surface - * return api; - * } - * ``` - * When depending on the API of another extension add an `extensionDependencies`-entry - * to `package.json`, and use the {@link extensions.getExtension getExtension}-function - * and the {@link Extension.exports exports}-property, like below: - * - * ```javascript - * let mathExt = extensions.getExtension('genius.math'); - * let importedApi = mathExt.exports; - * - * console.log(importedApi.mul(42, 1)); - * ``` - */ - export namespace extensions { - /** - * Get an extension by its full identifier in the form of: `publisher.name`. - * - * @param extensionId An extension identifier. - * @returns An extension or `undefined`. - */ - export function getExtension( - extensionId: string, - ): Extension | undefined; - - /** - * All extensions currently known to the system. - */ - export const all: readonly Extension[]; - - /** - * An event which fires when `extensions.all` changes. This can happen when extensions are - * installed, uninstalled, enabled or disabled. - */ - export const onDidChange: Event; - } - - /** - * Collapsible state of a {@link CommentThread comment thread} - */ - export enum CommentThreadCollapsibleState { - /** - * Determines an item is collapsed - */ - Collapsed = 0, - - /** - * Determines an item is expanded - */ - Expanded = 1, - } - - /** - * Comment mode of a {@link Comment} - */ - export enum CommentMode { - /** - * Displays the comment editor - */ - Editing = 0, - - /** - * Displays the preview of the comment - */ - Preview = 1, - } - - /** - * The state of a comment thread. - */ - export enum CommentThreadState { - /** - * Unresolved thread state - */ - Unresolved = 0, - /** - * Resolved thread state - */ - Resolved = 1, - } - - /** - * A collection of {@link Comment comments} representing a conversation at a particular range in a document. - */ - export interface CommentThread { - /** - * The uri of the document the thread has been created on. - */ - readonly uri: Uri; - - /** - * The range the comment thread is located within the document. The thread icon will be shown - * at the last line of the range. - */ - range: Range; - - /** - * The ordered comments of the thread. - */ - comments: readonly Comment[]; - - /** - * Whether the thread should be collapsed or expanded when opening the document. - * Defaults to Collapsed. - */ - collapsibleState: CommentThreadCollapsibleState; - - /** - * Whether the thread supports reply. - * Defaults to true. - */ - canReply: boolean; - - /** - * Context value of the comment thread. This can be used to contribute thread specific actions. - * For example, a comment thread is given a context value as `editable`. When contributing actions to `comments/commentThread/title` - * using `menus` extension point, you can specify context value for key `commentThread` in `when` expression like `commentThread == editable`. - * ```json - * "contributes": { - * "menus": { - * "comments/commentThread/title": [ - * { - * "command": "extension.deleteCommentThread", - * "when": "commentThread == editable" - * } - * ] - * } - * } - * ``` - * This will show action `extension.deleteCommentThread` only for comment threads with `contextValue` is `editable`. - */ - contextValue?: string; - - /** - * The optional human-readable label describing the {@link CommentThread Comment Thread} - */ - label?: string; - - /** - * The optional state of a comment thread, which may affect how the comment is displayed. - */ - state?: CommentThreadState; - - /** - * Dispose this comment thread. - * - * Once disposed, this comment thread will be removed from visible editors and Comment Panel when appropriate. - */ - dispose(): void; - } - - /** - * Author information of a {@link Comment} - */ - export interface CommentAuthorInformation { - /** - * The display name of the author of the comment - */ - name: string; - - /** - * The optional icon path for the author - */ - iconPath?: Uri; - } - - /** - * Reactions of a {@link Comment} - */ - export interface CommentReaction { - /** - * The human-readable label for the reaction - */ - readonly label: string; - - /** - * Icon for the reaction shown in UI. - */ - readonly iconPath: string | Uri; - - /** - * The number of users who have reacted to this reaction - */ - readonly count: number; - - /** - * Whether the {@link CommentAuthorInformation author} of the comment has reacted to this reaction - */ - readonly authorHasReacted: boolean; - } - - /** - * A comment is displayed within the editor or the Comments Panel, depending on how it is provided. - */ - export interface Comment { - /** - * The human-readable comment body - */ - body: string | MarkdownString; - - /** - * {@link CommentMode Comment mode} of the comment - */ - mode: CommentMode; - - /** - * The {@link CommentAuthorInformation author information} of the comment - */ - author: CommentAuthorInformation; - - /** - * Context value of the comment. This can be used to contribute comment specific actions. - * For example, a comment is given a context value as `editable`. When contributing actions to `comments/comment/title` - * using `menus` extension point, you can specify context value for key `comment` in `when` expression like `comment == editable`. - * ```json - * "contributes": { - * "menus": { - * "comments/comment/title": [ - * { - * "command": "extension.deleteComment", - * "when": "comment == editable" - * } - * ] - * } - * } - * ``` - * This will show action `extension.deleteComment` only for comments with `contextValue` is `editable`. - */ - contextValue?: string; - - /** - * Optional reactions of the {@link Comment} - */ - reactions?: CommentReaction[]; - - /** - * Optional label describing the {@link Comment} - * Label will be rendered next to authorName if exists. - */ - label?: string; - - /** - * Optional timestamp that will be displayed in comments. - * The date will be formatted according to the user's locale and settings. - */ - timestamp?: Date; - } - - /** - * Command argument for actions registered in `comments/commentThread/context`. - */ - export interface CommentReply { - /** - * The active {@link CommentThread comment thread} - */ - thread: CommentThread; - - /** - * The value in the comment editor - */ - text: string; - } - - /** - * Commenting range provider for a {@link CommentController comment controller}. - */ - export interface CommentingRangeProvider { - /** - * Provide a list of ranges which allow new comment threads creation or null for a given document - */ - provideCommentingRanges( - document: TextDocument, - token: CancellationToken, - ): ProviderResult; - } - - /** - * Represents a {@link CommentController comment controller}'s {@link CommentController.options options}. - */ - export interface CommentOptions { - /** - * An optional string to show on the comment input box when it's collapsed. - */ - prompt?: string; - - /** - * An optional string to show as placeholder in the comment input box when it's focused. - */ - placeHolder?: string; - } - - /** - * A comment controller is able to provide {@link CommentThread comments} support to the editor and - * provide users various ways to interact with comments. - */ - export interface CommentController { - /** - * The id of this comment controller. - */ - readonly id: string; - - /** - * The human-readable label of this comment controller. - */ - readonly label: string; - - /** - * Comment controller options - */ - options?: CommentOptions; - - /** - * Optional commenting range provider. Provide a list {@link Range ranges} which support commenting to any given resource uri. - * - * If not provided, users cannot leave any comments. - */ - commentingRangeProvider?: CommentingRangeProvider; - - /** - * Create a {@link CommentThread comment thread}. The comment thread will be displayed in visible text editors (if the resource matches) - * and Comments Panel once created. - * - * @param uri The uri of the document the thread has been created on. - * @param range The range the comment thread is located within the document. - * @param comments The ordered comments of the thread. - */ - createCommentThread( - uri: Uri, - range: Range, - comments: readonly Comment[], - ): CommentThread; - - /** - * Optional reaction handler for creating and deleting reactions on a {@link Comment}. - */ - reactionHandler?: ( - comment: Comment, - reaction: CommentReaction, - ) => Thenable; - - /** - * Dispose this comment controller. - * - * Once disposed, all {@link CommentThread comment threads} created by this comment controller will also be removed from the editor - * and Comments Panel. - */ - dispose(): void; - } - - namespace comments { - /** - * Creates a new {@link CommentController comment controller} instance. - * - * @param id An `id` for the comment controller. - * @param label A human-readable string for the comment controller. - * @returns An instance of {@link CommentController comment controller}. - */ - export function createCommentController( - id: string, - label: string, - ): CommentController; - } - - /** - * Represents a session of a currently logged in user. - */ - export interface AuthenticationSession { - /** - * The identifier of the authentication session. - */ - readonly id: string; - - /** - * The access token. - */ - readonly accessToken: string; - - /** - * The account associated with the session. - */ - readonly account: AuthenticationSessionAccountInformation; - - /** - * The permissions granted by the session's access token. Available scopes - * are defined by the {@link AuthenticationProvider}. - */ - readonly scopes: readonly string[]; - } - - /** - * The information of an account associated with an {@link AuthenticationSession}. - */ - export interface AuthenticationSessionAccountInformation { - /** - * The unique identifier of the account. - */ - readonly id: string; - - /** - * The human-readable name of the account. - */ - readonly label: string; - } - - /** - * Optional options to be used when calling {@link authentication.getSession} with the flag `forceNewSession`. - */ - export interface AuthenticationForceNewSessionOptions { - /** - * An optional message that will be displayed to the user when we ask to re-authenticate. Providing additional context - * as to why you are asking a user to re-authenticate can help increase the odds that they will accept. - */ - detail?: string; - } - - /** - * Options to be used when getting an {@link AuthenticationSession} from an {@link AuthenticationProvider}. - */ - export interface AuthenticationGetSessionOptions { - /** - * Whether the existing session preference should be cleared. - * - * For authentication providers that support being signed into multiple accounts at once, the user will be - * prompted to select an account to use when {@link authentication.getSession getSession} is called. This preference - * is remembered until {@link authentication.getSession getSession} is called with this flag. - * - * Note: - * The preference is extension specific. So if one extension calls {@link authentication.getSession getSession}, it will not - * affect the session preference for another extension calling {@link authentication.getSession getSession}. Additionally, - * the preference is set for the current workspace and also globally. This means that new workspaces will use the "global" - * value at first and then when this flag is provided, a new value can be set for that workspace. This also means - * that pre-existing workspaces will not lose their preference if a new workspace sets this flag. - * - * Defaults to false. - */ - clearSessionPreference?: boolean; - - /** - * Whether login should be performed if there is no matching session. - * - * If true, a modal dialog will be shown asking the user to sign in. If false, a numbered badge will be shown - * on the accounts activity bar icon. An entry for the extension will be added under the menu to sign in. This - * allows quietly prompting the user to sign in. - * - * If there is a matching session but the extension has not been granted access to it, setting this to true - * will also result in an immediate modal dialog, and false will add a numbered badge to the accounts icon. - * - * Defaults to false. - * - * Note: you cannot use this option with {@link AuthenticationGetSessionOptions.silent silent}. - */ - createIfNone?: boolean; - - /** - * Whether we should attempt to reauthenticate even if there is already a session available. - * - * If true, a modal dialog will be shown asking the user to sign in again. This is mostly used for scenarios - * where the token needs to be re minted because it has lost some authorization. - * - * If there are no existing sessions and forceNewSession is true, it will behave identically to - * {@link AuthenticationGetSessionOptions.createIfNone createIfNone}. - * - * This defaults to false. - */ - forceNewSession?: boolean | AuthenticationForceNewSessionOptions; - - /** - * Whether we should show the indication to sign in in the Accounts menu. - * - * If false, the user will be shown a badge on the Accounts menu with an option to sign in for the extension. - * If true, no indication will be shown. - * - * Defaults to false. - * - * Note: you cannot use this option with any other options that prompt the user like {@link AuthenticationGetSessionOptions.createIfNone createIfNone}. - */ - silent?: boolean; - - /** - * The account that you would like to get a session for. This is passed down to the Authentication Provider to be used for creating the correct session. - */ - account?: AuthenticationSessionAccountInformation; - } - - /** - * Basic information about an {@link AuthenticationProvider} - */ - export interface AuthenticationProviderInformation { - /** - * The unique identifier of the authentication provider. - */ - readonly id: string; - - /** - * The human-readable name of the authentication provider. - */ - readonly label: string; - } - - /** - * An {@link Event} which fires when an {@link AuthenticationSession} is added, removed, or changed. - */ - export interface AuthenticationSessionsChangeEvent { - /** - * The {@link AuthenticationProvider} that has had its sessions change. - */ - readonly provider: AuthenticationProviderInformation; - } - - /** - * Options for creating an {@link AuthenticationProvider}. - */ - export interface AuthenticationProviderOptions { - /** - * Whether it is possible to be signed into multiple accounts at once with this provider. - * If not specified, will default to false. - */ - readonly supportsMultipleAccounts?: boolean; - } - - /** - * An {@link Event} which fires when an {@link AuthenticationSession} is added, removed, or changed. - */ - export interface AuthenticationProviderAuthenticationSessionsChangeEvent { - /** - * The {@link AuthenticationSession AuthenticationSessions} of the {@link AuthenticationProvider} that have been added. - */ - readonly added: readonly AuthenticationSession[] | undefined; - - /** - * The {@link AuthenticationSession AuthenticationSessions} of the {@link AuthenticationProvider} that have been removed. - */ - readonly removed: readonly AuthenticationSession[] | undefined; - - /** - * The {@link AuthenticationSession AuthenticationSessions} of the {@link AuthenticationProvider} that have been changed. - * A session changes when its data excluding the id are updated. An example of this is a session refresh that results in a new - * access token being set for the session. - */ - readonly changed: readonly AuthenticationSession[] | undefined; - } - - /** - * The options passed in to the {@link AuthenticationProvider.getSessions} and - * {@link AuthenticationProvider.createSession} call. - */ - export interface AuthenticationProviderSessionOptions { - /** - * The account that is being asked about. If this is passed in, the provider should - * attempt to return the sessions that are only related to this account. - */ - account?: AuthenticationSessionAccountInformation; - } - - /** - * A provider for performing authentication to a service. - */ - export interface AuthenticationProvider { - /** - * An {@link Event} which fires when the array of sessions has changed, or data - * within a session has changed. - */ - readonly onDidChangeSessions: Event; - - /** - * Get a list of sessions. - * @param scopes An optional list of scopes. If provided, the sessions returned should match - * these permissions, otherwise all sessions should be returned. - * @param options Additional options for getting sessions. - * @returns A promise that resolves to an array of authentication sessions. - */ - getSessions( - scopes: readonly string[] | undefined, - options: AuthenticationProviderSessionOptions, - ): Thenable; - - /** - * Prompts a user to login. - * - * If login is successful, the onDidChangeSessions event should be fired. - * - * If login fails, a rejected promise should be returned. - * - * If the provider has specified that it does not support multiple accounts, - * then this should never be called if there is already an existing session matching these - * scopes. - * @param scopes A list of scopes, permissions, that the new session should be created with. - * @param options Additional options for creating a session. - * @returns A promise that resolves to an authentication session. - */ - createSession( - scopes: readonly string[], - options: AuthenticationProviderSessionOptions, - ): Thenable; - - /** - * Removes the session corresponding to session id. - * - * If the removal is successful, the onDidChangeSessions event should be fired. - * - * If a session cannot be removed, the provider should reject with an error message. - * @param sessionId The id of the session to remove. - */ - removeSession(sessionId: string): Thenable; - } - - /** - * Namespace for authentication. - */ - export namespace authentication { - /** - * Get an authentication session matching the desired scopes. Rejects if a provider with providerId is not - * registered, or if the user does not consent to sharing authentication information with - * the extension. If there are multiple sessions with the same scopes, the user will be shown a - * quickpick to select which account they would like to use. - * - * Currently, there are only two authentication providers that are contributed from built in extensions - * to the editor that implement GitHub and Microsoft authentication: their providerId's are 'github' and 'microsoft'. - * @param providerId The id of the provider to use - * @param scopes A list of scopes representing the permissions requested. These are dependent on the authentication provider - * @param options The {@link AuthenticationGetSessionOptions} to use - * @returns A thenable that resolves to an authentication session - */ - export function getSession( - providerId: string, - scopes: readonly string[], - options: AuthenticationGetSessionOptions & { - /** */ createIfNone: true; - }, - ): Thenable; - - /** - * Get an authentication session matching the desired scopes. Rejects if a provider with providerId is not - * registered, or if the user does not consent to sharing authentication information with - * the extension. If there are multiple sessions with the same scopes, the user will be shown a - * quickpick to select which account they would like to use. - * - * Currently, there are only two authentication providers that are contributed from built in extensions - * to the editor that implement GitHub and Microsoft authentication: their providerId's are 'github' and 'microsoft'. - * @param providerId The id of the provider to use - * @param scopes A list of scopes representing the permissions requested. These are dependent on the authentication provider - * @param options The {@link AuthenticationGetSessionOptions} to use - * @returns A thenable that resolves to an authentication session - */ - export function getSession( - providerId: string, - scopes: readonly string[], - options: AuthenticationGetSessionOptions & { - /** literal-type defines return type */ forceNewSession: - | true - | AuthenticationForceNewSessionOptions; - }, - ): Thenable; - - /** - * Get an authentication session matching the desired scopes. Rejects if a provider with providerId is not - * registered, or if the user does not consent to sharing authentication information with - * the extension. If there are multiple sessions with the same scopes, the user will be shown a - * quickpick to select which account they would like to use. - * - * Currently, there are only two authentication providers that are contributed from built in extensions - * to the editor that implement GitHub and Microsoft authentication: their providerId's are 'github' and 'microsoft'. - * @param providerId The id of the provider to use - * @param scopes A list of scopes representing the permissions requested. These are dependent on the authentication provider - * @param options The {@link AuthenticationGetSessionOptions} to use - * @returns A thenable that resolves to an authentication session if available, or undefined if there are no sessions - */ - export function getSession( - providerId: string, - scopes: readonly string[], - options?: AuthenticationGetSessionOptions, - ): Thenable; - - /** - * Get all accounts that the user is logged in to for the specified provider. - * Use this paired with {@link getSession} in order to get an authentication session for a specific account. - * - * Currently, there are only two authentication providers that are contributed from built in extensions - * to the editor that implement GitHub and Microsoft authentication: their providerId's are 'github' and 'microsoft'. - * - * Note: Getting accounts does not imply that your extension has access to that account or its authentication sessions. You can verify access to the account by calling {@link getSession}. - * - * @param providerId The id of the provider to use - * @returns A thenable that resolves to a readonly array of authentication accounts. - */ - export function getAccounts( - providerId: string, - ): Thenable; - - /** - * An {@link Event} which fires when the authentication sessions of an authentication provider have - * been added, removed, or changed. - */ - export const onDidChangeSessions: Event; - - /** - * Register an authentication provider. - * - * There can only be one provider per id and an error is being thrown when an id - * has already been used by another provider. Ids are case-sensitive. - * - * @param id The unique identifier of the provider. - * @param label The human-readable name of the provider. - * @param provider The authentication provider provider. - * @param options Additional options for the provider. - * @returns A {@link Disposable} that unregisters this provider when being disposed. - */ - export function registerAuthenticationProvider( - id: string, - label: string, - provider: AuthenticationProvider, - options?: AuthenticationProviderOptions, - ): Disposable; - } - - /** - * Namespace for localization-related functionality in the extension API. To use this properly, - * you must have `l10n` defined in your extension manifest and have bundle.l10n..json files. - * For more information on how to generate bundle.l10n..json files, check out the - * [vscode-l10n repo](https://github.com/microsoft/vscode-l10n). - * - * Note: Built-in extensions (for example, Git, TypeScript Language Features, GitHub Authentication) - * are excluded from the `l10n` property requirement. In other words, they do not need to specify - * a `l10n` in the extension manifest because their translated strings come from Language Packs. - */ - export namespace l10n { - /** - * Marks a string for localization. If a localized bundle is available for the language specified by - * {@link env.language} and the bundle has a localized value for this message, then that localized - * value will be returned (with injected {@link args} values for any templated values). - * - * @param message - The message to localize. Supports index templating where strings like `{0}` and `{1}` are - * replaced by the item at that index in the {@link args} array. - * @param args - The arguments to be used in the localized string. The index of the argument is used to - * match the template placeholder in the localized string. - * @returns localized string with injected arguments. - * - * @example - * l10n.t('Hello {0}!', 'World'); - */ - export function t( - message: string, - ...args: Array - ): string; - - /** - * Marks a string for localization. If a localized bundle is available for the language specified by - * {@link env.language} and the bundle has a localized value for this message, then that localized - * value will be returned (with injected {@link args} values for any templated values). - * - * @param message The message to localize. Supports named templating where strings like `{foo}` and `{bar}` are - * replaced by the value in the Record for that key (foo, bar, etc). - * @param args The arguments to be used in the localized string. The name of the key in the record is used to - * match the template placeholder in the localized string. - * @returns localized string with injected arguments. - * - * @example - * l10n.t('Hello {name}', { name: 'Erich' }); - */ - export function t(message: string, args: Record): string; - /** - * Marks a string for localization. If a localized bundle is available for the language specified by - * {@link env.language} and the bundle has a localized value for this message, then that localized - * value will be returned (with injected args values for any templated values). - * - * @param options The options to use when localizing the message. - * @returns localized string with injected arguments. - */ - export function t(options: { - /** - * The message to localize. If {@link options.args args} is an array, this message supports index templating where strings like - * `{0}` and `{1}` are replaced by the item at that index in the {@link options.args args} array. If `args` is a `Record`, - * this supports named templating where strings like `{foo}` and `{bar}` are replaced by the value in - * the Record for that key (foo, bar, etc). - */ - message: string; - /** - * The arguments to be used in the localized string. As an array, the index of the argument is used to - * match the template placeholder in the localized string. As a Record, the key is used to match the template - * placeholder in the localized string. - */ - args?: Array | Record; - /** - * A comment to help translators understand the context of the message. - */ - comment: string | string[]; - }): string; - /** - * The bundle of localized strings that have been loaded for the extension. - * It's undefined if no bundle has been loaded. The bundle is typically not loaded if - * there was no bundle found or when we are running with the default language. - */ - export const bundle: { [key: string]: string } | undefined; - /** - * The URI of the localization bundle that has been loaded for the extension. - * It's undefined if no bundle has been loaded. The bundle is typically not loaded if - * there was no bundle found or when we are running with the default language. - */ - export const uri: Uri | undefined; - } - - /** - * Namespace for testing functionality. Tests are published by registering - * {@link TestController} instances, then adding {@link TestItem TestItems}. - * Controllers may also describe how to run tests by creating one or more - * {@link TestRunProfile} instances. - */ - export namespace tests { - /** - * Creates a new test controller. - * - * @param id Identifier for the controller, must be globally unique. - * @param label A human-readable label for the controller. - * @returns An instance of the {@link TestController}. - */ - export function createTestController( - id: string, - label: string, - ): TestController; - } - - /** - * The kind of executions that {@link TestRunProfile TestRunProfiles} control. - */ - export enum TestRunProfileKind { - /** - * The `Run` test profile kind. - */ - Run = 1, - /** - * The `Debug` test profile kind. - */ - Debug = 2, - /** - * The `Coverage` test profile kind. - */ - Coverage = 3, - } - - /** - * Tags can be associated with {@link TestItem TestItems} and - * {@link TestRunProfile TestRunProfiles}. A profile with a tag can only - * execute tests that include that tag in their {@link TestItem.tags} array. - */ - export class TestTag { - /** - * ID of the test tag. `TestTag` instances with the same ID are considered - * to be identical. - */ - readonly id: string; - - /** - * Creates a new TestTag instance. - * @param id ID of the test tag. - */ - constructor(id: string); - } - - /** - * A TestRunProfile describes one way to execute tests in a {@link TestController}. - */ - export interface TestRunProfile { - /** - * Label shown to the user in the UI. - * - * Note that the label has some significance if the user requests that - * tests be re-run in a certain way. For example, if tests were run - * normally and the user requests to re-run them in debug mode, the editor - * will attempt use a configuration with the same label of the `Debug` - * kind. If there is no such configuration, the default will be used. - */ - label: string; - - /** - * Configures what kind of execution this profile controls. If there - * are no profiles for a kind, it will not be available in the UI. - */ - readonly kind: TestRunProfileKind; - - /** - * Controls whether this profile is the default action that will - * be taken when its kind is actioned. For example, if the user clicks - * the generic "run all" button, then the default profile for - * {@link TestRunProfileKind.Run} will be executed, although the - * user can configure this. - * - * Changes the user makes in their default profiles will be reflected - * in this property after a {@link onDidChangeDefault} event. - */ - isDefault: boolean; - - /** - * Fired when a user has changed whether this is a default profile. The - * event contains the new value of {@link isDefault} - */ - onDidChangeDefault: Event; - - /** - * Whether this profile supports continuous running of requests. If so, - * then {@link TestRunRequest.continuous} may be set to `true`. Defaults - * to false. - */ - supportsContinuousRun: boolean; - - /** - * Associated tag for the profile. If this is set, only {@link TestItem} - * instances with the same tag will be eligible to execute in this profile. - */ - tag: TestTag | undefined; - - /** - * If this method is present, a configuration gear will be present in the - * UI, and this method will be invoked when it's clicked. When called, - * you can take other editor actions, such as showing a quick pick or - * opening a configuration file. - */ - configureHandler: (() => void) | undefined; - - /** - * Handler called to start a test run. When invoked, the function should call - * {@link TestController.createTestRun} at least once, and all test runs - * associated with the request should be created before the function returns - * or the returned promise is resolved. - * - * If {@link supportsContinuousRun} is set, then {@link TestRunRequest.continuous} - * may be `true`. In this case, the profile should observe changes to - * source code and create new test runs by calling {@link TestController.createTestRun}, - * until the cancellation is requested on the `token`. - * - * @param request Request information for the test run. - * @param cancellationToken Token that signals the used asked to abort the - * test run. If cancellation is requested on this token, all {@link TestRun} - * instances associated with the request will be - * automatically cancelled as well. - */ - runHandler: ( - request: TestRunRequest, - token: CancellationToken, - ) => Thenable | void; - - /** - * An extension-provided function that provides detailed statement and - * function-level coverage for a file. The editor will call this when more - * detail is needed for a file, such as when it's opened in an editor or - * expanded in the **Test Coverage** view. - * - * The {@link FileCoverage} object passed to this function is the same instance - * emitted on {@link TestRun.addCoverage} calls associated with this profile. - */ - loadDetailedCoverage?: ( - testRun: TestRun, - fileCoverage: FileCoverage, - token: CancellationToken, - ) => Thenable; - - /** - * Deletes the run profile. - */ - dispose(): void; - } - - /** - * Entry point to discover and execute tests. It contains {@link TestController.items} which - * are used to populate the editor UI, and is associated with - * {@link TestController.createRunProfile run profiles} to allow - * for tests to be executed. - */ - export interface TestController { - /** - * The id of the controller passed in {@link tests.createTestController}. - * This must be globally unique. - */ - readonly id: string; - - /** - * Human-readable label for the test controller. - */ - label: string; - - /** - * A collection of "top-level" {@link TestItem} instances, which can in - * turn have their own {@link TestItem.children children} to form the - * "test tree." - * - * The extension controls when to add tests. For example, extensions should - * add tests for a file when {@link workspace.onDidOpenTextDocument} - * fires in order for decorations for tests within a file to be visible. - * - * However, the editor may sometimes explicitly request children using the - * {@link resolveHandler} See the documentation on that method for more details. - */ - readonly items: TestItemCollection; - - /** - * Creates a profile used for running tests. Extensions must create - * at least one profile in order for tests to be run. - * @param label A human-readable label for this profile. - * @param kind Configures what kind of execution this profile manages. - * @param runHandler Function called to start a test run. - * @param isDefault Whether this is the default action for its kind. - * @param tag Profile test tag. - * @param supportsContinuousRun Whether the profile supports continuous running. - * @returns An instance of a {@link TestRunProfile}, which is automatically - * associated with this controller. - */ - createRunProfile( - label: string, - kind: TestRunProfileKind, - runHandler: ( - request: TestRunRequest, - token: CancellationToken, - ) => Thenable | void, - isDefault?: boolean, - tag?: TestTag, - supportsContinuousRun?: boolean, - ): TestRunProfile; - - /** - * A function provided by the extension that the editor may call to request - * children of a test item, if the {@link TestItem.canResolveChildren} is - * `true`. When called, the item should discover children and call - * {@link TestController.createTestItem} as children are discovered. - * - * Generally the extension manages the lifecycle of test items, but under - * certain conditions the editor may request the children of a specific - * item to be loaded. For example, if the user requests to re-run tests - * after reloading the editor, the editor may need to call this method - * to resolve the previously-run tests. - * - * The item in the explorer will automatically be marked as "busy" until - * the function returns or the returned thenable resolves. - * - * @param item An unresolved test item for which children are being - * requested, or `undefined` to resolve the controller's initial {@link TestController.items items}. - */ - resolveHandler?: (item: TestItem | undefined) => Thenable | void; - - /** - * If this method is present, a refresh button will be present in the - * UI, and this method will be invoked when it's clicked. When called, - * the extension should scan the workspace for any new, changed, or - * removed tests. - * - * It's recommended that extensions try to update tests in realtime, using - * a {@link FileSystemWatcher} for example, and use this method as a fallback. - * - * @returns A thenable that resolves when tests have been refreshed. - */ - refreshHandler: - | ((token: CancellationToken) => Thenable | void) - | undefined; - - /** - * Creates a {@link TestRun}. This should be called by the - * {@link TestRunProfile} when a request is made to execute tests, and may - * also be called if a test run is detected externally. Once created, tests - * that are included in the request will be moved into the queued state. - * - * All runs created using the same `request` instance will be grouped - * together. This is useful if, for example, a single suite of tests is - * run on multiple platforms. - * - * @param request Test run request. Only tests inside the `include` may be - * modified, and tests in its `exclude` are ignored. - * @param name The human-readable name of the run. This can be used to - * disambiguate multiple sets of results in a test run. It is useful if - * tests are run across multiple platforms, for example. - * @param persist Whether the results created by the run should be - * persisted in the editor. This may be false if the results are coming from - * a file already saved externally, such as a coverage information file. - * @returns An instance of the {@link TestRun}. It will be considered "running" - * from the moment this method is invoked until {@link TestRun.end} is called. - */ - createTestRun( - request: TestRunRequest, - name?: string, - persist?: boolean, - ): TestRun; - - /** - * Creates a new managed {@link TestItem} instance. It can be added into - * the {@link TestItem.children} of an existing item, or into the - * {@link TestController.items}. - * - * @param id Identifier for the TestItem. The test item's ID must be unique - * in the {@link TestItemCollection} it's added to. - * @param label Human-readable label of the test item. - * @param uri URI this TestItem is associated with. May be a file or directory. - */ - createTestItem(id: string, label: string, uri?: Uri): TestItem; - - /** - * Marks an item's results as being outdated. This is commonly called when - * code or configuration changes and previous results should no longer - * be considered relevant. The same logic used to mark results as outdated - * may be used to drive {@link TestRunRequest.continuous continuous test runs}. - * - * If an item is passed to this method, test results for the item and all of - * its children will be marked as outdated. If no item is passed, then all - * test owned by the TestController will be marked as outdated. - * - * Any test runs started before the moment this method is called, including - * runs which may still be ongoing, will be marked as outdated and deprioritized - * in the editor's UI. - * - * @param items Item to mark as outdated. If undefined, all the controller's items are marked outdated. - */ - invalidateTestResults(items?: TestItem | readonly TestItem[]): void; - - /** - * Unregisters the test controller, disposing of its associated tests - * and unpersisted results. - */ - dispose(): void; - } - - /** - * A TestRunRequest is a precursor to a {@link TestRun}, which in turn is - * created by passing a request to {@link TestController.createTestRun}. The - * TestRunRequest contains information about which tests should be run, which - * should not be run, and how they are run (via the {@link TestRunRequest.profile profile}). - * - * In general, TestRunRequests are created by the editor and pass to - * {@link TestRunProfile.runHandler}, however you can also create test - * requests and runs outside of the `runHandler`. - */ - export class TestRunRequest { - /** - * A filter for specific tests to run. If given, the extension should run - * all of the included tests and all their children, excluding any tests - * that appear in {@link TestRunRequest.exclude}. If this property is - * undefined, then the extension should simply run all tests. - * - * The process of running tests should resolve the children of any test - * items who have not yet been resolved. - */ - readonly include: readonly TestItem[] | undefined; - - /** - * An array of tests the user has marked as excluded from the test included - * in this run; exclusions should apply after inclusions. - * - * May be omitted if no exclusions were requested. Test controllers should - * not run excluded tests or any children of excluded tests. - */ - readonly exclude: readonly TestItem[] | undefined; - - /** - * The profile used for this request. This will always be defined - * for requests issued from the editor UI, though extensions may - * programmatically create requests not associated with any profile. - */ - readonly profile: TestRunProfile | undefined; - - /** - * Whether the profile should run continuously as source code changes. Only - * relevant for profiles that set {@link TestRunProfile.supportsContinuousRun}. - */ - readonly continuous?: boolean; - - /** - * Controls how test Test Results view is focused. If true, the editor - * will keep the maintain the user's focus. If false, the editor will - * prefer to move focus into the Test Results view, although - * this may be configured by users. - */ - readonly preserveFocus: boolean; - - /** - * @param include Array of specific tests to run, or undefined to run all tests - * @param exclude An array of tests to exclude from the run. - * @param profile The run profile used for this request. - * @param continuous Whether to run tests continuously as source changes. - * @param preserveFocus Whether to preserve the user's focus when the run is started - */ - constructor( - include?: readonly TestItem[], - exclude?: readonly TestItem[], - profile?: TestRunProfile, - continuous?: boolean, - preserveFocus?: boolean, - ); - } - - /** - * A TestRun represents an in-progress or completed test run and - * provides methods to report the state of individual tests in the run. - */ - export interface TestRun { - /** - * The human-readable name of the run. This can be used to - * disambiguate multiple sets of results in a test run. It is useful if - * tests are run across multiple platforms, for example. - */ - readonly name: string | undefined; - - /** - * A cancellation token which will be triggered when the test run is - * canceled from the UI. - */ - readonly token: CancellationToken; - - /** - * Whether the test run will be persisted across reloads by the editor. - */ - readonly isPersisted: boolean; - - /** - * Indicates a test is queued for later execution. - * @param test Test item to update. - */ - enqueued(test: TestItem): void; - - /** - * Indicates a test has started running. - * @param test Test item to update. - */ - started(test: TestItem): void; - - /** - * Indicates a test has been skipped. - * @param test Test item to update. - */ - skipped(test: TestItem): void; - - /** - * Indicates a test has failed. You should pass one or more - * {@link TestMessage TestMessages} to describe the failure. - * @param test Test item to update. - * @param message Messages associated with the test failure. - * @param duration How long the test took to execute, in milliseconds. - */ - failed( - test: TestItem, - message: TestMessage | readonly TestMessage[], - duration?: number, - ): void; - - /** - * Indicates a test has errored. You should pass one or more - * {@link TestMessage TestMessages} to describe the failure. This differs - * from the "failed" state in that it indicates a test that couldn't be - * executed at all, from a compilation error for example. - * @param test Test item to update. - * @param message Messages associated with the test failure. - * @param duration How long the test took to execute, in milliseconds. - */ - errored( - test: TestItem, - message: TestMessage | readonly TestMessage[], - duration?: number, - ): void; - - /** - * Indicates a test has passed. - * @param test Test item to update. - * @param duration How long the test took to execute, in milliseconds. - */ - passed(test: TestItem, duration?: number): void; - - /** - * Appends raw output from the test runner. On the user's request, the - * output will be displayed in a terminal. ANSI escape sequences, - * such as colors and text styles, are supported. New lines must be given - * as CRLF (`\r\n`) rather than LF (`\n`). - * - * @param output Output text to append. - * @param location Indicate that the output was logged at the given - * location. - * @param test Test item to associate the output with. - */ - appendOutput( - output: string, - location?: Location, - test?: TestItem, - ): void; - - /** - * Adds coverage for a file in the run. - */ - addCoverage(fileCoverage: FileCoverage): void; - - /** - * Signals the end of the test run. Any tests included in the run whose - * states have not been updated will have their state reset. - */ - end(): void; - - /** - * An event fired when the editor is no longer interested in data - * associated with the test run. - */ - onDidDispose: Event; - } - - /** - * Collection of test items, found in {@link TestItem.children} and - * {@link TestController.items}. - */ - export interface TestItemCollection - extends Iterable<[id: string, testItem: TestItem]> { - /** - * Gets the number of items in the collection. - */ - readonly size: number; - - /** - * Replaces the items stored by the collection. - * @param items Items to store. - */ - replace(items: readonly TestItem[]): void; - - /** - * Iterate over each entry in this collection. - * - * @param callback Function to execute for each entry. - * @param thisArg The `this` context used when invoking the handler function. - */ - forEach( - callback: ( - item: TestItem, - collection: TestItemCollection, - ) => unknown, - thisArg?: any, - ): void; - - /** - * Adds the test item to the children. If an item with the same ID already - * exists, it'll be replaced. - * @param item Item to add. - */ - add(item: TestItem): void; - - /** - * Removes a single test item from the collection. - * @param itemId Item ID to delete. - */ - delete(itemId: string): void; - - /** - * Efficiently gets a test item by ID, if it exists, in the children. - * @param itemId Item ID to get. - * @returns The found item or undefined if it does not exist. - */ - get(itemId: string): TestItem | undefined; - } - - /** - * An item shown in the "test explorer" view. - * - * A `TestItem` can represent either a test suite or a test itself, since - * they both have similar capabilities. - */ - export interface TestItem { - /** - * Identifier for the `TestItem`. This is used to correlate - * test results and tests in the document with those in the workspace - * (test explorer). This cannot change for the lifetime of the `TestItem`, - * and must be unique among its parent's direct children. - */ - readonly id: string; - - /** - * URI this `TestItem` is associated with. May be a file or directory. - */ - readonly uri: Uri | undefined; - - /** - * The children of this test item. For a test suite, this may contain the - * individual test cases or nested suites. - */ - readonly children: TestItemCollection; - - /** - * The parent of this item. It's set automatically, and is undefined - * top-level items in the {@link TestController.items} and for items that - * aren't yet included in another item's {@link TestItem.children children}. - */ - readonly parent: TestItem | undefined; - - /** - * Tags associated with this test item. May be used in combination with - * {@link TestRunProfile.tag tags}, or simply as an organizational feature. - */ - tags: readonly TestTag[]; - - /** - * Indicates whether this test item may have children discovered by resolving. - * - * If true, this item is shown as expandable in the Test Explorer view and - * expanding the item will cause {@link TestController.resolveHandler} - * to be invoked with the item. - * - * Default to `false`. - */ - canResolveChildren: boolean; - - /** - * Controls whether the item is shown as "busy" in the Test Explorer view. - * This is useful for showing status while discovering children. - * - * Defaults to `false`. - */ - busy: boolean; - - /** - * Display name describing the test case. - */ - label: string; - - /** - * Optional description that appears next to the label. - */ - description?: string; - - /** - * A string that should be used when comparing this item - * with other items. When `falsy` the {@link TestItem.label label} - * is used. - */ - sortText?: string | undefined; - - /** - * Location of the test item in its {@link TestItem.uri uri}. - * - * This is only meaningful if the `uri` points to a file. - */ - range: Range | undefined; - - /** - * Optional error encountered while loading the test. - * - * Note that this is not a test result and should only be used to represent errors in - * test discovery, such as syntax errors. - */ - error: string | MarkdownString | undefined; - } - - /** - * A stack frame found in the {@link TestMessage.stackTrace}. - */ - export class TestMessageStackFrame { - /** - * The location of this stack frame. This should be provided as a URI if the - * location of the call frame can be accessed by the editor. - */ - uri?: Uri; - - /** - * Position of the stack frame within the file. - */ - position?: Position; - - /** - * The name of the stack frame, typically a method or function name. - */ - label: string; - - /** - * @param label The name of the stack frame - * @param file The file URI of the stack frame - * @param position The position of the stack frame within the file - */ - constructor(label: string, uri?: Uri, position?: Position); - } - - /** - * Message associated with the test state. Can be linked to a specific - * source range -- useful for assertion failures, for example. - */ - export class TestMessage { - /** - * Human-readable message text to display. - */ - message: string | MarkdownString; - - /** - * Expected test output. If given with {@link TestMessage.actualOutput actualOutput }, a diff view will be shown. - */ - expectedOutput?: string; - - /** - * Actual test output. If given with {@link TestMessage.expectedOutput expectedOutput }, a diff view will be shown. - */ - actualOutput?: string; - - /** - * Associated file location. - */ - location?: Location; - - /** - * Context value of the test item. This can be used to contribute message- - * specific actions to the test peek view. The value set here can be found - * in the `testMessage` property of the following `menus` contribution points: - * - * - `testing/message/context` - context menu for the message in the results tree - * - `testing/message/content` - a prominent button overlaying editor content where - * the message is displayed. - * - * For example: - * - * ```json - * "contributes": { - * "menus": { - * "testing/message/content": [ - * { - * "command": "extension.deleteCommentThread", - * "when": "testMessage == canApplyRichDiff" - * } - * ] - * } - * } - * ``` - * - * The command will be called with an object containing: - * - `test`: the {@link TestItem} the message is associated with, *if* it - * is still present in the {@link TestController.items} collection. - * - `message`: the {@link TestMessage} instance. - */ - contextValue?: string; - - /** - * The stack trace associated with the message or failure. - */ - stackTrace?: TestMessageStackFrame[]; - - /** - * Creates a new TestMessage that will present as a diff in the editor. - * @param message Message to display to the user. - * @param expected Expected output. - * @param actual Actual output. - */ - static diff( - message: string | MarkdownString, - expected: string, - actual: string, - ): TestMessage; - - /** - * Creates a new TestMessage instance. - * @param message The message to show to the user. - */ - constructor(message: string | MarkdownString); - } - - /** - * A class that contains information about a covered resource. A count can - * be give for lines, branches, and declarations in a file. - */ - export class TestCoverageCount { - /** - * Number of items covered in the file. - */ - covered: number; - /** - * Total number of covered items in the file. - */ - total: number; - - /** - * @param covered Value for {@link TestCoverageCount.covered} - * @param total Value for {@link TestCoverageCount.total} - */ - constructor(covered: number, total: number); - } - - /** - * Contains coverage metadata for a file. - */ - export class FileCoverage { - /** - * File URI. - */ - readonly uri: Uri; - - /** - * Statement coverage information. If the reporter does not provide statement - * coverage information, this can instead be used to represent line coverage. - */ - statementCoverage: TestCoverageCount; - - /** - * Branch coverage information. - */ - branchCoverage?: TestCoverageCount; - - /** - * Declaration coverage information. Depending on the reporter and - * language, this may be types such as functions, methods, or namespaces. - */ - declarationCoverage?: TestCoverageCount; - - /** - * Creates a {@link FileCoverage} instance with counts filled in from - * the coverage details. - * @param uri Covered file URI - * @param detailed Detailed coverage information - */ - static fromDetails( - uri: Uri, - details: readonly FileCoverageDetail[], - ): FileCoverage; - - /** - * @param uri Covered file URI - * @param statementCoverage Statement coverage information. If the reporter - * does not provide statement coverage information, this can instead be - * used to represent line coverage. - * @param branchCoverage Branch coverage information - * @param declarationCoverage Declaration coverage information - */ - constructor( - uri: Uri, - statementCoverage: TestCoverageCount, - branchCoverage?: TestCoverageCount, - declarationCoverage?: TestCoverageCount, - ); - } - - /** - * Contains coverage information for a single statement or line. - */ - export class StatementCoverage { - /** - * The number of times this statement was executed, or a boolean indicating - * whether it was executed if the exact count is unknown. If zero or false, - * the statement will be marked as un-covered. - */ - executed: number | boolean; - - /** - * Statement location. - */ - location: Position | Range; - - /** - * Coverage from branches of this line or statement. If it's not a - * conditional, this will be empty. - */ - branches: BranchCoverage[]; - - /** - * @param location The statement position. - * @param executed The number of times this statement was executed, or a - * boolean indicating whether it was executed if the exact count is - * unknown. If zero or false, the statement will be marked as un-covered. - * @param branches Coverage from branches of this line. If it's not a - * conditional, this should be omitted. - */ - constructor( - executed: number | boolean, - location: Position | Range, - branches?: BranchCoverage[], - ); - } - - /** - * Contains coverage information for a branch of a {@link StatementCoverage}. - */ - export class BranchCoverage { - /** - * The number of times this branch was executed, or a boolean indicating - * whether it was executed if the exact count is unknown. If zero or false, - * the branch will be marked as un-covered. - */ - executed: number | boolean; - - /** - * Branch location. - */ - location?: Position | Range; - - /** - * Label for the branch, used in the context of "the ${label} branch was - * not taken," for example. - */ - label?: string; - - /** - * @param executed The number of times this branch was executed, or a - * boolean indicating whether it was executed if the exact count is - * unknown. If zero or false, the branch will be marked as un-covered. - * @param location The branch position. - */ - constructor( - executed: number | boolean, - location?: Position | Range, - label?: string, - ); - } - - /** - * Contains coverage information for a declaration. Depending on the reporter - * and language, this may be types such as functions, methods, or namespaces. - */ - export class DeclarationCoverage { - /** - * Name of the declaration. - */ - name: string; - - /** - * The number of times this declaration was executed, or a boolean - * indicating whether it was executed if the exact count is unknown. If - * zero or false, the declaration will be marked as un-covered. - */ - executed: number | boolean; - - /** - * Declaration location. - */ - location: Position | Range; - - /** - * @param executed The number of times this declaration was executed, or a - * boolean indicating whether it was executed if the exact count is - * unknown. If zero or false, the declaration will be marked as un-covered. - * @param location The declaration position. - */ - constructor( - name: string, - executed: number | boolean, - location: Position | Range, - ); - } - - /** - * Coverage details returned from {@link TestRunProfile.loadDetailedCoverage}. - */ - export type FileCoverageDetail = StatementCoverage | DeclarationCoverage; - - /** - * The tab represents a single text based resource. - */ - export class TabInputText { - /** - * The uri represented by the tab. - */ - readonly uri: Uri; - /** - * Constructs a text tab input with the given URI. - * @param uri The URI of the tab. - */ - constructor(uri: Uri); - } - - /** - * The tab represents two text based resources - * being rendered as a diff. - */ - export class TabInputTextDiff { - /** - * The uri of the original text resource. - */ - readonly original: Uri; - /** - * The uri of the modified text resource. - */ - readonly modified: Uri; - /** - * Constructs a new text diff tab input with the given URIs. - * @param original The uri of the original text resource. - * @param modified The uri of the modified text resource. - */ - constructor(original: Uri, modified: Uri); - } - - /** - * The tab represents a custom editor. - */ - export class TabInputCustom { - /** - * The uri that the tab is representing. - */ - readonly uri: Uri; - /** - * The type of custom editor. - */ - readonly viewType: string; - /** - * Constructs a custom editor tab input. - * @param uri The uri of the tab. - * @param viewType The viewtype of the custom editor. - */ - constructor(uri: Uri, viewType: string); - } - - /** - * The tab represents a webview. - */ - export class TabInputWebview { - /** - * The type of webview. Maps to {@linkcode WebviewPanel.viewType WebviewPanel's viewType} - */ - readonly viewType: string; - /** - * Constructs a webview tab input with the given view type. - * @param viewType The type of webview. Maps to {@linkcode WebviewPanel.viewType WebviewPanel's viewType} - */ - constructor(viewType: string); - } - - /** - * The tab represents a notebook. - */ - export class TabInputNotebook { - /** - * The uri that the tab is representing. - */ - readonly uri: Uri; - /** - * The type of notebook. Maps to {@linkcode NotebookDocument.notebookType NotebookDocuments's notebookType} - */ - readonly notebookType: string; - /** - * Constructs a new tab input for a notebook. - * @param uri The uri of the notebook. - * @param notebookType The type of notebook. Maps to {@linkcode NotebookDocument.notebookType NotebookDocuments's notebookType} - */ - constructor(uri: Uri, notebookType: string); - } - - /** - * The tabs represents two notebooks in a diff configuration. - */ - export class TabInputNotebookDiff { - /** - * The uri of the original notebook. - */ - readonly original: Uri; - /** - * The uri of the modified notebook. - */ - readonly modified: Uri; - /** - * The type of notebook. Maps to {@linkcode NotebookDocument.notebookType NotebookDocuments's notebookType} - */ - readonly notebookType: string; - /** - * Constructs a notebook diff tab input. - * @param original The uri of the original unmodified notebook. - * @param modified The uri of the modified notebook. - * @param notebookType The type of notebook. Maps to {@linkcode NotebookDocument.notebookType NotebookDocuments's notebookType} - */ - constructor(original: Uri, modified: Uri, notebookType: string); - } - - /** - * The tab represents a terminal in the editor area. - */ - export class TabInputTerminal { - /** - * Constructs a terminal tab input. - */ - constructor(); - } - - /** - * Represents a tab within a {@link TabGroup group of tabs}. - * Tabs are merely the graphical representation within the editor area. - * A backing editor is not a guarantee. - */ - export interface Tab { - /** - * The text displayed on the tab. - */ - readonly label: string; - - /** - * The group which the tab belongs to. - */ - readonly group: TabGroup; - - /** - * Defines the structure of the tab i.e. text, notebook, custom, etc. - * Resource and other useful properties are defined on the tab kind. - */ - readonly input: - | TabInputText - | TabInputTextDiff - | TabInputCustom - | TabInputWebview - | TabInputNotebook - | TabInputNotebookDiff - | TabInputTerminal - | unknown; - - /** - * Whether or not the tab is currently active. - * This is dictated by being the selected tab in the group. - */ - readonly isActive: boolean; - - /** - * Whether or not the dirty indicator is present on the tab. - */ - readonly isDirty: boolean; - - /** - * Whether or not the tab is pinned (pin icon is present). - */ - readonly isPinned: boolean; - - /** - * Whether or not the tab is in preview mode. - */ - readonly isPreview: boolean; - } - - /** - * An event describing change to tabs. - */ - export interface TabChangeEvent { - /** - * The tabs that have been opened. - */ - readonly opened: readonly Tab[]; - /** - * The tabs that have been closed. - */ - readonly closed: readonly Tab[]; - /** - * Tabs that have changed, e.g have changed - * their {@link Tab.isActive active} state. - */ - readonly changed: readonly Tab[]; - } - - /** - * An event describing changes to tab groups. - */ - export interface TabGroupChangeEvent { - /** - * Tab groups that have been opened. - */ - readonly opened: readonly TabGroup[]; - /** - * Tab groups that have been closed. - */ - readonly closed: readonly TabGroup[]; - /** - * Tab groups that have changed, e.g have changed - * their {@link TabGroup.isActive active} state. - */ - readonly changed: readonly TabGroup[]; - } - - /** - * Represents a group of tabs. A tab group itself consists of multiple tabs. - */ - export interface TabGroup { - /** - * Whether or not the group is currently active. - * - * *Note* that only one tab group is active at a time, but that multiple tab - * groups can have an {@link activeTab active tab}. - * - * @see {@link Tab.isActive} - */ - readonly isActive: boolean; - - /** - * The view column of the group. - */ - readonly viewColumn: ViewColumn; - - /** - * The active {@link Tab tab} in the group. This is the tab whose contents are currently - * being rendered. - * - * *Note* that there can be one active tab per group but there can only be one {@link TabGroups.activeTabGroup active group}. - */ - readonly activeTab: Tab | undefined; - - /** - * The list of tabs contained within the group. - * This can be empty if the group has no tabs open. - */ - readonly tabs: readonly Tab[]; - } - - /** - * Represents the main editor area which consists of multiple groups which contain tabs. - */ - export interface TabGroups { - /** - * All the groups within the group container. - */ - readonly all: readonly TabGroup[]; - - /** - * The currently active group. - */ - readonly activeTabGroup: TabGroup; - - /** - * An {@link Event event} which fires when {@link TabGroup tab groups} have changed. - */ - readonly onDidChangeTabGroups: Event; - - /** - * An {@link Event event} which fires when {@link Tab tabs} have changed. - */ - readonly onDidChangeTabs: Event; - - /** - * Closes the tab. This makes the tab object invalid and the tab - * should no longer be used for further actions. - * Note: In the case of a dirty tab, a confirmation dialog will be shown which may be cancelled. If cancelled the tab is still valid - * - * @param tab The tab to close. - * @param preserveFocus When `true` focus will remain in its current position. If `false` it will jump to the next tab. - * @returns A promise that resolves to `true` when all tabs have been closed. - */ - close( - tab: Tab | readonly Tab[], - preserveFocus?: boolean, - ): Thenable; - - /** - * Closes the tab group. This makes the tab group object invalid and the tab group - * should no longer be used for further actions. - * @param tabGroup The tab group to close. - * @param preserveFocus When `true` focus will remain in its current position. - * @returns A promise that resolves to `true` when all tab groups have been closed. - */ - close( - tabGroup: TabGroup | readonly TabGroup[], - preserveFocus?: boolean, - ): Thenable; - } - - /** - * A special value wrapper denoting a value that is safe to not clean. - * This is to be used when you can guarantee no identifiable information is contained in the value and the cleaning is improperly redacting it. - */ - export class TelemetryTrustedValue { - /** - * The value that is trusted to not contain PII. - */ - readonly value: T; - - /** - * Creates a new telementry trusted value. - * - * @param value A value to trust - */ - constructor(value: T); - } - - /** - * A telemetry logger which can be used by extensions to log usage and error telementry. - * - * A logger wraps around an {@link TelemetrySender sender} but it guarantees that - * - user settings to disable or tweak telemetry are respected, and that - * - potential sensitive data is removed - * - * It also enables an "echo UI" that prints whatever data is send and it allows the editor - * to forward unhandled errors to the respective extensions. - * - * To get an instance of a `TelemetryLogger`, use - * {@link env.createTelemetryLogger `createTelemetryLogger`}. - */ - export interface TelemetryLogger { - /** - * An {@link Event} which fires when the enablement state of usage or error telemetry changes. - */ - readonly onDidChangeEnableStates: Event; - - /** - * Whether or not usage telemetry is enabled for this logger. - */ - readonly isUsageEnabled: boolean; - - /** - * Whether or not error telemetry is enabled for this logger. - */ - readonly isErrorsEnabled: boolean; - - /** - * Log a usage event. - * - * After completing cleaning, telemetry setting checks, and data mix-in calls `TelemetrySender.sendEventData` to log the event. - * Automatically supports echoing to extension telemetry output channel. - * @param eventName The event name to log - * @param data The data to log - */ - logUsage( - eventName: string, - data?: Record, - ): void; - - /** - * Log an error event. - * - * After completing cleaning, telemetry setting checks, and data mix-in calls `TelemetrySender.sendEventData` to log the event. Differs from `logUsage` in that it will log the event if the telemetry setting is Error+. - * Automatically supports echoing to extension telemetry output channel. - * @param eventName The event name to log - * @param data The data to log - */ - logError( - eventName: string, - data?: Record, - ): void; - - /** - * Log an error event. - * - * Calls `TelemetrySender.sendErrorData`. Does cleaning, telemetry checks, and data mix-in. - * Automatically supports echoing to extension telemetry output channel. - * Will also automatically log any exceptions thrown within the extension host process. - * @param error The error object which contains the stack trace cleaned of PII - * @param data Additional data to log alongside the stack trace - */ - logError( - error: Error, - data?: Record, - ): void; - - /** - * Dispose this object and free resources. - */ - dispose(): void; - } - - /** - * The telemetry sender is the contract between a telemetry logger and some telemetry service. **Note** that extensions must NOT - * call the methods of their sender directly as the logger provides extra guards and cleaning. - * - * ```js - * const sender: vscode.TelemetrySender = {...}; - * const logger = vscode.env.createTelemetryLogger(sender); - * - * // GOOD - uses the logger - * logger.logUsage('myEvent', { myData: 'myValue' }); - * - * // BAD - uses the sender directly: no data cleansing, ignores user settings, no echoing to the telemetry output channel etc - * sender.logEvent('myEvent', { myData: 'myValue' }); - * ``` - */ - export interface TelemetrySender { - /** - * Function to send event data without a stacktrace. Used within a {@link TelemetryLogger} - * - * @param eventName The name of the event which you are logging - * @param data A serializable key value pair that is being logged - */ - sendEventData(eventName: string, data?: Record): void; - - /** - * Function to send an error. Used within a {@link TelemetryLogger} - * - * @param error The error being logged - * @param data Any additional data to be collected with the exception - */ - sendErrorData(error: Error, data?: Record): void; - - /** - * Optional flush function which will give this sender a chance to send any remaining events - * as its {@link TelemetryLogger} is being disposed - */ - flush?(): void | Thenable; - } - - /** - * Options for creating a {@link TelemetryLogger} - */ - export interface TelemetryLoggerOptions { - /** - * Whether or not you want to avoid having the built-in common properties such as os, extension name, etc injected into the data object. - * Defaults to `false` if not defined. - */ - readonly ignoreBuiltInCommonProperties?: boolean; - - /** - * Whether or not unhandled errors on the extension host caused by your extension should be logged to your sender. - * Defaults to `false` if not defined. - */ - readonly ignoreUnhandledErrors?: boolean; - - /** - * Any additional common properties which should be injected into the data object. - */ - readonly additionalCommonProperties?: Record; - } - - /** - * Represents a user request in chat history. - */ - export class ChatRequestTurn { - /** - * The prompt as entered by the user. - * - * Information about references used in this request is stored in {@link ChatRequestTurn.references}. - * - * *Note* that the {@link ChatParticipant.name name} of the participant and the {@link ChatCommand.name command} - * are not part of the prompt. - */ - readonly prompt: string; - - /** - * The id of the chat participant to which this request was directed. - */ - readonly participant: string; - - /** - * The name of the {@link ChatCommand command} that was selected for this request. - */ - readonly command?: string; - - /** - * The references that were used in this message. - */ - readonly references: ChatPromptReference[]; - - /** - * The list of tools were attached to this request. - */ - readonly toolReferences: readonly ChatLanguageModelToolReference[]; - - /** - * @hidden - */ - private constructor( - prompt: string, - command: string | undefined, - references: ChatPromptReference[], - participant: string, - toolReferences: ChatLanguageModelToolReference[], - ); - } - - /** - * Represents a chat participant's response in chat history. - */ - export class ChatResponseTurn { - /** - * The content that was received from the chat participant. Only the stream parts that represent actual content (not metadata) are represented. - */ - readonly response: ReadonlyArray< - | ChatResponseMarkdownPart - | ChatResponseFileTreePart - | ChatResponseAnchorPart - | ChatResponseCommandButtonPart - >; - - /** - * The result that was received from the chat participant. - */ - readonly result: ChatResult; - - /** - * The id of the chat participant that this response came from. - */ - readonly participant: string; - - /** - * The name of the command that this response came from. - */ - readonly command?: string; - - /** - * @hidden - */ - private constructor( - response: ReadonlyArray< - | ChatResponseMarkdownPart - | ChatResponseFileTreePart - | ChatResponseAnchorPart - | ChatResponseCommandButtonPart - >, - result: ChatResult, - participant: string, - ); - } - - /** - * Extra context passed to a participant. - */ - export interface ChatContext { - /** - * All of the chat messages so far in the current chat session. Currently, only chat messages for the current participant are included. - */ - readonly history: ReadonlyArray; - } - - /** - * Represents an error result from a chat request. - */ - export interface ChatErrorDetails { - /** - * An error message that is shown to the user. - */ - message: string; - - /** - * If set to true, the response will be partly blurred out. - */ - responseIsFiltered?: boolean; - } - - /** - * The result of a chat request. - */ - export interface ChatResult { - /** - * If the request resulted in an error, this property defines the error details. - */ - errorDetails?: ChatErrorDetails; - - /** - * Arbitrary metadata for this result. Can be anything, but must be JSON-stringifyable. - */ - readonly metadata?: { readonly [key: string]: any }; - } - - /** - * Represents the type of user feedback received. - */ - export enum ChatResultFeedbackKind { - /** - * The user marked the result as unhelpful. - */ - Unhelpful = 0, - - /** - * The user marked the result as helpful. - */ - Helpful = 1, - } - - /** - * Represents user feedback for a result. - */ - export interface ChatResultFeedback { - /** - * The ChatResult for which the user is providing feedback. - * This object has the same properties as the result returned from the participant callback, including `metadata`, but is not the same instance. - */ - readonly result: ChatResult; - - /** - * The kind of feedback that was received. - */ - readonly kind: ChatResultFeedbackKind; - } - - /** - * A followup question suggested by the participant. - */ - export interface ChatFollowup { - /** - * The message to send to the chat. - */ - prompt: string; - - /** - * A title to show the user. The prompt will be shown by default, when this is unspecified. - */ - label?: string; - - /** - * By default, the followup goes to the same participant/command. But this property can be set to invoke a different participant by ID. - * Followups can only invoke a participant that was contributed by the same extension. - */ - participant?: string; - - /** - * By default, the followup goes to the same participant/command. But this property can be set to invoke a different command. - */ - command?: string; - } - - /** - * Will be invoked once after each request to get suggested followup questions to show the user. The user can click the followup to send it to the chat. - */ - export interface ChatFollowupProvider { - /** - * Provide followups for the given result. - * - * @param result This object has the same properties as the result returned from the participant callback, including `metadata`, but is not the same instance. - * @param context Extra context passed to a participant. - * @param token A cancellation token. - */ - provideFollowups( - result: ChatResult, - context: ChatContext, - token: CancellationToken, - ): ProviderResult; - } - - /** - * A chat request handler is a callback that will be invoked when a request is made to a chat participant. - */ - export type ChatRequestHandler = ( - request: ChatRequest, - context: ChatContext, - response: ChatResponseStream, - token: CancellationToken, - ) => ProviderResult; - - /** - * A chat participant can be invoked by the user in a chat session, using the `@` prefix. When it is invoked, it handles the chat request and is solely - * responsible for providing a response to the user. A ChatParticipant is created using {@link chat.createChatParticipant}. - */ - export interface ChatParticipant { - /** - * A unique ID for this participant. - */ - readonly id: string; - - /** - * An icon for the participant shown in UI. - */ - iconPath?: IconPath; - - /** - * The handler for requests to this participant. - */ - requestHandler: ChatRequestHandler; - - /** - * This provider will be called once after each request to retrieve suggested followup questions. - */ - followupProvider?: ChatFollowupProvider; - - /** - * An event that fires whenever feedback for a result is received, e.g. when a user up- or down-votes - * a result. - * - * The passed {@link ChatResultFeedback.result result} is guaranteed to have the same properties as the result that was - * previously returned from this chat participant's handler. - */ - onDidReceiveFeedback: Event; - - /** - * Dispose this participant and free resources. - */ - dispose(): void; - } - - /** - * A reference to a value that the user added to their chat request. - */ - export interface ChatPromptReference { - /** - * A unique identifier for this kind of reference. - */ - readonly id: string; - - /** - * The start and end index of the reference in the {@link ChatRequest.prompt prompt}. When undefined, the reference was not part of the prompt text. - * - * *Note* that the indices take the leading `#`-character into account which means they can - * used to modify the prompt as-is. - */ - readonly range?: [start: number, end: number]; - - /** - * A description of this value that could be used in an LLM prompt. - */ - readonly modelDescription?: string; - - /** - * The value of this reference. The `string | Uri | Location` types are used today, but this could expand in the future. - */ - readonly value: string | Uri | Location | unknown; - } - - /** - * A request to a chat participant. - */ - export interface ChatRequest { - /** - * The prompt as entered by the user. - * - * Information about references used in this request is stored in {@link ChatRequest.references}. - * - * *Note* that the {@link ChatParticipant.name name} of the participant and the {@link ChatCommand.name command} - * are not part of the prompt. - */ - readonly prompt: string; - - /** - * The name of the {@link ChatCommand command} that was selected for this request. - */ - readonly command: string | undefined; - - /** - * The list of references and their values that are referenced in the prompt. - * - * *Note* that the prompt contains references as authored and that it is up to the participant - * to further modify the prompt, for instance by inlining reference values or creating links to - * headings which contain the resolved values. References are sorted in reverse by their range - * in the prompt. That means the last reference in the prompt is the first in this list. This simplifies - * string-manipulation of the prompt. - */ - readonly references: readonly ChatPromptReference[]; - - /** - * The list of tools that the user attached to their request. - * - * When a tool reference is present, the chat participant should make a chat request using - * {@link LanguageModelChatToolMode.Required} to force the language model to generate input for the tool. Then, the - * participant can use {@link lm.invokeTool} to use the tool attach the result to its request for the user's prompt. The - * tool may contribute useful extra context for the user's request. - */ - readonly toolReferences: readonly ChatLanguageModelToolReference[]; - - /** - * A token that can be passed to {@link lm.invokeTool} when invoking a tool inside the context of handling a chat request. - * This associates the tool invocation to a chat session. - */ - readonly toolInvocationToken: ChatParticipantToolToken; - - /** - * This is the model that is currently selected in the UI. Extensions can use this or use {@link chat.selectChatModels} to - * pick another model. Don't hold onto this past the lifetime of the request. - */ - readonly model: LanguageModelChat; - } - - /** - * The ChatResponseStream is how a participant is able to return content to the chat view. It provides several methods for streaming different types of content - * which will be rendered in an appropriate way in the chat view. A participant can use the helper method for the type of content it wants to return, or it - * can instantiate a {@link ChatResponsePart} and use the generic {@link ChatResponseStream.push} method to return it. - */ - export interface ChatResponseStream { - /** - * Push a markdown part to this stream. Short-hand for - * `push(new ChatResponseMarkdownPart(value))`. - * - * @see {@link ChatResponseStream.push} - * @param value A markdown string or a string that should be interpreted as markdown. The boolean form of {@link MarkdownString.isTrusted} is NOT supported. - */ - markdown(value: string | MarkdownString): void; - - /** - * Push an anchor part to this stream. Short-hand for - * `push(new ChatResponseAnchorPart(value, title))`. - * An anchor is an inline reference to some type of resource. - * - * @param value A uri or location. - * @param title An optional title that is rendered with value. - */ - anchor(value: Uri | Location, title?: string): void; - - /** - * Push a command button part to this stream. Short-hand for - * `push(new ChatResponseCommandButtonPart(value, title))`. - * - * @param command A Command that will be executed when the button is clicked. - */ - button(command: Command): void; - - /** - * Push a filetree part to this stream. Short-hand for - * `push(new ChatResponseFileTreePart(value))`. - * - * @param value File tree data. - * @param baseUri The base uri to which this file tree is relative. - */ - filetree(value: ChatResponseFileTree[], baseUri: Uri): void; - - /** - * Push a progress part to this stream. Short-hand for - * `push(new ChatResponseProgressPart(value))`. - * - * @param value A progress message - */ - progress(value: string): void; - - /** - * Push a reference to this stream. Short-hand for - * `push(new ChatResponseReferencePart(value))`. - * - * *Note* that the reference is not rendered inline with the response. - * - * @param value A uri or location - * @param iconPath Icon for the reference shown in UI - */ - reference(value: Uri | Location, iconPath?: IconPath): void; - - /** - * Pushes a part to this stream. - * - * @param part A response part, rendered or metadata - */ - push(part: ChatResponsePart): void; - } - - /** - * Represents a part of a chat response that is formatted as Markdown. - */ - export class ChatResponseMarkdownPart { - /** - * A markdown string or a string that should be interpreted as markdown. - */ - value: MarkdownString; - - /** - * Create a new ChatResponseMarkdownPart. - * - * @param value A markdown string or a string that should be interpreted as markdown. The boolean form of {@link MarkdownString.isTrusted} is NOT supported. - */ - constructor(value: string | MarkdownString); - } - - /** - * Represents a file tree structure in a chat response. - */ - export interface ChatResponseFileTree { - /** - * The name of the file or directory. - */ - name: string; - - /** - * An array of child file trees, if the current file tree is a directory. - */ - children?: ChatResponseFileTree[]; - } - - /** - * Represents a part of a chat response that is a file tree. - */ - export class ChatResponseFileTreePart { - /** - * File tree data. - */ - value: ChatResponseFileTree[]; - - /** - * The base uri to which this file tree is relative - */ - baseUri: Uri; - - /** - * Create a new ChatResponseFileTreePart. - * @param value File tree data. - * @param baseUri The base uri to which this file tree is relative. - */ - constructor(value: ChatResponseFileTree[], baseUri: Uri); - } - - /** - * Represents a part of a chat response that is an anchor, that is rendered as a link to a target. - */ - export class ChatResponseAnchorPart { - /** - * The target of this anchor. - */ - value: Uri | Location; - - /** - * An optional title that is rendered with value. - */ - title?: string; - - /** - * Create a new ChatResponseAnchorPart. - * @param value A uri or location. - * @param title An optional title that is rendered with value. - */ - constructor(value: Uri | Location, title?: string); - } - - /** - * Represents a part of a chat response that is a progress message. - */ - export class ChatResponseProgressPart { - /** - * The progress message - */ - value: string; - - /** - * Create a new ChatResponseProgressPart. - * @param value A progress message - */ - constructor(value: string); - } - - /** - * Represents a part of a chat response that is a reference, rendered separately from the content. - */ - export class ChatResponseReferencePart { - /** - * The reference target. - */ - value: Uri | Location; - - /** - * The icon for the reference. - */ - iconPath?: IconPath; - - /** - * Create a new ChatResponseReferencePart. - * @param value A uri or location - * @param iconPath Icon for the reference shown in UI - */ - constructor(value: Uri | Location, iconPath?: IconPath); - } - - /** - * Represents a part of a chat response that is a button that executes a command. - */ - export class ChatResponseCommandButtonPart { - /** - * The command that will be executed when the button is clicked. - */ - value: Command; - - /** - * Create a new ChatResponseCommandButtonPart. - * @param value A Command that will be executed when the button is clicked. - */ - constructor(value: Command); - } - - /** - * Represents the different chat response types. - */ - export type ChatResponsePart = - | ChatResponseMarkdownPart - | ChatResponseFileTreePart - | ChatResponseAnchorPart - | ChatResponseProgressPart - | ChatResponseReferencePart - | ChatResponseCommandButtonPart; - - /** - * Namespace for chat functionality. Users interact with chat participants by sending messages - * to them in the chat view. Chat participants can respond with markdown or other types of content - * via the {@link ChatResponseStream}. - */ - export namespace chat { - /** - * Create a new {@link ChatParticipant chat participant} instance. - * - * @param id A unique identifier for the participant. - * @param handler A request handler for the participant. - * @returns A new chat participant - */ - export function createChatParticipant( - id: string, - handler: ChatRequestHandler, - ): ChatParticipant; - } - - /** - * Represents the role of a chat message. This is either the user or the assistant. - */ - export enum LanguageModelChatMessageRole { - /** - * The user role, e.g the human interacting with a language model. - */ - User = 1, - - /** - * The assistant role, e.g. the language model generating responses. - */ - Assistant = 2, - } - - /** - * Represents a message in a chat. Can assume different roles, like user or assistant. - */ - export class LanguageModelChatMessage { - /** - * Utility to create a new user message. - * - * @param content The content of the message. - * @param name The optional name of a user for the message. - */ - static User( - content: - | string - | Array, - name?: string, - ): LanguageModelChatMessage; - - /** - * Utility to create a new assistant message. - * - * @param content The content of the message. - * @param name The optional name of a user for the message. - */ - static Assistant( - content: - | string - | Array, - name?: string, - ): LanguageModelChatMessage; - - /** - * The role of this message. - */ - role: LanguageModelChatMessageRole; - - /** - * A string or heterogeneous array of things that a message can contain as content. Some parts may be message-type - * specific for some models. - */ - content: Array< - | LanguageModelTextPart - | LanguageModelToolResultPart - | LanguageModelToolCallPart - >; - - /** - * The optional name of a user for this message. - */ - name: string | undefined; - - /** - * Create a new user message. - * - * @param role The role of the message. - * @param content The content of the message. - * @param name The optional name of a user for the message. - */ - constructor( - role: LanguageModelChatMessageRole, - content: - | string - | Array< - | LanguageModelTextPart - | LanguageModelToolResultPart - | LanguageModelToolCallPart - >, - name?: string, - ); - } - - /** - * Represents a language model response. - * - * @see {@link LanguageModelAccess.chatRequest} - */ - export interface LanguageModelChatResponse { - /** - * An async iterable that is a stream of text and tool-call parts forming the overall response. A - * {@link LanguageModelTextPart} is part of the assistant's response to be shown to the user. A - * {@link LanguageModelToolCallPart} is a request from the language model to call a tool. The latter will - * only be returned if tools were passed in the request via {@link LanguageModelChatRequestOptions.tools}. The - * `unknown`-type is used as a placeholder for future parts, like image data parts. - * - * *Note* that this stream will error when during data receiving an error occurs. Consumers of the stream should handle - * the errors accordingly. - * - * To cancel the stream, the consumer can {@link CancellationTokenSource.cancel cancel} the token that was used to make - * the request or break from the for-loop. - * - * @example - * ```ts - * try { - * // consume stream - * for await (const chunk of response.stream) { - * if (chunk instanceof LanguageModelTextPart) { - * console.log("TEXT", chunk); - * } else if (chunk instanceof LanguageModelToolCallPart) { - * console.log("TOOL CALL", chunk); - * } - * } - * - * } catch(e) { - * // stream ended with an error - * console.error(e); - * } - * ``` - */ - stream: AsyncIterable< - LanguageModelTextPart | LanguageModelToolCallPart | unknown - >; - - /** - * This is equivalent to filtering everything except for text parts from a {@link LanguageModelChatResponse.stream}. - * - * @see {@link LanguageModelChatResponse.stream} - */ - text: AsyncIterable; - } - - /** - * Represents a language model for making chat requests. - * - * @see {@link lm.selectChatModels} - */ - export interface LanguageModelChat { - /** - * Human-readable name of the language model. - */ - readonly name: string; - - /** - * Opaque identifier of the language model. - */ - readonly id: string; - - /** - * A well-known identifier of the vendor of the language model. An example is `copilot`, but - * values are defined by extensions contributing chat models and need to be looked up with them. - */ - readonly vendor: string; - - /** - * Opaque family-name of the language model. Values might be `gpt-3.5-turbo`, `gpt4`, `phi2`, or `llama` - * but they are defined by extensions contributing languages and subject to change. - */ - readonly family: string; - - /** - * Opaque version string of the model. This is defined by the extension contributing the language model - * and subject to change. - */ - readonly version: string; - - /** - * The maximum number of tokens that can be sent to the model in a single request. - */ - readonly maxInputTokens: number; - - /** - * Make a chat request using a language model. - * - * *Note* that language model use may be subject to access restrictions and user consent. Calling this function - * for the first time (for an extension) will show a consent dialog to the user and because of that this function - * must _only be called in response to a user action!_ Extensions can use {@link LanguageModelAccessInformation.canSendRequest} - * to check if they have the necessary permissions to make a request. - * - * This function will return a rejected promise if making a request to the language model is not - * possible. Reasons for this can be: - * - * - user consent not given, see {@link LanguageModelError.NoPermissions `NoPermissions`} - * - model does not exist anymore, see {@link LanguageModelError.NotFound `NotFound`} - * - quota limits exceeded, see {@link LanguageModelError.Blocked `Blocked`} - * - other issues in which case extension must check {@link LanguageModelError.cause `LanguageModelError.cause`} - * - * An extension can make use of language model tool calling by passing a set of tools to - * {@link LanguageModelChatRequestOptions.tools}. The language model will return a {@link LanguageModelToolCallPart} and - * the extension can invoke the tool and make another request with the result. - * - * @param messages An array of message instances. - * @param options Options that control the request. - * @param token A cancellation token which controls the request. See {@link CancellationTokenSource} for how to create one. - * @returns A thenable that resolves to a {@link LanguageModelChatResponse}. The promise will reject when the request couldn't be made. - */ - sendRequest( - messages: LanguageModelChatMessage[], - options?: LanguageModelChatRequestOptions, - token?: CancellationToken, - ): Thenable; - - /** - * Count the number of tokens in a message using the model specific tokenizer-logic. - - * @param text A string or a message instance. - * @param token Optional cancellation token. See {@link CancellationTokenSource} for how to create one. - * @returns A thenable that resolves to the number of tokens. - */ - countTokens( - text: string | LanguageModelChatMessage, - token?: CancellationToken, - ): Thenable; - } - - /** - * Describes how to select language models for chat requests. - * - * @see {@link lm.selectChatModels} - */ - export interface LanguageModelChatSelector { - /** - * A vendor of language models. - * @see {@link LanguageModelChat.vendor} - */ - vendor?: string; - - /** - * A family of language models. - * @see {@link LanguageModelChat.family} - */ - family?: string; - - /** - * The version of a language model. - * @see {@link LanguageModelChat.version} - */ - version?: string; - - /** - * The identifier of a language model. - * @see {@link LanguageModelChat.id} - */ - id?: string; - } - - /** - * An error type for language model specific errors. - * - * Consumers of language models should check the code property to determine specific - * failure causes, like `if(someError.code === vscode.LanguageModelError.NotFound.name) {...}` - * for the case of referring to an unknown language model. For unspecified errors the `cause`-property - * will contain the actual error. - */ - export class LanguageModelError extends Error { - /** - * The requestor does not have permissions to use this - * language model - */ - static NoPermissions(message?: string): LanguageModelError; - - /** - * The requestor is blocked from using this language model. - */ - static Blocked(message?: string): LanguageModelError; - - /** - * The language model does not exist. - */ - static NotFound(message?: string): LanguageModelError; - - /** - * A code that identifies this error. - * - * Possible values are names of errors, like {@linkcode LanguageModelError.NotFound NotFound}, - * or `Unknown` for unspecified errors from the language model itself. In the latter case the - * `cause`-property will contain the actual error. - */ - readonly code: string; - } - - /** - * Options for making a chat request using a language model. - * - * @see {@link LanguageModelChat.sendRequest} - */ - export interface LanguageModelChatRequestOptions { - /** - * A human-readable message that explains why access to a language model is needed and what feature is enabled by it. - */ - justification?: string; - - /** - * A set of options that control the behavior of the language model. These options are specific to the language model - * and need to be lookup in the respective documentation. - */ - modelOptions?: { [name: string]: any }; - - /** - * An optional list of tools that are available to the language model. These could be registered tools available via - * {@link lm.tools}, or private tools that are just implemented within the calling extension. - * - * If the LLM requests to call one of these tools, it will return a {@link LanguageModelToolCallPart} in - * {@link LanguageModelChatResponse.stream}. It's the caller's responsibility to invoke the tool. If it's a tool - * registered in {@link lm.tools}, that means calling {@link lm.invokeTool}. - * - * Then, the tool result can be provided to the LLM by creating an Assistant-type {@link LanguageModelChatMessage} with a - * {@link LanguageModelToolCallPart}, followed by a User-type message with a {@link LanguageModelToolResultPart}. - */ - tools?: LanguageModelChatTool[]; - - /** - * The tool-selecting mode to use. {@link LanguageModelChatToolMode.Auto} by default. - */ - toolMode?: LanguageModelChatToolMode; - } - - /** - * Namespace for language model related functionality. - */ - export namespace lm { - /** - * An event that is fired when the set of available chat models changes. - */ - export const onDidChangeChatModels: Event; - - /** - * Select chat models by a {@link LanguageModelChatSelector selector}. This can yield multiple or no chat models and - * extensions must handle these cases, esp. when no chat model exists, gracefully. - * - * ```ts - * const models = await vscode.lm.selectChatModels({ family: 'gpt-3.5-turbo' }); - * if (models.length > 0) { - * const [first] = models; - * const response = await first.sendRequest(...) - * // ... - * } else { - * // NO chat models available - * } - * ``` - * - * A selector can be written to broadly match all models of a given vendor or family, or it can narrowly select one model by ID. - * Keep in mind that the available set of models will change over time, but also that prompts may perform differently in - * different models. - * - * *Note* that extensions can hold on to the results returned by this function and use them later. However, when the - * {@link onDidChangeChatModels}-event is fired the list of chat models might have changed and extensions should re-query. - * - * @param selector A chat model selector. When omitted all chat models are returned. - * @returns An array of chat models, can be empty! - */ - export function selectChatModels( - selector?: LanguageModelChatSelector, - ): Thenable; - - /** - * Register a LanguageModelTool. The tool must also be registered in the package.json `languageModelTools` contribution - * point. A registered tool is available in the {@link lm.tools} list for any extension to see. But in order for it to - * be seen by a language model, it must be passed in the list of available tools in {@link LanguageModelChatRequestOptions.tools}. - * @returns A {@link Disposable} that unregisters the tool when disposed. - */ - export function registerTool( - name: string, - tool: LanguageModelTool, - ): Disposable; - - /** - * A list of all available tools that were registered by all extensions using {@link lm.registerTool}. They can be called - * with {@link lm.invokeTool} with input that match their declared `inputSchema`. - */ - export const tools: readonly LanguageModelToolInformation[]; - - /** - * Invoke a tool listed in {@link lm.tools} by name with the given input. The input will be validated against - * the schema declared by the tool - * - * A tool can be invoked by a chat participant, in the context of handling a chat request, or globally by any extension in - * any custom flow. - * - * In the former case, the caller shall pass the - * {@link LanguageModelToolInvocationOptions.toolInvocationToken toolInvocationToken}, which comes with the a - * {@link ChatRequest.toolInvocationToken chat request}. This makes sure the chat UI shows the tool invocation for the - * correct conversation. - * - * A tool {@link LanguageModelToolResult result} is an array of {@link LanguageModelTextPart text-} and - * {@link LanguageModelPromptTsxPart prompt-tsx}-parts. If the tool caller is using `@vscode/prompt-tsx`, it can - * incorporate the response parts into its prompt using a `ToolResult`. If not, the parts can be passed along to the - * {@link LanguageModelChat} via a user message with a {@link LanguageModelToolResultPart}. - * - * If a chat participant wants to preserve tool results for requests across multiple turns, it can store tool results in - * the {@link ChatResult.metadata} returned from the handler and retrieve them on the next turn from - * {@link ChatResponseTurn.result}. - * - * @param name The name of the tool to call. - * @param options The options to use when invoking the tool. - * @param token A cancellation token. See {@link CancellationTokenSource} for how to create one. - * @returns The result of the tool invocation. - */ - export function invokeTool( - name: string, - options: LanguageModelToolInvocationOptions, - token?: CancellationToken, - ): Thenable; - } - - /** - * Represents extension specific information about the access to language models. - */ - export interface LanguageModelAccessInformation { - /** - * An event that fires when access information changes. - */ - onDidChange: Event; - - /** - * Checks if a request can be made to a language model. - * - * *Note* that calling this function will not trigger a consent UI but just checks for a persisted state. - * - * @param chat A language model chat object. - * @return `true` if a request can be made, `false` if not, `undefined` if the language - * model does not exist or consent hasn't been asked for. - */ - canSendRequest(chat: LanguageModelChat): boolean | undefined; - } - - /** - * A tool that is available to the language model via {@link LanguageModelChatRequestOptions}. A language model uses all the - * properties of this interface to decide which tool to call, and how to call it. - */ - export interface LanguageModelChatTool { - /** - * The name of the tool. - */ - name: string; - - /** - * The description of the tool. - */ - description: string; - - /** - * A JSON schema for the input this tool accepts. - */ - inputSchema?: object; - } - - /** - * A tool-calling mode for the language model to use. - */ - export enum LanguageModelChatToolMode { - /** - * The language model can choose to call a tool or generate a message. Is the default. - */ - Auto = 1, - - /** - * The language model must call one of the provided tools. Note- some models only support a single tool when using this - * mode. - */ - Required = 2, - } - - /** - * A language model response part indicating a tool call, returned from a {@link LanguageModelChatResponse}, and also can be - * included as a content part on a {@link LanguageModelChatMessage}, to represent a previous tool call in a chat request. - */ - export class LanguageModelToolCallPart { - /** - * The ID of the tool call. This is a unique identifier for the tool call within the chat request. - */ - callId: string; - - /** - * The name of the tool to call. - */ - name: string; - - /** - * The input with which to call the tool. - */ - input: object; - - /** - * Create a new LanguageModelToolCallPart. - * - * @param callId The ID of the tool call. - * @param name The name of the tool to call. - * @param input The input with which to call the tool. - */ - constructor(callId: string, name: string, input: object); - } - - /** - * The result of a tool call. This is the counterpart of a {@link LanguageModelToolCallPart tool call} and - * it can only be included in the content of a User message - */ - export class LanguageModelToolResultPart { - /** - * The ID of the tool call. - * - * *Note* that this should match the {@link LanguageModelToolCallPart.callId callId} of a tool call part. - */ - callId: string; - - /** - * The value of the tool result. - */ - content: Array< - LanguageModelTextPart | LanguageModelPromptTsxPart | unknown - >; - - /** - * @param callId The ID of the tool call. - * @param content The content of the tool result. - */ - constructor( - callId: string, - content: Array< - LanguageModelTextPart | LanguageModelPromptTsxPart | unknown - >, - ); - } - - /** - * A language model response part containing a piece of text, returned from a {@link LanguageModelChatResponse}. - */ - export class LanguageModelTextPart { - /** - * The text content of the part. - */ - value: string; - - /** - * Construct a text part with the given content. - * @param value The text content of the part. - */ - constructor(value: string); - } - - /** - * A language model response part containing a PromptElementJSON from `@vscode/prompt-tsx`. - * @see {@link LanguageModelToolResult} - */ - export class LanguageModelPromptTsxPart { - /** - * The value of the part. - */ - value: unknown; - - /** - * Construct a prompt-tsx part with the given content. - * @param value The value of the part, the result of `renderPromptElementJSON` from `@vscode/prompt-tsx`. - */ - constructor(value: unknown); - } - - /** - * A result returned from a tool invocation. If using `@vscode/prompt-tsx`, this result may be rendered using a `ToolResult`. - */ - export class LanguageModelToolResult { - /** - * A list of tool result content parts. Includes `unknown` becauses this list may be extended with new content types in - * the future. - * @see {@link lm.invokeTool}. - */ - content: Array< - LanguageModelTextPart | LanguageModelPromptTsxPart | unknown - >; - - /** - * Create a LanguageModelToolResult - * @param content A list of tool result content parts - */ - constructor( - content: Array, - ); - } - - /** - * A token that can be passed to {@link lm.invokeTool} when invoking a tool inside the context of handling a chat request. - */ - export type ChatParticipantToolToken = never; - - /** - * Options provided for tool invocation. - */ - export interface LanguageModelToolInvocationOptions { - /** - * An opaque object that ties a tool invocation to a chat request from a {@link ChatParticipant chat participant}. - * - * The _only_ way to get a valid tool invocation token is using the provided {@link ChatRequest.toolInvocationToken toolInvocationToken} - * from a chat request. In that case, a progress bar will be automatically shown for the tool invocation in the chat response view, and if - * the tool requires user confirmation, it will show up inline in the chat view. - * - * If the tool is being invoked outside of a chat request, `undefined` should be passed instead, and no special UI except for - * confirmations will be shown. - * - * *Note* that a tool that invokes another tool during its invocation, can pass along the `toolInvocationToken` that it received. - */ - toolInvocationToken: ChatParticipantToolToken | undefined; - - /** - * The input with which to invoke the tool. The input must match the schema defined in - * {@link LanguageModelToolInformation.inputSchema} - */ - input: T; - - /** - * Options to hint at how many tokens the tool should return in its response, and enable the tool to count tokens - * accurately. - */ - tokenizationOptions?: LanguageModelToolTokenizationOptions; - } - - /** - * Options related to tokenization for a tool invocation. - */ - export interface LanguageModelToolTokenizationOptions { - /** - * If known, the maximum number of tokens the tool should emit in its result. - */ - tokenBudget: number; - - /** - * Count the number of tokens in a message using the model specific tokenizer-logic. - * @param text A string. - * @param token Optional cancellation token. See {@link CancellationTokenSource} for how to create one. - * @returns A thenable that resolves to the number of tokens. - */ - countTokens(text: string, token?: CancellationToken): Thenable; - } - - /** - * Information about a registered tool available in {@link lm.tools}. - */ - export interface LanguageModelToolInformation { - /** - * A unique name for the tool. - */ - readonly name: string; - - /** - * A description of this tool that may be passed to a language model. - */ - readonly description: string; - - /** - * A JSON schema for the input this tool accepts. - */ - readonly inputSchema: object | undefined; - - /** - * A set of tags, declared by the tool, that roughly describe the tool's capabilities. A tool user may use these to filter - * the set of tools to just ones that are relevant for the task at hand. - */ - readonly tags: readonly string[]; - } - - /** - * Options for {@link LanguageModelTool.prepareInvocation}. - */ - export interface LanguageModelToolInvocationPrepareOptions { - /** - * The input that the tool is being invoked with. - */ - input: T; - } - - /** - * A tool that can be invoked by a call to a {@link LanguageModelChat}. - */ - export interface LanguageModelTool { - /** - * Invoke the tool with the given input and return a result. - * - * The provided {@link LanguageModelToolInvocationOptions.input} has been validated against the declared schema. - */ - invoke( - options: LanguageModelToolInvocationOptions, - token: CancellationToken, - ): ProviderResult; - - /** - * Called once before a tool is invoked. It's recommended to implement this to customize the progress message that appears - * while the tool is running, and to provide a more useful message with context from the invocation input. Can also - * signal that a tool needs user confirmation before running, if appropriate. - * - * * *Note 1:* Must be free of side-effects. - * * *Note 2:* A call to `prepareInvocation` is not necessarily followed by a call to `invoke`. - */ - prepareInvocation?( - options: LanguageModelToolInvocationPrepareOptions, - token: CancellationToken, - ): ProviderResult; - } - - /** - * When this is returned in {@link PreparedToolInvocation}, the user will be asked to confirm before running the tool. These - * messages will be shown with buttons that say "Continue" and "Cancel". - */ - export interface LanguageModelToolConfirmationMessages { - /** - * The title of the confirmation message. - */ - title: string; - - /** - * The body of the confirmation message. - */ - message: string | MarkdownString; - } - - /** - * The result of a call to {@link LanguageModelTool.prepareInvocation}. - */ - export interface PreparedToolInvocation { - /** - * A customized progress message to show while the tool runs. - */ - invocationMessage?: string; - - /** - * The presence of this property indicates that the user should be asked to confirm before running the tool. The user - * should be asked for confirmation for any tool that has a side-effect or may potentially be dangerous. - */ - confirmationMessages?: LanguageModelToolConfirmationMessages; - } - - /** - * A reference to a tool that the user manually attached to their request, either using the `#`-syntax inline, or as an - * attachment via the paperclip button. - */ - export interface ChatLanguageModelToolReference { - /** - * The tool name. Refers to a tool listed in {@link lm.tools}. - */ - readonly name: string; - - /** - * The start and end index of the reference in the {@link ChatRequest.prompt prompt}. When undefined, the reference was - * not part of the prompt text. - * - * *Note* that the indices take the leading `#`-character into account which means they can be used to modify the prompt - * as-is. - */ - readonly range?: [start: number, end: number]; - } -} - -/** - * Thenable is a common denominator between ES6 promises, Q, jquery.Deferred, WinJS.Promise, - * and others. This API makes no assumption about what promise library is being used which - * enables reusing existing code without migrating to a specific promise implementation. Still, - * we recommend the use of native promises which are available in this editor. - */ -interface Thenable extends PromiseLike {} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.activeComment.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.activeComment.d.ts deleted file mode 100644 index 4a73c400..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.activeComment.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module "vscode" { - // @alexr00 https://github.com/microsoft/vscode/issues/204484 - - export interface CommentController { - /** - * The currently active comment or `undefined`. The active comment is the one - * that currently has focus or, when none has focus, undefined. - */ - // readonly activeComment: Comment | undefined; - - /** - * The currently active comment thread or `undefined`. The active comment thread is the one - * in the CommentController that most recently had focus or, when a different CommentController's - * thread has most recently had focus, undefined. - */ - readonly activeCommentThread: CommentThread | undefined; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.aiRelatedInformation.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.aiRelatedInformation.d.ts deleted file mode 100644 index d84a82f0..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.aiRelatedInformation.d.ts +++ /dev/null @@ -1,68 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module "vscode" { - // https://github.com/microsoft/vscode/issues/190909 - - export enum RelatedInformationType { - SymbolInformation = 1, - CommandInformation = 2, - SearchInformation = 3, - SettingInformation = 4, - } - - interface RelatedInformationBaseResult { - type: RelatedInformationType; - weight: number; - } - - // TODO: Symbols and Search - - export interface CommandInformationResult - extends RelatedInformationBaseResult { - type: RelatedInformationType.CommandInformation; - command: string; - } - - export interface SettingInformationResult - extends RelatedInformationBaseResult { - type: RelatedInformationType.SettingInformation; - setting: string; - } - - export type RelatedInformationResult = - | CommandInformationResult - | SettingInformationResult; - - export interface RelatedInformationProvider { - provideRelatedInformation( - query: string, - token: CancellationToken, - ): ProviderResult; - } - - export interface EmbeddingVectorProvider { - provideEmbeddingVector( - strings: string[], - token: CancellationToken, - ): ProviderResult; - } - - export namespace ai { - export function getRelatedInformation( - query: string, - types: RelatedInformationType[], - token: CancellationToken, - ): Thenable; - export function registerRelatedInformationProvider( - type: RelatedInformationType, - provider: RelatedInformationProvider, - ): Disposable; - export function registerEmbeddingVectorProvider( - model: string, - provider: EmbeddingVectorProvider, - ): Disposable; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.aiTextSearchProvider.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.aiTextSearchProvider.d.ts deleted file mode 100644 index 85e99b1c..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.aiTextSearchProvider.d.ts +++ /dev/null @@ -1,49 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -// version: 2 - -declare module "vscode" { - /** - * An AITextSearchProvider provides additional AI text search results in the workspace. - */ - export interface AITextSearchProvider { - /** - * The name of the AI searcher. Will be displayed as `{name} Results` in the Search View. - */ - readonly name?: string; - - /** - * - * Provide results that match the given text pattern. - * @param query The parameter for this query. - * @param options A set of options to consider while searching. - * @param progress A progress callback that must be invoked for all results. - * @param token A cancellation token. - */ - provideAITextSearchResults( - query: string, - options: TextSearchProviderOptions, - progress: Progress, - token: CancellationToken, - ): ProviderResult; - } - - export namespace workspace { - /** - * Register an AI text search provider. - * - * Only one provider can be registered per scheme. - * - * @param scheme The provider will be invoked for workspace folders that have this file scheme. - * @param provider The provider. - * @return A {@link Disposable} that unregisters this provider when being disposed. - */ - export function registerAITextSearchProvider( - scheme: string, - provider: AITextSearchProvider, - ): Disposable; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.attributableCoverage.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.attributableCoverage.d.ts deleted file mode 100644 index 467c3baf..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.attributableCoverage.d.ts +++ /dev/null @@ -1,51 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module "vscode" { - export class FileCoverage2 extends FileCoverage { - /** - * A list of {@link TestItem test cases} that generated coverage in this - * file. If set, then {@link TestRunProfile.loadDetailedCoverageForTest} - * should also be defined in order to retrieve detailed coverage information. - */ - fromTests: TestItem[]; - - constructor( - uri: Uri, - statementCoverage: TestCoverageCount, - branchCoverage?: TestCoverageCount, - declarationCoverage?: TestCoverageCount, - fromTests?: TestItem[], - ); - } - - export interface TestRunProfile { - /** - * An extension-provided function that provides detailed statement and - * function-level coverage for a single test in a file. This is the per-test - * sibling of {@link TestRunProfile.loadDetailedCoverage}, called only if - * a test item is provided in {@link FileCoverage.fromTests} and only for - * files where such data is reported. - * - * The editor will call this when user asks to view coverage for a test in - * a file, and the returned coverage information is used to display exactly - * what code was run by that test. - * - * The {@link FileCoverage} object passed to this function is the same - * instance emitted on {@link TestRun.addCoverage} calls associated with this profile. - * - * @param testRun The test run that generated the coverage data. - * @param fileCoverage The file coverage object to load detailed coverage for. - * @param fromTestItem The test item to request coverage information for. - * @param token A cancellation token that indicates the operation should be cancelled. - */ - loadDetailedCoverageForTest?: ( - testRun: TestRun, - fileCoverage: FileCoverage, - fromTestItem: TestItem, - token: CancellationToken, - ) => Thenable; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.authLearnMore.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.authLearnMore.d.ts deleted file mode 100644 index f604484b..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.authLearnMore.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module "vscode" { - // https://github.com/microsoft/vscode/issues/206587 - - export interface AuthenticationForceNewSessionOptions { - /** - * An optional Uri to open in the browser to learn more about this authentication request. - */ - learnMore?: Uri; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.authSession.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.authSession.d.ts deleted file mode 100644 index 04b968c8..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.authSession.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module "vscode" { - export namespace authentication { - /** - * @deprecated Use {@link getSession()} {@link AuthenticationGetSessionOptions.silent} instead. - */ - export function hasSession( - providerId: string, - scopes: readonly string[], - ): Thenable; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.canonicalUriProvider.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.canonicalUriProvider.d.ts deleted file mode 100644 index 292fdd1a..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.canonicalUriProvider.d.ts +++ /dev/null @@ -1,57 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module "vscode" { - // https://github.com/microsoft/vscode/issues/180582 - - export namespace workspace { - /** - * - * @param scheme The URI scheme that this provider can provide canonical URIs for. - * A canonical URI represents the conversion of a resource's alias into a source of truth URI. - * Multiple aliases may convert to the same source of truth URI. - * @param provider A provider which can convert URIs of scheme @param scheme to - * a canonical URI which is stable across machines. - */ - export function registerCanonicalUriProvider( - scheme: string, - provider: CanonicalUriProvider, - ): Disposable; - - /** - * - * @param uri The URI to provide a canonical URI for. - * @param token A cancellation token for the request. - */ - export function getCanonicalUri( - uri: Uri, - options: CanonicalUriRequestOptions, - token: CancellationToken, - ): ProviderResult; - } - - export interface CanonicalUriProvider { - /** - * - * @param uri The URI to provide a canonical URI for. - * @param options Options that the provider should honor in the URI it returns. - * @param token A cancellation token for the request. - * @returns The canonical URI for the requested URI or undefined if no canonical URI can be provided. - */ - provideCanonicalUri( - uri: Uri, - options: CanonicalUriRequestOptions, - token: CancellationToken, - ): ProviderResult; - } - - export interface CanonicalUriRequestOptions { - /** - * - * The desired scheme of the canonical URI. - */ - targetScheme: string; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.chatParticipantAdditions.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.chatParticipantAdditions.d.ts deleted file mode 100644 index 56b7f6d0..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.chatParticipantAdditions.d.ts +++ /dev/null @@ -1,527 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module "vscode" { - export interface ChatParticipant { - onDidPerformAction: Event; - } - - /** - * Now only used for the "intent detection" API below - */ - export interface ChatCommand { - readonly name: string; - readonly description: string; - } - - export class ChatResponseDetectedParticipantPart { - participant: string; - // TODO@API validate this against statically-declared slash commands? - command?: ChatCommand; - constructor(participant: string, command?: ChatCommand); - } - - export interface ChatVulnerability { - title: string; - description: string; - // id: string; // Later we will need to be able to link these across multiple content chunks. - } - - export class ChatResponseMarkdownWithVulnerabilitiesPart { - value: MarkdownString; - vulnerabilities: ChatVulnerability[]; - constructor( - value: string | MarkdownString, - vulnerabilities: ChatVulnerability[], - ); - } - - export class ChatResponseCodeblockUriPart { - value: Uri; - constructor(value: Uri); - } - - /** - * Displays a {@link Command command} as a button in the chat response. - */ - export interface ChatCommandButton { - command: Command; - } - - export interface ChatDocumentContext { - uri: Uri; - version: number; - ranges: Range[]; - } - - export class ChatResponseTextEditPart { - uri: Uri; - edits: TextEdit[]; - constructor(uri: Uri, edits: TextEdit | TextEdit[]); - } - - export class ChatResponseConfirmationPart { - title: string; - message: string; - data: any; - buttons?: string[]; - constructor( - title: string, - message: string, - data: any, - buttons?: string[], - ); - } - - export class ChatResponseCodeCitationPart { - value: Uri; - license: string; - snippet: string; - constructor(value: Uri, license: string, snippet: string); - } - - export type ExtendedChatResponsePart = - | ChatResponsePart - | ChatResponseTextEditPart - | ChatResponseDetectedParticipantPart - | ChatResponseConfirmationPart - | ChatResponseCodeCitationPart - | ChatResponseReferencePart2 - | ChatResponseMovePart; - - export class ChatResponseWarningPart { - value: MarkdownString; - constructor(value: string | MarkdownString); - } - - export class ChatResponseProgressPart2 extends ChatResponseProgressPart { - value: string; - task?: ( - progress: Progress< - ChatResponseWarningPart | ChatResponseReferencePart - >, - ) => Thenable; - constructor( - value: string, - task?: ( - progress: Progress< - ChatResponseWarningPart | ChatResponseReferencePart - >, - ) => Thenable, - ); - } - - export class ChatResponseReferencePart2 { - /** - * The reference target. - */ - value: - | Uri - | Location - | { variableName: string; value?: Uri | Location } - | string; - - /** - * The icon for the reference. - */ - iconPath?: - | Uri - | ThemeIcon - | { - /** - * The icon path for the light theme. - */ - light: Uri; - /** - * The icon path for the dark theme. - */ - dark: Uri; - }; - options?: { - status?: { - description: string; - kind: ChatResponseReferencePartStatusKind; - }; - }; - - /** - * Create a new ChatResponseReferencePart. - * @param value A uri or location - * @param iconPath Icon for the reference shown in UI - */ - constructor( - value: - | Uri - | Location - | { variableName: string; value?: Uri | Location } - | string, - iconPath?: - | Uri - | ThemeIcon - | { - /** - * The icon path for the light theme. - */ - light: Uri; - /** - * The icon path for the dark theme. - */ - dark: Uri; - }, - options?: { - status?: { - description: string; - kind: ChatResponseReferencePartStatusKind; - }; - }, - ); - } - - export class ChatResponseMovePart { - readonly uri: Uri; - readonly range: Range; - - constructor(uri: Uri, range: Range); - } - - export interface ChatResponseAnchorPart { - /** - * The target of this anchor. - * - * If this is a {@linkcode Uri} or {@linkcode Location}, this is rendered as a normal link. - * - * If this is a {@linkcode SymbolInformation}, this is rendered as a symbol link. - * - * TODO mjbvz: Should this be a full `SymbolInformation`? Or just the parts we need? - * TODO mjbvz: Should we allow a `SymbolInformation` without a location? For example, until `resolve` completes? - */ - value2: Uri | Location | SymbolInformation; - - /** - * Optional method which fills in the details of the anchor. - * - * THis is currently only implemented for symbol links. - */ - resolve?(token: CancellationToken): Thenable; - } - - export interface ChatResponseStream { - /** - * Push a progress part to this stream. Short-hand for - * `push(new ChatResponseProgressPart(value))`. - * - * @param value A progress message - * @param task If provided, a task to run while the progress is displayed. When the Thenable resolves, the progress will be marked complete in the UI, and the progress message will be updated to the resolved string if one is specified. - * @returns This stream. - */ - progress( - value: string, - task?: ( - progress: Progress< - ChatResponseWarningPart | ChatResponseReferencePart - >, - ) => Thenable, - ): void; - - textEdit(target: Uri, edits: TextEdit | TextEdit[]): void; - markdownWithVulnerabilities( - value: string | MarkdownString, - vulnerabilities: ChatVulnerability[], - ): void; - codeblockUri(uri: Uri): void; - detectedParticipant(participant: string, command?: ChatCommand): void; - push( - part: - | ChatResponsePart - | ChatResponseTextEditPart - | ChatResponseDetectedParticipantPart - | ChatResponseWarningPart - | ChatResponseProgressPart2, - ): void; - - /** - * Show an inline message in the chat view asking the user to confirm an action. - * Multiple confirmations may be shown per response. The UI might show "Accept All" / "Reject All" actions. - * @param title The title of the confirmation entry - * @param message An extra message to display to the user - * @param data An arbitrary JSON-stringifiable object that will be included in the ChatRequest when - * the confirmation is accepted or rejected - * TODO@API should this be MarkdownString? - * TODO@API should actually be a more generic function that takes an array of buttons - */ - confirmation( - title: string, - message: string, - data: any, - buttons?: string[], - ): void; - - /** - * Push a warning to this stream. Short-hand for - * `push(new ChatResponseWarningPart(message))`. - * - * @param message A warning message - * @returns This stream. - */ - warning(message: string | MarkdownString): void; - - reference( - value: - | Uri - | Location - | { variableName: string; value?: Uri | Location }, - iconPath?: Uri | ThemeIcon | { light: Uri; dark: Uri }, - ): void; - - reference2( - value: - | Uri - | Location - | string - | { variableName: string; value?: Uri | Location }, - iconPath?: Uri | ThemeIcon | { light: Uri; dark: Uri }, - options?: { - status?: { - description: string; - kind: ChatResponseReferencePartStatusKind; - }; - }, - ): void; - - codeCitation(value: Uri, license: string, snippet: string): void; - - push(part: ExtendedChatResponsePart): void; - } - - export enum ChatResponseReferencePartStatusKind { - Complete = 1, - Partial = 2, - Omitted = 3, - } - - /** - * Does this piggy-back on the existing ChatRequest, or is it a different type of request entirely? - * Does it show up in history? - */ - export interface ChatRequest { - /** - * The `data` for any confirmations that were accepted - */ - acceptedConfirmationData?: any[]; - - /** - * The `data` for any confirmations that were rejected - */ - rejectedConfirmationData?: any[]; - } - - // TODO@API fit this into the stream - export interface ChatUsedContext { - documents: ChatDocumentContext[]; - } - - export interface ChatParticipant { - /** - * Provide a set of variables that can only be used with this participant. - */ - participantVariableProvider?: { - provider: ChatParticipantCompletionItemProvider; - triggerCharacters: string[]; - }; - } - - export interface ChatParticipantCompletionItemProvider { - provideCompletionItems( - query: string, - token: CancellationToken, - ): ProviderResult; - } - - export class ChatCompletionItem { - id: string; - label: string | CompletionItemLabel; - values: ChatVariableValue[]; - fullName?: string; - icon?: ThemeIcon; - insertText?: string; - detail?: string; - documentation?: string | MarkdownString; - command?: Command; - - constructor( - id: string, - label: string | CompletionItemLabel, - values: ChatVariableValue[], - ); - } - - export type ChatExtendedRequestHandler = ( - request: ChatRequest, - context: ChatContext, - response: ChatResponseStream, - token: CancellationToken, - ) => ProviderResult; - - export interface ChatResult { - nextQuestion?: { - prompt: string; - participant?: string; - command?: string; - }; - } - - export namespace chat { - /** - * Create a chat participant with the extended progress type - */ - export function createChatParticipant( - id: string, - handler: ChatExtendedRequestHandler, - ): ChatParticipant; - - export function registerChatParticipantDetectionProvider( - participantDetectionProvider: ChatParticipantDetectionProvider, - ): Disposable; - } - - export interface ChatParticipantMetadata { - participant: string; - command?: string; - disambiguation: { - category: string; - description: string; - examples: string[]; - }[]; - } - - export interface ChatParticipantDetectionResult { - participant: string; - command?: string; - } - - export interface ChatParticipantDetectionProvider { - provideParticipantDetection( - chatRequest: ChatRequest, - context: ChatContext, - options: { - participants?: ChatParticipantMetadata[]; - location: ChatLocation; - }, - token: CancellationToken, - ): ProviderResult; - } - - /* - * User action events - */ - - export enum ChatCopyKind { - // Keyboard shortcut or context menu - Action = 1, - Toolbar = 2, - } - - export interface ChatCopyAction { - // eslint-disable-next-line local/vscode-dts-string-type-literals - kind: "copy"; - codeBlockIndex: number; - copyKind: ChatCopyKind; - copiedCharacters: number; - totalCharacters: number; - copiedText: string; - } - - export interface ChatInsertAction { - // eslint-disable-next-line local/vscode-dts-string-type-literals - kind: "insert"; - codeBlockIndex: number; - totalCharacters: number; - newFile?: boolean; - } - - export interface ChatApplyAction { - // eslint-disable-next-line local/vscode-dts-string-type-literals - kind: "apply"; - codeBlockIndex: number; - totalCharacters: number; - newFile?: boolean; - codeMapper?: string; - } - - export interface ChatTerminalAction { - // eslint-disable-next-line local/vscode-dts-string-type-literals - kind: "runInTerminal"; - codeBlockIndex: number; - languageId?: string; - } - - export interface ChatCommandAction { - // eslint-disable-next-line local/vscode-dts-string-type-literals - kind: "command"; - commandButton: ChatCommandButton; - } - - export interface ChatFollowupAction { - // eslint-disable-next-line local/vscode-dts-string-type-literals - kind: "followUp"; - followup: ChatFollowup; - } - - export interface ChatBugReportAction { - // eslint-disable-next-line local/vscode-dts-string-type-literals - kind: "bug"; - } - - export interface ChatEditorAction { - // eslint-disable-next-line local/vscode-dts-string-type-literals - kind: "editor"; - accepted: boolean; - } - - export interface ChatEditingSessionAction { - // eslint-disable-next-line local/vscode-dts-string-type-literals - kind: "chatEditingSessionAction"; - uri: Uri; - hasRemainingEdits: boolean; - outcome: ChatEditingSessionActionOutcome; - } - - export enum ChatEditingSessionActionOutcome { - Accepted = 1, - Rejected = 2, - } - - export interface ChatUserActionEvent { - readonly result: ChatResult; - readonly action: - | ChatCopyAction - | ChatInsertAction - | ChatApplyAction - | ChatTerminalAction - | ChatCommandAction - | ChatFollowupAction - | ChatBugReportAction - | ChatEditorAction - | ChatEditingSessionAction; - } - - export interface ChatPromptReference { - /** - * TODO Needed for now to drive the variableName-type reference, but probably both of these should go away in the future. - */ - readonly name: string; - } - - export interface ChatResultFeedback { - readonly unhelpfulReason?: string; - } - - export namespace lm { - export function fileIsIgnored( - uri: Uri, - token: CancellationToken, - ): Thenable; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.chatParticipantPrivate.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.chatParticipantPrivate.d.ts deleted file mode 100644 index 9f8f0e6b..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.chatParticipantPrivate.d.ts +++ /dev/null @@ -1,134 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -// version: 2 - -declare module "vscode" { - /** - * The location at which the chat is happening. - */ - export enum ChatLocation { - /** - * The chat panel - */ - Panel = 1, - /** - * Terminal inline chat - */ - Terminal = 2, - /** - * Notebook inline chat - */ - Notebook = 3, - /** - * Code editor inline chat - */ - Editor = 4, - /** - * Chat is happening in an editing session - */ - EditingSession = 5, - } - - export class ChatRequestEditorData { - //TODO@API should be the editor - document: TextDocument; - selection: Selection; - wholeRange: Range; - - constructor( - document: TextDocument, - selection: Selection, - wholeRange: Range, - ); - } - - export class ChatRequestNotebookData { - //TODO@API should be the editor - readonly cell: TextDocument; - - constructor(cell: TextDocument); - } - - export interface ChatRequest { - /** - * The attempt number of the request. The first request has attempt number 0. - */ - readonly attempt: number; - - /** - * If automatic command detection is enabled. - */ - readonly enableCommandDetection: boolean; - - /** - * If the chat participant or command was automatically assigned. - */ - readonly isParticipantDetected: boolean; - - /** - * The location at which the chat is happening. This will always be one of the supported values - * - * @deprecated - */ - readonly location: ChatLocation; - - /** - * Information that is specific to the location at which chat is happening, e.g within a document, notebook, - * or terminal. Will be `undefined` for the chat panel. - */ - readonly location2: - | ChatRequestEditorData - | ChatRequestNotebookData - | undefined; - } - - export interface ChatParticipant { - supportIssueReporting?: boolean; - - /** - * Temp, support references that are slow to resolve and should be tools rather than references. - */ - supportsSlowReferences?: boolean; - } - - export interface ChatErrorDetails { - /** - * If set to true, the message content is completely hidden. Only ChatErrorDetails#message will be shown. - */ - responseIsRedacted?: boolean; - } - - export namespace chat { - export function createDynamicChatParticipant( - id: string, - dynamicProps: DynamicChatParticipantProps, - handler: ChatExtendedRequestHandler, - ): ChatParticipant; - } - - /** - * These don't get set on the ChatParticipant after creation, like other props, because they are typically defined in package.json and we want them at the time of creation. - */ - export interface DynamicChatParticipantProps { - name: string; - publisherName: string; - description?: string; - fullName?: string; - } - - export namespace lm { - export function registerIgnoredFileProvider( - provider: LanguageModelIgnoredFileProvider, - ): Disposable; - } - - export interface LanguageModelIgnoredFileProvider { - provideFileIgnored( - uri: Uri, - token: CancellationToken, - ): ProviderResult; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.chatProvider.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.chatProvider.d.ts deleted file mode 100644 index eb4431d4..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.chatProvider.d.ts +++ /dev/null @@ -1,112 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module "vscode" { - export interface ChatResponseFragment { - index: number; - part: string; - } - - export interface ChatResponseFragment2 { - index: number; - part: LanguageModelTextPart | LanguageModelToolCallPart; - } - - // @API extension ship a d.ts files for their options - - /** - * Represents a large language model that accepts ChatML messages and produces a streaming response - */ - export interface LanguageModelChatProvider { - onDidReceiveLanguageModelResponse2?: Event<{ - readonly extensionId: string; - readonly participant?: string; - readonly tokenCount?: number; - }>; - - provideLanguageModelResponse( - messages: LanguageModelChatMessage[], - options: LanguageModelChatRequestOptions, - extensionId: string, - progress: Progress, - token: CancellationToken, - ): Thenable; - - /** @deprecated */ - provideLanguageModelResponse2?( - messages: LanguageModelChatMessage[], - options: LanguageModelChatRequestOptions, - extensionId: string, - progress: Progress, - token: CancellationToken, - ): Thenable; - - provideTokenCount( - text: string | LanguageModelChatMessage, - token: CancellationToken, - ): Thenable; - } - - export type ChatResponseProvider = LanguageModelChatProvider; - - export interface ChatResponseProviderMetadata { - readonly vendor: string; - - /** - * Human-readable name of the language model. - */ - readonly name: string; - /** - * Opaque family-name of the language model. Values might be `gpt-3.5-turbo`, `gpt4`, `phi2`, or `llama` - * but they are defined by extensions contributing languages and subject to change. - */ - readonly family: string; - - /** - * Opaque version string of the model. This is defined by the extension contributing the language model - * and subject to change while the identifier is stable. - */ - readonly version: string; - - readonly maxInputTokens: number; - - readonly maxOutputTokens: number; - - /** - * When present, this gates the use of `requestLanguageModelAccess` behind an authorization flow where - * the user must approve of another extension accessing the models contributed by this extension. - * Additionally, the extension can provide a label that will be shown in the UI. - */ - auth?: true | { label: string }; - - // TODO@API maybe an enum, LanguageModelChatProviderPickerAvailability? - readonly isDefault?: boolean; - readonly isUserSelectable?: boolean; - } - - export interface ChatResponseProviderMetadata { - // limit this provider to some extensions - extensions?: string[]; - } - - export namespace chat { - /** - * @deprecated use `lm.registerChatResponseProvider` instead - */ - export function registerChatResponseProvider( - id: string, - provider: ChatResponseProvider, - metadata: ChatResponseProviderMetadata, - ): Disposable; - } - - export namespace lm { - export function registerChatModelProvider( - id: string, - provider: LanguageModelChatProvider, - metadata: ChatResponseProviderMetadata, - ): Disposable; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.chatReferenceBinaryData.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.chatReferenceBinaryData.d.ts deleted file mode 100644 index 66868b4f..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.chatReferenceBinaryData.d.ts +++ /dev/null @@ -1,37 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module "vscode" { - export interface ChatPromptReference { - /** - * The value of this reference. The `string | Uri | Location` types are used today, but this could expand in the future. - */ - readonly value: - | string - | Uri - | Location - | ChatReferenceBinaryData - | unknown; - } - - export class ChatReferenceBinaryData { - /** - * The MIME type of the binary data. - */ - readonly mimeType: string; - - /** - * Retrieves the binary data of the reference. - * @returns A promise that resolves to the binary data as a Uint8Array. - */ - data(): Thenable; - - /** - * @param mimeType The MIME type of the binary data. - * @param data The binary data of the reference. - */ - constructor(mimeType: string, data: () => Thenable); - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.chatTab.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.chatTab.d.ts deleted file mode 100644 index 94d068aa..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.chatTab.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module "vscode" { - /** - * The tab represents an interactive window. - */ - export class TabInputChat { - constructor(); - } - - export interface Tab { - readonly input: - | TabInputText - | TabInputTextDiff - | TabInputCustom - | TabInputWebview - | TabInputNotebook - | TabInputNotebookDiff - | TabInputTerminal - | TabInputChat - | unknown; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.chatVariableResolver.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.chatVariableResolver.d.ts deleted file mode 100644 index ec386ec9..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.chatVariableResolver.d.ts +++ /dev/null @@ -1,110 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module 'vscode' { - - export namespace chat { - - /** - * Register a variable which can be used in a chat request to any participant. - * @param id A unique ID for the variable. - * @param name The name of the variable, to be used in the chat input as `#name`. - * @param userDescription A description of the variable for the chat input suggest widget. - * @param modelDescription A description of the variable for the model. - * @param isSlow Temp, to limit access to '#codebase' which is not a 'reference' and will fit into a tools API later. - * @param resolver Will be called to provide the chat variable's value when it is used. - * @param fullName The full name of the variable when selecting context in the picker UI. - * @param icon An icon to display when selecting context in the picker UI. - */ - export function registerChatVariableResolver(id: string, name: string, userDescription: string, modelDescription: string | undefined, isSlow: boolean | undefined, resolver: ChatVariableResolver, fullName?: string, icon?: ThemeIcon): Disposable; - } - - export interface ChatVariableValue { - /** - * The detail level of this chat variable value. If possible, variable resolvers should try to offer shorter values that will consume fewer tokens in an LLM prompt. - */ - level: ChatVariableLevel; - - /** - * The variable's value, which can be included in an LLM prompt as-is, or the chat participant may decide to read the value and do something else with it. - */ - value: string | Uri; - - /** - * A description of this value, which could be provided to the LLM as a hint. - */ - description?: string; - } - - // TODO@API align with ChatRequest - export interface ChatVariableContext { - /** - * The message entered by the user, which includes this variable. - */ - // TODO@API AS-IS, variables as types, agent/commands stripped - prompt: string; - - // readonly variables: readonly ChatResolvedVariable[]; - } - - export interface ChatVariableResolver { - /** - * A callback to resolve the value of a chat variable. - * @param name The name of the variable. - * @param context Contextual information about this chat request. - * @param token A cancellation token. - */ - resolve(name: string, context: ChatVariableContext, token: CancellationToken): ProviderResult; - - /** - * A callback to resolve the value of a chat variable. - * @param name The name of the variable. - * @param context Contextual information about this chat request. - * @param token A cancellation token. - */ - resolve2?(name: string, context: ChatVariableContext, stream: ChatVariableResolverResponseStream, token: CancellationToken): ProviderResult; - } - - - /** - * The detail level of this chat variable value. - */ - export enum ChatVariableLevel { - Short = 1, - Medium = 2, - Full = 3 - } - - export interface ChatVariableResolverResponseStream { - /** - * Push a progress part to this stream. Short-hand for - * `push(new ChatResponseProgressPart(value))`. - * - * @param value - * @returns This stream. - */ - progress(value: string): ChatVariableResolverResponseStream; - - /** - * Push a reference to this stream. Short-hand for - * `push(new ChatResponseReferencePart(value))`. - * - * *Note* that the reference is not rendered inline with the response. - * - * @param value A uri or location - * @returns This stream. - */ - reference(value: Uri | Location): ChatVariableResolverResponseStream; - - /** - * Pushes a part to this stream. - * - * @param part A response part, rendered or metadata - */ - push(part: ChatVariableResolverResponsePart): ChatVariableResolverResponseStream; - } - - export type ChatVariableResolverResponsePart = ChatResponseProgressPart | ChatResponseReferencePart; -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.codeActionAI.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.codeActionAI.d.ts deleted file mode 100644 index f6d7817e..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.codeActionAI.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module 'vscode' { - - export interface CodeAction { - /** - * Marks this as an AI action. - * - * Ex: A quick fix should be marked AI if it invokes AI. - */ - isAI?: boolean; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.codeActionRanges.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.codeActionRanges.d.ts deleted file mode 100644 index 350be2d5..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.codeActionRanges.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module 'vscode' { - - export interface CodeAction { - /** - * The ranges to which this Code Action applies to, which will be highlighted. - * For example: A refactoring action will highlight the range of text that will be affected. - */ - ranges?: Range[]; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.codiconDecoration.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.codiconDecoration.d.ts deleted file mode 100644 index 2a0fc457..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.codiconDecoration.d.ts +++ /dev/null @@ -1,48 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module 'vscode' { - - // https://github.com/microsoft/vscode/issues/135591 @alexr00 - - // export interface FileDecorationProvider { - // provideFileDecoration(uri: Uri, token: CancellationToken): ProviderResult; - // } - - /** - * A file decoration represents metadata that can be rendered with a file. - */ - export class FileDecoration2 { - /** - * A very short string that represents this decoration. - */ - badge?: string | ThemeIcon; - - /** - * A human-readable tooltip for this decoration. - */ - tooltip?: string; - - /** - * The color of this decoration. - */ - color?: ThemeColor; - - /** - * A flag expressing that this decoration should be - * propagated to its parents. - */ - propagate?: boolean; - - /** - * Creates a new decoration. - * - * @param badge A letter that represents the decoration. - * @param tooltip The tooltip of the decoration. - * @param color The color of the decoration. - */ - constructor(badge?: string | ThemeIcon, tooltip?: string, color?: ThemeColor); - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.commentReactor.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.commentReactor.d.ts deleted file mode 100644 index 25a433cd..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.commentReactor.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module 'vscode' { - - // @alexr00 https://github.com/microsoft/vscode/issues/201131 - - export interface CommentReaction { - readonly reactors?: readonly CommentAuthorInformation[]; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.commentReveal.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.commentReveal.d.ts deleted file mode 100644 index 3aa005d0..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.commentReveal.d.ts +++ /dev/null @@ -1,45 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module 'vscode' { - - // @alexr00 https://github.com/microsoft/vscode/issues/167253 - - export enum CommentThreadFocus { - /** - * Focus the comment editor if the thread supports replying. - */ - Reply = 1, - /** - * Focus the revealed comment. - */ - Comment = 2 - } - - /** - * Options to reveal a comment thread in an editor. - */ - export interface CommentThreadRevealOptions { - - /** - * Where to move the focus to when revealing the comment thread. - * If undefined, the focus will not be changed. - */ - focus?: CommentThreadFocus; - } - - export interface CommentThread2 { - /** - * Reveal the comment thread in an editor. If no comment is provided, the first comment in the thread will be revealed. - */ - reveal(comment?: Comment, options?: CommentThreadRevealOptions): Thenable; - - /** - * Collapse the comment thread in an editor. - */ - hide(): Thenable; - } - -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.commentThreadApplicability.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.commentThreadApplicability.d.ts deleted file mode 100644 index 7a3faf6d..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.commentThreadApplicability.d.ts +++ /dev/null @@ -1,44 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module "vscode" { - // @alexr00 https://github.com/microsoft/vscode/issues/207402 - - export enum CommentThreadApplicability { - Current = 0, - Outdated = 1, - } - - export interface CommentThread2 { - /* @api this is a bit weird for the extension now. The CommentThread is a managed object, which means it listens - * to when it's properties are set, but not if it's properties are modified. This means that this will not work to update the resolved state - * - * thread.state.resolved = CommentThreadState.Resolved; - * - * but this will work - * - * thread.state = { - * resolved: CommentThreadState.Resolved - * applicability: thread.state.applicability - * }; - * - * Worth noting that we already have this problem for the `comments` property. - */ - state?: - | CommentThreadState - | { - resolved?: CommentThreadState; - applicability?: CommentThreadApplicability; - }; - readonly uri: Uri; - range: Range | undefined; - comments: readonly Comment[]; - collapsibleState: CommentThreadCollapsibleState; - canReply: boolean; - contextValue?: string; - label?: string; - dispose(): void; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.commentingRangeHint.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.commentingRangeHint.d.ts deleted file mode 100644 index 595e4f0f..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.commentingRangeHint.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module 'vscode' { - - // @alexr00 https://github.com/microsoft/vscode/issues/185551 - - /** - * Commenting range provider for a {@link CommentController comment controller}. - */ - export interface CommentingRangeProvider { - readonly resourceHints?: { schemes: readonly string[] }; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.commentsDraftState.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.commentsDraftState.d.ts deleted file mode 100644 index ee411309..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.commentsDraftState.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module 'vscode' { - - // https://github.com/microsoft/vscode/issues/171166 - - export enum CommentState { - Published = 0, - Draft = 1 - } - - export interface Comment { - state?: CommentState; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.contribAccessibilityHelpContent.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.contribAccessibilityHelpContent.d.ts deleted file mode 100644 index c04a0c65..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.contribAccessibilityHelpContent.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -// empty placeholder declaration for the `accessibilityHelpContent`-property of the `views`-contribution - -// https://github.com/microsoft/vscode/issues/209855 @meganrogge - -/** - * View contributions can include an `accessibilityHelpContent` property that provides help content for screen readers - * when the accessibility help dialog is invoked by the user with focus in the view. - * - * The content is provided as a markdown string and can contain commands that will be resolved along with their keybindings. - */ diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.contribCommentEditorActionsMenu.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.contribCommentEditorActionsMenu.d.ts deleted file mode 100644 index 9b24bcc3..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.contribCommentEditorActionsMenu.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -// empty placeholder declaration for the `comments/comment/editorActions` menu diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.contribCommentPeekContext.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.contribCommentPeekContext.d.ts deleted file mode 100644 index c51c68fc..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.contribCommentPeekContext.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -// empty placeholder for comment peek context menus - -// https://github.com/microsoft/vscode/issues/151533 @alexr00 diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.contribCommentThreadAdditionalMenu.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.contribCommentThreadAdditionalMenu.d.ts deleted file mode 100644 index 2e71d90a..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.contribCommentThreadAdditionalMenu.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -// empty placeholder for comment thread additional menus - -// https://github.com/microsoft/vscode/issues/163281 diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.contribCommentsViewThreadMenus.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.contribCommentsViewThreadMenus.d.ts deleted file mode 100644 index 9dc199c5..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.contribCommentsViewThreadMenus.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -// empty placeholder declaration for the `commentsView/commentThread/context` menu contribution point diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.contribDebugCreateConfiguration.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.contribDebugCreateConfiguration.d.ts deleted file mode 100644 index 9f866269..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.contribDebugCreateConfiguration.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -// empty placeholder declaration for the `debugCreateConfiguation` menu diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.contribDiffEditorGutterToolBarMenus.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.contribDiffEditorGutterToolBarMenus.d.ts deleted file mode 100644 index f6fb8c9f..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.contribDiffEditorGutterToolBarMenus.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -// empty placeholder declaration for `diffEditor/gutter/*` menus diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.contribEditSessions.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.contribEditSessions.d.ts deleted file mode 100644 index a1285691..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.contribEditSessions.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -// empty placeholder for edit sessions contribution point from core - -// https://github.com/microsoft/vscode/issues/157734 @joyceerhl diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.contribEditorContentMenu.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.contribEditorContentMenu.d.ts deleted file mode 100644 index 6b45f346..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.contribEditorContentMenu.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -// empty placeholder declaration for the `editor/content` menu diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.contribIssueReporter.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.contribIssueReporter.d.ts deleted file mode 100644 index 522d3334..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.contribIssueReporter.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -// empty placeholder declaration for the `issue reporter`-submenu contribution point -// https://github.com/microsoft/vscode/issues/196863 diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.contribLabelFormatterWorkspaceTooltip.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.contribLabelFormatterWorkspaceTooltip.d.ts deleted file mode 100644 index 90814eb2..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.contribLabelFormatterWorkspaceTooltip.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -// empty placeholder declaration for the `workspaceTooltip`-property of the `resourceLabelFormatters` contribution poain diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.contribMenuBarHome.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.contribMenuBarHome.d.ts deleted file mode 100644 index caa0ff22..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.contribMenuBarHome.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -// empty placeholder declaration for the `menuBar/home` menu diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.contribMergeEditorMenus.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.contribMergeEditorMenus.d.ts deleted file mode 100644 index 6a6e5c22..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.contribMergeEditorMenus.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -// empty placeholder declaration for `mergeEditor/*` menus diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.contribMultiDiffEditorMenus.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.contribMultiDiffEditorMenus.d.ts deleted file mode 100644 index 6641a006..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.contribMultiDiffEditorMenus.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -// empty placeholder declaration for `multiDiffEditor/*` menus diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.contribNotebookStaticPreloads.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.contribNotebookStaticPreloads.d.ts deleted file mode 100644 index b01c68eb..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.contribNotebookStaticPreloads.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -// empty placeholder declaration for the `notebookPreload` contribution point diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.contribRemoteHelp.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.contribRemoteHelp.d.ts deleted file mode 100644 index f577e0da..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.contribRemoteHelp.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -// empty placeholder declaration for the `remoteHelp`-contribution point diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.contribShareMenu.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.contribShareMenu.d.ts deleted file mode 100644 index e308029d..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.contribShareMenu.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -// empty placeholder declaration for the `file/share`-submenu contribution point -// https://github.com/microsoft/vscode/issues/176316 diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.contribSourceControlHistoryItemMenu.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.contribSourceControlHistoryItemMenu.d.ts deleted file mode 100644 index 44bfaf17..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.contribSourceControlHistoryItemMenu.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -// empty placeholder declaration for the `scm/historyItem/context`-menu contribution point -// https://github.com/microsoft/vscode/issues/201997 diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.contribSourceControlHistoryTitleMenu.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.contribSourceControlHistoryTitleMenu.d.ts deleted file mode 100644 index 605348a6..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.contribSourceControlHistoryTitleMenu.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -// empty placeholder declaration for the `scm/history/title`-menu contribution point -// https://github.com/microsoft/vscode/issues/226144 diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.contribSourceControlInputBoxMenu.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.contribSourceControlInputBoxMenu.d.ts deleted file mode 100644 index 44da3d0a..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.contribSourceControlInputBoxMenu.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -// empty placeholder declaration for the `scm/inputBox`-menu contribution point -// https://github.com/microsoft/vscode/issues/195474 diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.contribSourceControlTitleMenu.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.contribSourceControlTitleMenu.d.ts deleted file mode 100644 index af1aa65e..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.contribSourceControlTitleMenu.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -// empty placeholder declaration for the `scm/sourceControl/title`-menu contribution point -// https://github.com/microsoft/vscode/issues/203511 diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.contribStatusBarItems.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.contribStatusBarItems.d.ts deleted file mode 100644 index 2e5a578d..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.contribStatusBarItems.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -// empty placeholder for status bar items contribution - -// https://github.com/microsoft/vscode/issues/167874 @jrieken diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.contribViewContainerTitle.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.contribViewContainerTitle.d.ts deleted file mode 100644 index 3983df4c..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.contribViewContainerTitle.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -// empty placeholder for view container title menus - -// https://github.com/microsoft/vscode/issues/200880 @roblourens diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.contribViewsRemote.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.contribViewsRemote.d.ts deleted file mode 100644 index b1e6ca3d..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.contribViewsRemote.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -// empty placeholder declaration for the `remote`-property of the `views`-contribution diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.contribViewsWelcome.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.contribViewsWelcome.d.ts deleted file mode 100644 index 616694eb..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.contribViewsWelcome.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -// empty placeholder declaration for the `viewsWelcome`-contribution point diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.createFileSystemWatcher.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.createFileSystemWatcher.d.ts deleted file mode 100644 index 8fe97ca7..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.createFileSystemWatcher.d.ts +++ /dev/null @@ -1,51 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -// https://github.com/microsoft/vscode/issues/169724 @bpasero - -declare module "vscode" { - export interface FileSystemWatcherOptions { - /** - * Ignore when files have been created. - */ - readonly ignoreCreateEvents?: boolean; - - /** - * Ignore when files have been changed. - */ - readonly ignoreChangeEvents?: boolean; - - /** - * Ignore when files have been deleted. - */ - readonly ignoreDeleteEvents?: boolean; - - /** - * An optional set of glob patterns to exclude from watching. - * Glob patterns are always matched relative to the watched folder. - */ - readonly excludes: string[]; - } - - export namespace workspace { - /** - * A variant of {@link workspace.createFileSystemWatcher} that optionally allows to specify - * a set of glob patterns to exclude from watching. - * - * It provides the following advantages over the other {@link workspace.createFileSystemWatcher} - * method: - * - the configured excludes from `files.watcherExclude` setting are NOT applied - * - requests for recursive file watchers inside the opened workspace are NOT ignored - * - the watcher is ONLY notified for events from this request and not from any other watcher - * - * As such, this method is prefered in cases where you want full control over the watcher behavior - * without being impacted by settings or other watchers that are installed. - */ - export function createFileSystemWatcher( - pattern: RelativePattern, - options?: FileSystemWatcherOptions, - ): FileSystemWatcher; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.customEditorMove.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.customEditorMove.d.ts deleted file mode 100644 index 48474d6f..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.customEditorMove.d.ts +++ /dev/null @@ -1,31 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module "vscode" { - // https://github.com/microsoft/vscode/issues/86146 - - // TODO: Also for custom editor - - export interface CustomTextEditorProvider { - /** - * Handle when the underlying resource for a custom editor is renamed. - * - * This allows the webview for the editor be preserved throughout the rename. If this method is not implemented, - * the editor will destroy the previous custom editor and create a replacement one. - * - * @param newDocument New text document to use for the custom editor. - * @param existingWebviewPanel Webview panel for the custom editor. - * @param token A cancellation token that indicates the result is no longer needed. - * - * @return Thenable indicating that the webview editor has been moved. - */ - // eslint-disable-next-line local/vscode-dts-provider-naming - moveCustomTextEditor?( - newDocument: TextDocument, - existingWebviewPanel: WebviewPanel, - token: CancellationToken, - ): Thenable; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.debugVisualization.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.debugVisualization.d.ts deleted file mode 100644 index 750634a5..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.debugVisualization.d.ts +++ /dev/null @@ -1,177 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module "vscode" { - export namespace debug { - /** - * Registers a custom data visualization for variables when debugging. - * - * @param id The corresponding ID in the package.json `debugVisualizers` contribution point. - * @param provider The {@link DebugVisualizationProvider} to register - */ - export function registerDebugVisualizationProvider< - T extends DebugVisualization, - >(id: string, provider: DebugVisualizationProvider): Disposable; - - /** - * Registers a tree that can be referenced by {@link DebugVisualization.visualization}. - * @param id - * @param provider - */ - export function registerDebugVisualizationTreeProvider< - T extends DebugTreeItem, - >(id: string, provider: DebugVisualizationTree): Disposable; - } - - /** - * An item from the {@link DebugVisualizationTree} - */ - export interface DebugTreeItem { - /** - * A human-readable string describing this item. - */ - label: string; - - /** - * A human-readable string which is rendered less prominent. - */ - description?: string; - - /** - * {@link TreeItemCollapsibleState} of the tree item. - */ - collapsibleState?: TreeItemCollapsibleState; - - /** - * Context value of the tree item. This can be used to contribute item specific actions in the tree. - * For example, a tree item is given a context value as `folder`. When contributing actions to `view/item/context` - * using `menus` extension point, you can specify context value for key `viewItem` in `when` expression like `viewItem == folder`. - * ```json - * "contributes": { - * "menus": { - * "view/item/context": [ - * { - * "command": "extension.deleteFolder", - * "when": "viewItem == folder" - * } - * ] - * } - * } - * ``` - * This will show action `extension.deleteFolder` only for items with `contextValue` is `folder`. - */ - contextValue?: string; - - /** - * Whether this item can be edited by the user. - */ - canEdit?: boolean; - } - - /** - * Provides a tree that can be referenced in debug visualizations. - */ - export interface DebugVisualizationTree< - T extends DebugTreeItem = DebugTreeItem, - > { - /** - * Gets the tree item for an element or the base context item. - */ - getTreeItem(context: DebugVisualizationContext): ProviderResult; - /** - * Gets children for the tree item or the best context item. - */ - getChildren(element: T): ProviderResult; - /** - * Handles the user editing an item. - */ - editItem?(item: T, value: string): ProviderResult; - } - - export class DebugVisualization { - /** - * The name of the visualization to show to the user. - */ - name: string; - - /** - * An icon for the view when it's show in inline actions. - */ - iconPath?: Uri | { light: Uri; dark: Uri } | ThemeIcon; - - /** - * Visualization to use for the variable. This may be either: - * - A command to run when the visualization is selected for a variable. - * - A reference to a previously-registered {@link DebugVisualizationTree} - */ - visualization?: Command | { treeId: string }; - - /** - * Creates a new debug visualization object. - * @param name Name of the visualization to show to the user. - */ - constructor(name: string); - } - - export interface DebugVisualizationProvider< - T extends DebugVisualization = DebugVisualization, - > { - /** - * Called for each variable when the debug session stops. It should return - * any visualizations the extension wishes to show to the user. - * - * Note that this is only called when its `when` clause defined under the - * `debugVisualizers` contribution point in the `package.json` evaluates - * to true. - */ - provideDebugVisualization( - context: DebugVisualizationContext, - token: CancellationToken, - ): ProviderResult; - - /** - * Invoked for a variable when a user picks the visualizer. - * - * It may return a {@link TreeView} that's shown in the Debug Console or - * inline in a hover. A visualizer may choose to return `undefined` from - * this function and instead trigger other actions in the UI, such as opening - * a custom {@link WebviewView}. - */ - resolveDebugVisualization?( - visualization: T, - token: CancellationToken, - ): ProviderResult; - } - - export interface DebugVisualizationContext { - /** - * The Debug Adapter Protocol Variable to be visualized. - * @see https://microsoft.github.io/debug-adapter-protocol/specification#Types_Variable - */ - variable: any; - /** - * The Debug Adapter Protocol variable reference the type (such as a scope - * or another variable) that contained this one. Empty for variables - * that came from user evaluations in the Debug Console. - * @see https://microsoft.github.io/debug-adapter-protocol/specification#Types_Variable - */ - containerId?: number; - /** - * The ID of the Debug Adapter Protocol StackFrame in which the variable was found, - * for variables that came from scopes in a stack frame. - * @see https://microsoft.github.io/debug-adapter-protocol/specification#Types_StackFrame - */ - frameId?: number; - /** - * The ID of the Debug Adapter Protocol Thread in which the variable was found. - * @see https://microsoft.github.io/debug-adapter-protocol/specification#Types_StackFrame - */ - threadId: number; - /** - * The debug session the variable belongs to. - */ - session: DebugSession; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.defaultChatParticipant.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.defaultChatParticipant.d.ts deleted file mode 100644 index 34c0804b..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.defaultChatParticipant.d.ts +++ /dev/null @@ -1,70 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -// version: 2 - -declare module "vscode" { - export interface ChatWelcomeMessageContent { - icon: ThemeIcon; - title: string; - message: MarkdownString; - } - - export interface ChatWelcomeMessageProvider { - provideWelcomeMessage?( - token: CancellationToken, - ): ProviderResult; - provideSampleQuestions?( - location: ChatLocation, - token: CancellationToken, - ): ProviderResult; - } - - export interface ChatRequesterInformation { - name: string; - - /** - * A full URI for the icon of the request. - */ - icon?: Uri; - } - - export interface ChatTitleProvider { - /** - * TODO@API Should this take a ChatResult like the followup provider, or just take a new ChatContext that includes the current message as history? - */ - provideChatTitle( - context: ChatContext, - token: CancellationToken, - ): ProviderResult; - } - - export interface ChatParticipant { - /** - * When true, this participant is invoked when the user submits their query using ctrl/cmd+enter - * TODO@API name - */ - isSecondary?: boolean; - - /** - * A string that will be added before the listing of chat participants in `/help`. - */ - helpTextPrefix?: string | MarkdownString; - - /** - * A string that will be added before the listing of chat variables in `/help`. - */ - helpTextVariablesPrefix?: string | MarkdownString; - - /** - * A string that will be appended after the listing of chat participants in `/help`. - */ - helpTextPostfix?: string | MarkdownString; - - welcomeMessageProvider?: ChatWelcomeMessageProvider; - titleProvider?: ChatTitleProvider; - requester?: ChatRequesterInformation; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.diffCommand.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.diffCommand.d.ts deleted file mode 100644 index ad892db3..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.diffCommand.d.ts +++ /dev/null @@ -1,40 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module "vscode" { - // https://github.com/microsoft/vscode/issues/84899 - - /** - * The contiguous set of modified lines in a diff. - */ - export interface LineChange { - readonly originalStartLineNumber: number; - readonly originalEndLineNumber: number; - readonly modifiedStartLineNumber: number; - readonly modifiedEndLineNumber: number; - } - - export namespace commands { - /** - * Registers a diff information command that can be invoked via a keyboard shortcut, - * a menu item, an action, or directly. - * - * Diff information commands are different from ordinary {@link commands.registerCommand commands} as - * they only execute when there is an active diff editor when the command is called, and the diff - * information has been computed. Also, the command handler of an editor command has access to - * the diff information. - * - * @param command A unique identifier for the command. - * @param callback A command handler function with access to the {@link LineChange diff information}. - * @param thisArg The `this` context used when invoking the handler function. - * @return Disposable which unregisters this command on disposal. - */ - export function registerDiffInformationCommand( - command: string, - callback: (diff: LineChange[], ...args: any[]) => any, - thisArg?: any, - ): Disposable; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.diffContentOptions.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.diffContentOptions.d.ts deleted file mode 100644 index e8d3e171..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.diffContentOptions.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module "vscode" { - // TODO@rebornix: add github issue link - - export interface NotebookDocumentContentOptions { - /** - * Controls if a cell metadata property should be reverted when the cell content - * is reverted in notebook diff editor. - */ - cellContentMetadata?: { [key: string]: boolean | undefined }; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.documentFiltersExclusive.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.documentFiltersExclusive.d.ts deleted file mode 100644 index ed5d17b3..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.documentFiltersExclusive.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module "vscode" { - // todo@jrieken add issue reference - - export interface DocumentFilter { - readonly exclusive?: boolean; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.documentPaste.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.documentPaste.d.ts deleted file mode 100644 index db66d147..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.documentPaste.d.ts +++ /dev/null @@ -1,332 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module "vscode" { - // https://github.com/microsoft/vscode/issues/30066/ - - /** - * Identifies a {@linkcode DocumentDropEdit} or {@linkcode DocumentPasteEdit} - */ - class DocumentDropOrPasteEditKind { - static readonly Empty: DocumentDropOrPasteEditKind; - - private constructor(value: string); - - /** - * The raw string value of the kind. - */ - readonly value: string; - - /** - * Create a new kind by appending additional scopes to the current kind. - * - * Does not modify the current kind. - */ - append(...parts: string[]): DocumentDropOrPasteEditKind; - - /** - * Checks if this kind intersects `other`. - * - * The kind `"text.plain"` for example intersects `text`, `"text.plain"` and `"text.plain.list"`, - * but not `"unicorn"`, or `"textUnicorn.plain"`. - * - * @param other Kind to check. - */ - intersects(other: DocumentDropOrPasteEditKind): boolean; - - /** - * Checks if `other` is a sub-kind of this `DocumentDropOrPasteEditKind`. - * - * The kind `"text.plain"` for example contains `"text.plain"` and `"text.plain.list"`, - * but not `"text"` or `"unicorn.text.plain"`. - * - * @param other Kind to check. - */ - contains(other: DocumentDropOrPasteEditKind): boolean; - } - - /** - * The reason why paste edits were requested. - */ - export enum DocumentPasteTriggerKind { - /** - * Pasting was requested as part of a normal paste operation. - */ - Automatic = 0, - - /** - * Pasting was requested by the user with the `paste as` command. - */ - PasteAs = 1, - } - - /** - * Additional information about the paste operation. - */ - - export interface DocumentPasteEditContext { - /** - * Requested kind of paste edits to return. - */ - readonly only: DocumentDropOrPasteEditKind | undefined; - - /** - * The reason why paste edits were requested. - */ - readonly triggerKind: DocumentPasteTriggerKind; - } - - /** - * Provider invoked when the user copies or pastes in a {@linkcode TextDocument}. - */ - interface DocumentPasteEditProvider< - T extends DocumentPasteEdit = DocumentPasteEdit, - > { - /** - * Optional method invoked after the user copies from a {@link TextEditor text editor}. - * - * This allows the provider to attach metadata about the copied text to the {@link DataTransfer}. This data - * transfer is then passed back to providers in {@linkcode provideDocumentPasteEdits}. - * - * Note that currently any changes to the {@linkcode DataTransfer} are isolated to the current editor window. - * This means that any added metadata cannot be seen by other editor windows or by other applications. - * - * @param document Text document where the copy took place. - * @param ranges Ranges being copied in {@linkcode document}. - * @param dataTransfer The data transfer associated with the copy. You can store additional values on this for - * later use in {@linkcode provideDocumentPasteEdits}. This object is only valid for the duration of this method. - * @param token A cancellation token. - * - * @return Optional thenable that resolves when all changes to the `dataTransfer` are complete. - */ - prepareDocumentPaste?( - document: TextDocument, - ranges: readonly Range[], - dataTransfer: DataTransfer, - token: CancellationToken, - ): void | Thenable; - - /** - * Invoked before the user pastes into a {@link TextEditor text editor}. - * - * Returned edits can replace the standard pasting behavior. - * - * @param document Document being pasted into - * @param ranges Range in the {@linkcode document} to paste into. - * @param dataTransfer The {@link DataTransfer data transfer} associated with the paste. This object is only - * valid for the duration of the paste operation. - * @param context Additional context for the paste. - * @param token A cancellation token. - * - * @return Set of potential {@link DocumentPasteEdit edits} that can apply the paste. Only a single returned - * {@linkcode DocumentPasteEdit} is applied at a time. If multiple edits are returned from all providers, then - * the first is automatically applied and a widget is shown that lets the user switch to the other edits. - */ - provideDocumentPasteEdits?( - document: TextDocument, - ranges: readonly Range[], - dataTransfer: DataTransfer, - context: DocumentPasteEditContext, - token: CancellationToken, - ): ProviderResult; - - /** - * Optional method which fills in the {@linkcode DocumentPasteEdit.additionalEdit} before the edit is applied. - * - * This is called once per edit and should be used if generating the complete edit may take a long time. - * Resolve can only be used to change {@linkcode DocumentPasteEdit.additionalEdit}. - * - * @param pasteEdit The {@linkcode DocumentPasteEdit} to resolve. - * @param token A cancellation token. - * - * @returns The resolved paste edit or a thenable that resolves to such. It is OK to return the given - * `pasteEdit`. If no result is returned, the given `pasteEdit` is used. - */ - resolveDocumentPasteEdit?( - pasteEdit: T, - token: CancellationToken, - ): ProviderResult; - } - - /** - * An edit the applies a paste operation. - */ - class DocumentPasteEdit { - /** - * Human readable label that describes the edit. - */ - title: string; - - /** - * {@link DocumentDropOrPasteEditKind Kind} of the edit. - */ - kind: DocumentDropOrPasteEditKind; - - /** - * The text or snippet to insert at the pasted locations. - * - * If your edit requires more advanced insertion logic, set this to an empty string and provide an {@link DocumentPasteEdit.additionalEdit additional edit} instead. - */ - insertText: string | SnippetString; - - /** - * An optional additional edit to apply on paste. - */ - additionalEdit?: WorkspaceEdit; - - /** - * Controls ordering when multiple paste edits can potentially be applied. - * - * If this edit yields to another, it will be shown lower in the list of possible paste edits shown to the user. - */ - yieldTo?: readonly DocumentDropOrPasteEditKind[]; - - /** - * Create a new paste edit. - * - * @param insertText The text or snippet to insert at the pasted locations. - * @param title Human readable label that describes the edit. - * @param kind {@link DocumentDropOrPasteEditKind Kind} of the edit. - */ - constructor( - insertText: string | SnippetString, - title: string, - kind: DocumentDropOrPasteEditKind, - ); - } - - /** - * Provides additional metadata about how a {@linkcode DocumentPasteEditProvider} works. - */ - interface DocumentPasteProviderMetadata { - /** - * List of {@link DocumentDropOrPasteEditKind kinds} that the provider may return in {@linkcode DocumentPasteEditProvider.provideDocumentPasteEdits provideDocumentPasteEdits}. - * - * This is used to filter out providers when a specific {@link DocumentDropOrPasteEditKind kind} of edit is requested. - */ - readonly providedPasteEditKinds: readonly DocumentDropOrPasteEditKind[]; - - /** - * Mime types that {@linkcode DocumentPasteEditProvider.prepareDocumentPaste prepareDocumentPaste} may add on copy. - */ - readonly copyMimeTypes?: readonly string[]; - - /** - * Mime types that {@linkcode DocumentPasteEditProvider.provideDocumentPasteEdits provideDocumentPasteEdits} should be invoked for. - * - * This can either be an exact mime type such as `image/png`, or a wildcard pattern such as `image/*`. - * - * Use `text/uri-list` for resources dropped from the explorer or other tree views in the workbench. - * - * Use `files` to indicate that the provider should be invoked if any {@link DataTransferFile files} are present in the {@linkcode DataTransfer}. - * Note that {@linkcode DataTransferFile} entries are only created when pasting content from outside the editor, such as - * from the operating system. - */ - readonly pasteMimeTypes?: readonly string[]; - } - - /** - * TODO on finalization: - * - Add ctor(insertText: string | SnippetString, title?: string, kind?: DocumentDropOrPasteEditKind); Can't be done as this is an extension to an existing class - */ - - export interface DocumentDropEdit { - /** - * Human readable label that describes the edit. - */ - title?: string; - - /** - * {@link DocumentDropOrPasteEditKind Kind} of the edit. - */ - kind: DocumentDropOrPasteEditKind; - - /** - * Controls the ordering or multiple edits. If this provider yield to edits, it will be shown lower in the list. - */ - yieldTo?: readonly DocumentDropOrPasteEditKind[]; - } - - export interface DocumentDropEditProvider< - T extends DocumentDropEdit = DocumentDropEdit, - > { - // Overload that allows returning multiple edits - // Will be merged in on finalization - provideDocumentDropEdits( - document: TextDocument, - position: Position, - dataTransfer: DataTransfer, - token: CancellationToken, - ): ProviderResult; - - /** - * Optional method which fills in the {@linkcode DocumentDropEdit.additionalEdit} before the edit is applied. - * - * This is called once per edit and should be used if generating the complete edit may take a long time. - * Resolve can only be used to change {@link DocumentDropEdit.additionalEdit}. - * - * @param pasteEdit The {@linkcode DocumentDropEdit} to resolve. - * @param token A cancellation token. - * - * @returns The resolved edit or a thenable that resolves to such. It is OK to return the given - * `edit`. If no result is returned, the given `edit` is used. - */ - resolveDocumentDropEdit?( - edit: T, - token: CancellationToken, - ): ProviderResult; - } - - /** - * Provides additional metadata about how a {@linkcode DocumentDropEditProvider} works. - */ - export interface DocumentDropEditProviderMetadata { - /** - * List of {@link DocumentDropOrPasteEditKind kinds} that the provider may return in {@linkcode DocumentDropEditProvider.provideDocumentDropEdits provideDocumentDropEdits}. - * - * This is used to filter out providers when a specific {@link DocumentDropOrPasteEditKind kind} of edit is requested. - */ - readonly providedDropEditKinds?: readonly DocumentDropOrPasteEditKind[]; - - /** - * List of {@link DataTransfer} mime types that the provider can handle. - * - * This can either be an exact mime type such as `image/png`, or a wildcard pattern such as `image/*`. - * - * Use `text/uri-list` for resources dropped from the explorer or other tree views in the workbench. - * - * Use `files` to indicate that the provider should be invoked if any {@link DataTransferFile files} are present in the {@link DataTransfer}. - * Note that {@link DataTransferFile} entries are only created when dropping content from outside the editor, such as - * from the operating system. - */ - readonly dropMimeTypes: readonly string[]; - } - - namespace languages { - /** - * Registers a new {@linkcode DocumentPasteEditProvider}. - * - * @param selector A selector that defines the documents this provider applies to. - * @param provider A paste editor provider. - * @param metadata Additional metadata about the provider. - * - * @returns A {@link Disposable} that unregisters this provider when disposed of. - */ - export function registerDocumentPasteEditProvider( - selector: DocumentSelector, - provider: DocumentPasteEditProvider, - metadata: DocumentPasteProviderMetadata, - ): Disposable; - - /** - * Overload which adds extra metadata. Will be removed on finalization. - */ - export function registerDocumentDropEditProvider( - selector: DocumentSelector, - provider: DocumentDropEditProvider, - metadata?: DocumentDropEditProviderMetadata, - ): Disposable; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.editSessionIdentityProvider.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.editSessionIdentityProvider.d.ts deleted file mode 100644 index 1e1a2685..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.editSessionIdentityProvider.d.ts +++ /dev/null @@ -1,79 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module "vscode" { - // https://github.com/microsoft/vscode/issues/157734 - - export namespace workspace { - /** - * An event that is emitted when an edit session identity is about to be requested. - */ - export const onWillCreateEditSessionIdentity: Event; - - /** - * - * @param scheme The URI scheme that this provider can provide edit session identities for. - * @param provider A provider which can convert URIs for workspace folders of scheme @param scheme to - * an edit session identifier which is stable across machines. This enables edit sessions to be resolved. - */ - export function registerEditSessionIdentityProvider( - scheme: string, - provider: EditSessionIdentityProvider, - ): Disposable; - } - - export interface EditSessionIdentityProvider { - /** - * - * @param workspaceFolder The workspace folder to provide an edit session identity for. - * @param token A cancellation token for the request. - * @returns A string representing the edit session identity for the requested workspace folder. - */ - provideEditSessionIdentity( - workspaceFolder: WorkspaceFolder, - token: CancellationToken, - ): ProviderResult; - - /** - * - * @param identity1 An edit session identity. - * @param identity2 A second edit session identity to compare to @param identity1. - * @param token A cancellation token for the request. - * @returns An {@link EditSessionIdentityMatch} representing the edit session identity match confidence for the provided identities. - */ - provideEditSessionIdentityMatch( - identity1: string, - identity2: string, - token: CancellationToken, - ): ProviderResult; - } - - export enum EditSessionIdentityMatch { - Complete = 100, - Partial = 50, - None = 0, - } - - export interface EditSessionIdentityWillCreateEvent { - /** - * A cancellation token. - */ - readonly token: CancellationToken; - - /** - * The workspace folder to create an edit session identity for. - */ - readonly workspaceFolder: WorkspaceFolder; - - /** - * Allows to pause the event until the provided thenable resolves. - * - * *Note:* This function can only be called during event dispatch. - * - * @param thenable A thenable that delays saving. - */ - waitUntil(thenable: Thenable): void; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.editorHoverVerbosityLevel.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.editorHoverVerbosityLevel.d.ts deleted file mode 100644 index 347d4ae0..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.editorHoverVerbosityLevel.d.ts +++ /dev/null @@ -1,85 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module "vscode" { - /** - * A hover represents additional information for a symbol or word. Hovers are - * rendered in a tooltip-like widget. - */ - export class VerboseHover extends Hover { - /** - * Can increase the verbosity of the hover - */ - canIncreaseVerbosity?: boolean; - - /** - * Can decrease the verbosity of the hover - */ - canDecreaseVerbosity?: boolean; - - /** - * Creates a new hover object. - * - * @param contents The contents of the hover. - * @param range The range to which the hover applies. - */ - constructor( - contents: - | MarkdownString - | MarkedString - | Array, - range?: Range, - canIncreaseVerbosity?: boolean, - canDecreaseVerbosity?: boolean, - ); - } - - export interface HoverContext { - /** - * The delta by which to increase/decrease the hover verbosity level - */ - readonly verbosityDelta?: number; - - /** - * The previous hover sent for the same position - */ - readonly previousHover?: Hover; - } - - export enum HoverVerbosityAction { - /** - * Increase the hover verbosity - */ - Increase = 0, - /** - * Decrease the hover verbosity - */ - Decrease = 1, - } - - /** - * The hover provider class - */ - export interface HoverProvider { - /** - * Provide a hover for the given position and document. Multiple hovers at the same - * position will be merged by the editor. A hover can have a range which defaults - * to the word range at the position when omitted. - * - * @param document The document in which the command was invoked. - * @param position The position at which the command was invoked. - * @param token A cancellation token. - * @oaram context A hover context. - * @returns A hover or a thenable that resolves to such. The lack of a result can be - * signaled by returning `undefined` or `null`. - */ - provideHover( - document: TextDocument, - position: Position, - token: CancellationToken, - context?: HoverContext, - ): ProviderResult; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.editorInsets.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.editorInsets.d.ts deleted file mode 100644 index 3ba71499..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.editorInsets.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -// https://github.com/microsoft/vscode/issues/85682 - -declare module "vscode" { - export interface WebviewEditorInset { - readonly editor: TextEditor; - readonly line: number; - readonly height: number; - readonly webview: Webview; - readonly onDidDispose: Event; - dispose(): void; - } - - export namespace window { - export function createWebviewTextEditorInset( - editor: TextEditor, - line: number, - height: number, - options?: WebviewOptions, - ): WebviewEditorInset; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.embeddings.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.embeddings.d.ts deleted file mode 100644 index 9145695a..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.embeddings.d.ts +++ /dev/null @@ -1,45 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module "vscode" { - // https://github.com/microsoft/vscode/issues/212083 - - export interface Embedding { - readonly values: number[]; - } - - // TODO@API strictly not the right namespace... - export namespace lm { - export const embeddingModels: string[]; - - export const onDidChangeEmbeddingModels: Event; - - export function computeEmbeddings( - embeddingsModel: string, - input: string, - token?: CancellationToken, - ): Thenable; - - export function computeEmbeddings( - embeddingsModel: string, - input: string[], - token?: CancellationToken, - ): Thenable; - } - - export interface EmbeddingsProvider { - provideEmbeddings( - input: string[], - token: CancellationToken, - ): ProviderResult; - } - - export namespace lm { - export function registerEmbeddingsProvider( - embeddingsModel: string, - provider: EmbeddingsProvider, - ): Disposable; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.extensionRuntime.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.extensionRuntime.d.ts deleted file mode 100644 index b5d3ceff..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.extensionRuntime.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module "vscode" { - // https://github.com/microsoft/vscode/issues/104436 - - export enum ExtensionRuntime { - /** - * The extension is running in a NodeJS extension host. Runtime access to NodeJS APIs is available. - */ - Node = 1, - /** - * The extension is running in a Webworker extension host. Runtime access is limited to Webworker APIs. - */ - Webworker = 2, - } - - export interface ExtensionContext { - readonly extensionRuntime: ExtensionRuntime; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.extensionsAny.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.extensionsAny.d.ts deleted file mode 100644 index 14a724cc..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.extensionsAny.d.ts +++ /dev/null @@ -1,43 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module "vscode" { - // https://github.com/microsoft/vscode/issues/145307 @alexdima - - export interface Extension { - /** - * `true` when the extension is associated to another extension host. - * - * *Note* that an extension from another extension host cannot export - * API, e.g {@link Extension.exports its exports} are always `undefined`. - */ - readonly isFromDifferentExtensionHost: boolean; - } - - export namespace extensions { - /** - * Get an extension by its full identifier in the form of: `publisher.name`. - * - * @param extensionId An extension identifier. - * @param includeDifferentExtensionHosts Include extensions from different extension host - * @return An extension or `undefined`. - */ - export function getExtension( - extensionId: string, - includeDifferentExtensionHosts: boolean, - ): Extension | undefined; - export function getExtension( - extensionId: string, - includeDifferentExtensionHosts: true, - ): Extension | undefined; - - /** - * All extensions across all extension hosts. - * - * @see {@link Extension.isFromDifferentExtensionHost} - */ - export const allAcrossExtensionHosts: readonly Extension[]; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.externalUriOpener.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.externalUriOpener.d.ts deleted file mode 100644 index aeac002e..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.externalUriOpener.d.ts +++ /dev/null @@ -1,174 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module "vscode" { - // https://github.com/microsoft/vscode/issues/109277 - - /** - * Details if an `ExternalUriOpener` can open a uri. - * - * The priority is also used to rank multiple openers against each other and determine - * if an opener should be selected automatically or if the user should be prompted to - * select an opener. - * - * The editor will try to use the best available opener, as sorted by `ExternalUriOpenerPriority`. - * If there are multiple potential "best" openers for a URI, then the user will be prompted - * to select an opener. - */ - export enum ExternalUriOpenerPriority { - /** - * The opener is disabled and will never be shown to users. - * - * Note that the opener can still be used if the user specifically - * configures it in their settings. - */ - None = 0, - - /** - * The opener can open the uri but will not cause a prompt on its own - * since the editor always contributes a built-in `Default` opener. - */ - Option = 1, - - /** - * The opener can open the uri. - * - * The editor's built-in opener has `Default` priority. This means that any additional `Default` - * openers will cause the user to be prompted to select from a list of all potential openers. - */ - Default = 2, - - /** - * The opener can open the uri and should be automatically selected over any - * default openers, include the built-in one from the editor. - * - * A preferred opener will be automatically selected if no other preferred openers - * are available. If multiple preferred openers are available, then the user - * is shown a prompt with all potential openers (not just preferred openers). - */ - Preferred = 3, - } - - /** - * Handles opening uris to external resources, such as http(s) links. - * - * Extensions can implement an `ExternalUriOpener` to open `http` links to a webserver - * inside of the editor instead of having the link be opened by the web browser. - * - * Currently openers may only be registered for `http` and `https` uris. - */ - export interface ExternalUriOpener { - /** - * Check if the opener can open a uri. - * - * @param uri The uri being opened. This is the uri that the user clicked on. It has - * not yet gone through port forwarding. - * @param token Cancellation token indicating that the result is no longer needed. - * - * @return Priority indicating if the opener can open the external uri. - */ - canOpenExternalUri( - uri: Uri, - token: CancellationToken, - ): ExternalUriOpenerPriority | Thenable; - - /** - * Open a uri. - * - * This is invoked when: - * - * - The user clicks a link which does not have an assigned opener. In this case, first `canOpenExternalUri` - * is called and if the user selects this opener, then `openExternalUri` is called. - * - The user sets the default opener for a link in their settings and then visits a link. - * - * @param resolvedUri The uri to open. This uri may have been transformed by port forwarding, so it - * may not match the original uri passed to `canOpenExternalUri`. Use `ctx.originalUri` to check the - * original uri. - * @param ctx Additional information about the uri being opened. - * @param token Cancellation token indicating that opening has been canceled. - * - * @return Thenable indicating that the opening has completed. - */ - openExternalUri( - resolvedUri: Uri, - ctx: OpenExternalUriContext, - token: CancellationToken, - ): Thenable | void; - } - - /** - * Additional information about the uri being opened. - */ - interface OpenExternalUriContext { - /** - * The uri that triggered the open. - * - * This is the original uri that the user clicked on or that was passed to `openExternal.` - * Due to port forwarding, this may not match the `resolvedUri` passed to `openExternalUri`. - */ - readonly sourceUri: Uri; - } - - /** - * Additional metadata about a registered `ExternalUriOpener`. - */ - interface ExternalUriOpenerMetadata { - /** - * List of uri schemes the opener is triggered for. - * - * Currently only `http` and `https` are supported. - */ - readonly schemes: readonly string[]; - - /** - * Text displayed to the user that explains what the opener does. - * - * For example, 'Open in browser preview' - */ - readonly label: string; - } - - namespace window { - /** - * Register a new `ExternalUriOpener`. - * - * When a uri is about to be opened, an `onOpenExternalUri:SCHEME` activation event is fired. - * - * @param id Unique id of the opener, such as `myExtension.browserPreview`. This is used in settings - * and commands to identify the opener. - * @param opener Opener to register. - * @param metadata Additional information about the opener. - * - * @returns Disposable that unregisters the opener. - */ - export function registerExternalUriOpener( - id: string, - opener: ExternalUriOpener, - metadata: ExternalUriOpenerMetadata, - ): Disposable; - } - - interface OpenExternalOptions { - /** - * Allows using openers contributed by extensions through `registerExternalUriOpener` - * when opening the resource. - * - * If `true`, the editor will check if any contributed openers can handle the - * uri, and fallback to the default opener behavior. - * - * If it is string, this specifies the id of the `ExternalUriOpener` - * that should be used if it is available. Use `'default'` to force the editor's - * standard external opener to be used. - */ - readonly allowContributedOpeners?: boolean | string; - } - - namespace env { - export function openExternal( - target: Uri, - options?: OpenExternalOptions, - ): Thenable; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.fileComments.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.fileComments.d.ts deleted file mode 100644 index 8533a2eb..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.fileComments.d.ts +++ /dev/null @@ -1,48 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module "vscode" { - export interface CommentThread2 { - /** - * The range the comment thread is located within the document. The thread icon will be shown - * at the last line of the range. When set to undefined, the comment will be associated with the - * file, and not a specific range. - */ - range: Range | undefined; - } - - /** - * The ranges a CommentingRangeProvider enables commenting on. - */ - export interface CommentingRanges { - /** - * Enables comments to be added to a file without a specific range. - */ - enableFileComments: boolean; - - /** - * The ranges which allow new comment threads creation. - */ - ranges?: Range[]; - } - - export interface CommentController { - createCommentThread( - uri: Uri, - range: Range | undefined, - comments: readonly Comment[], - ): CommentThread | CommentThread2; - } - - export interface CommentingRangeProvider2 { - /** - * Provide a list of ranges which allow new comment threads creation or null for a given document - */ - provideCommentingRanges( - document: TextDocument, - token: CancellationToken, - ): ProviderResult; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.fileSearchProvider.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.fileSearchProvider.d.ts deleted file mode 100644 index c4537324..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.fileSearchProvider.d.ts +++ /dev/null @@ -1,79 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module "vscode" { - // https://github.com/microsoft/vscode/issues/73524 - - /** - * The parameters of a query for file search. - */ - export interface FileSearchQuery { - /** - * The search pattern to match against file paths. - * To be correctly interpreted by Quick Open, this is interpreted in a relaxed way. The picker will apply its own highlighting and scoring on the results. - * - * Tips for matching in Quick Open: - * With the pattern, the picker will use the file name and file paths to score each entry. The score will determine the ordering and filtering. - * The scoring prioritizes prefix and substring matching. Then, it checks and it checks whether the pattern's letters appear in the same order as in the target (file name and path). - * If a file does not match at all using our criteria, it will be omitted from Quick Open. - */ - pattern: string; - } - - /** - * Options that apply to file search. - */ - export interface FileSearchOptions extends SearchOptions { - /** - * The maximum number of results to be returned. - */ - maxResults?: number; - - /** - * A CancellationToken that represents the session for this search query. If the provider chooses to, this object can be used as the key for a cache, - * and searches with the same session object can search the same cache. When the token is cancelled, the session is complete and the cache can be cleared. - */ - session?: CancellationToken; - } - - /** - * A FileSearchProvider provides search results for files in the given folder that match a query string. It can be invoked by quickopen or other extensions. - * - * A FileSearchProvider is the more powerful of two ways to implement file search in the editor. Use a FileSearchProvider if you wish to search within a folder for - * all files that match the user's query. - * - * The FileSearchProvider will be invoked on every keypress in quickopen. When `workspace.findFiles` is called, it will be invoked with an empty query string, - * and in that case, every file in the folder should be returned. - */ - export interface FileSearchProvider { - /** - * Provide the set of files that match a certain file path pattern. - * @param query The parameters for this query. - * @param options A set of options to consider while searching files. - * @param token A cancellation token. - */ - provideFileSearchResults( - query: FileSearchQuery, - options: FileSearchOptions, - token: CancellationToken, - ): ProviderResult; - } - - export namespace workspace { - /** - * Register a search provider. - * - * Only one provider can be registered per scheme. - * - * @param scheme The provider will be invoked for workspace folders that have this file scheme. - * @param provider The provider. - * @return A {@link Disposable} that unregisters this provider when being disposed. - */ - export function registerFileSearchProvider( - scheme: string, - provider: FileSearchProvider, - ): Disposable; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.fileSearchProvider2.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.fileSearchProvider2.d.ts deleted file mode 100644 index 78a8e907..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.fileSearchProvider2.d.ts +++ /dev/null @@ -1,107 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module "vscode" { - // https://github.com/microsoft/vscode/issues/73524 - - /** - * Options that apply to file search. - */ - export interface FileSearchProviderOptions { - folderOptions: { - /** - * The root folder to search within. - */ - folder: Uri; - - /** - * Files that match an `includes` glob pattern should be included in the search. - */ - includes: string[]; - - /** - * Files that match an `excludes` glob pattern should be excluded from the search. - */ - excludes: GlobPattern[]; - - /** - * Whether symlinks should be followed while searching. - * For more info, see the setting description for `search.followSymlinks`. - */ - followSymlinks: boolean; - - /** - * Which file locations we should look for ignore (.gitignore or .ignore) files to respect. - */ - useIgnoreFiles: { - /** - * Use ignore files at the current workspace root. - */ - local: boolean; - /** - * Use ignore files at the parent directory. If set, {@link FileSearchProviderOptions.useIgnoreFiles.local} should also be `true`. - */ - parent: boolean; - /** - * Use global ignore files. If set, {@link FileSearchProviderOptions.useIgnoreFiles.local} should also be `true`. - */ - global: boolean; - }; - }[]; - - /** - * An object with a lifespan that matches the session's lifespan. If the provider chooses to, this object can be used as the key for a cache, - * and searches with the same session object can search the same cache. When the object is garbage-collected, the session is complete and the cache can be cleared. - * Please do not store any references to the session object, except via a weak reference (e.g. `WeakRef` or `WeakMap`). - */ - session: object; - - /** - * The maximum number of results to be returned. - */ - maxResults: number; - } - - /** - * A FileSearchProvider provides search results for files in the given folder that match a query string. It can be invoked by quickopen or other extensions. - * - * A FileSearchProvider is the more powerful of two ways to implement file search in the editor. Use a FileSearchProvider if you wish to search within a folder for - * all files that match the user's query. - * - * The FileSearchProvider will be invoked on every keypress in quickopen. - */ - export interface FileSearchProvider2 { - /** - * WARNING: VERY EXPERIMENTAL. - * - * Provide the set of files that match a certain file path pattern. - * @param pattern The search pattern to match against file paths. - * @param options A set of options to consider while searching files. - * @param token A cancellation token. - */ - provideFileSearchResults( - pattern: string, - options: FileSearchProviderOptions, - token: CancellationToken, - ): ProviderResult; - } - - export namespace workspace { - /** - * - * Register a search provider. - * - * Only one provider can be registered per scheme. - * - * @param scheme The provider will be invoked for workspace folders that have this file scheme. - * @param provider The provider. - * @return A {@link Disposable} that unregisters this provider when being disposed. - */ - export function registerFileSearchProvider2( - scheme: string, - provider: FileSearchProvider2, - ): Disposable; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.findFiles2.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.findFiles2.d.ts deleted file mode 100644 index ba9fe8ee..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.findFiles2.d.ts +++ /dev/null @@ -1,128 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -// version: 2 - -declare module "vscode" { - export interface FindFiles2Options { - /** - * An array of {@link GlobPattern GlobPattern} that defines files to exclude. - * The glob patterns will be matched against the file paths of files relative to their workspace or {@link RelativePattern.baseUri} if applicable. - * - * If more than one value is used, the values are combined with a logical AND. - * For example, consider the following code: - * - * ```ts - * const ab = findFiles(['**​/*.js'], {exclude: ['*.ts', '*.js']}); - * const a = findFiles(['**​/*.js'], {exclude: ['*.ts']}); - * const b = findFiles(['**​/*.js'], {exclude: ['*.js']}); - * ``` - * - * In this, `ab` will be the intersection of results from `a` and `b`. - */ - exclude?: GlobPattern[]; - - /** - * Which settings to follow when searching for files. Defaults to {@link ExcludeSettingOptions.searchAndFilesExclude}. - */ - useExcludeSettings?: ExcludeSettingOptions; - - /** - * The maximum number of results to search for. Defaults to 20000 results. - */ - maxResults?: number; - - /** - * Which file locations have ignore (`.gitignore` or `.ignore`) files to follow. - * - * When any of these fields are `undefined`, the value will either be assumed (e.g. if only one is valid), - * or it will follow settings based on the corresponding `search.use*IgnoreFiles` setting. - * - * Will log an error if an invalid combination is set. - * - * Although `.ignore` files are uncommon, they can be leveraged if there are patterns - * that should not be known to git, but should be known to the search providers. - * They should be in the same locations where `.gitignore` files are found, and they follow the same format. - */ - useIgnoreFiles?: { - /** - * Use ignore files at the current workspace root. - * May default to `search.useIgnoreFiles` setting if not set. - */ - local?: boolean; - /** - * Use ignore files at the parent directory. When set to `true`, {@link FindFiles2Options.useIgnoreFiles.local} must also be `true`. - * May default to `search.useParentIgnoreFiles` setting if not set. - */ - parent?: boolean; - /** - * Use global ignore files. When set to `true`, {@link FindFiles2Options.useIgnoreFiles.local} must also be `true`. - * May default to `search.useGlobalIgnoreFiles` setting if not set. - */ - global?: boolean; - }; - - /** - * Whether symlinks should be followed while searching. - * Defaults to the value for `search.followSymlinks` in settings. - * For more info, see the setting description for `search.followSymlinks`. - */ - followSymlinks?: boolean; - } - - /** - * Options for following search.exclude and files.exclude settings. - */ - export enum ExcludeSettingOptions { - /** - * Don't use any exclude settings. - */ - None = 1, - /** - * Use the `files.exclude` setting - */ - FilesExclude = 2, - /** - * Use the `files.exclude` and `search.exclude` settings - */ - SearchAndFilesExclude = 3, - } - - export namespace workspace { - /** - * WARNING: VERY EXPERIMENTAL. - * - * Find files across all {@link workspace.workspaceFolders workspace folders} in the workspace. - * - * @example - * findFiles(['**​/*.js'], {exclude: ['**​/out/**'], useIgnoreFiles: true, maxResults: 10}) - * - * @param filePattern An array of {@link GlobPattern GlobPattern} that defines the files to search for. - * The glob patterns will be matched against the file paths of files relative to their workspace or {@link baseUri GlobPattern.baseUri} if applicable. - * Use a {@link RelativePattern RelativePatten} to restrict the search results to a {@link WorkspaceFolder workspace folder}. - * - * If more than one value is used, the values are combined with a logical OR. - * - * For example, consider the following code: - * - * ```ts - * const ab = findFiles(['*.ts', '*.js']); - * const a = findFiles(['**​/*.ts']); - * const b = findFiles(['**​/*.js']); - * ``` - * - * In this, `ab` will be the union of results from `a` and `b`. - * @param options A set of {@link FindFiles2Options FindFiles2Options} that defines where and how to search (e.g. exclude settings). - * @param token A token that can be used to signal cancellation to the underlying search engine. - * @returns A thenable that resolves to an array of resource identifiers. Will return no results if no - * {@link workspace.workspaceFolders workspace folders} are opened. - */ - export function findFiles2( - filePattern: GlobPattern[], - options?: FindFiles2Options, - token?: CancellationToken, - ): Thenable; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.findTextInFiles.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.findTextInFiles.d.ts deleted file mode 100644 index d60550f7..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.findTextInFiles.d.ts +++ /dev/null @@ -1,112 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module "vscode" { - // https://github.com/microsoft/vscode/issues/59924 - - /** - * Options that can be set on a findTextInFiles search. - */ - export interface FindTextInFilesOptions { - /** - * A {@link GlobPattern glob pattern} that defines the files to search for. The glob pattern - * will be matched against the file paths of files relative to their workspace. Use a {@link RelativePattern relative pattern} - * to restrict the search results to a {@link WorkspaceFolder workspace folder}. - */ - include?: GlobPattern; - - /** - * A {@link GlobPattern glob pattern} that defines files and folders to exclude. The glob pattern - * will be matched against the file paths of resulting matches relative to their workspace. When `undefined`, default excludes will - * apply. - */ - exclude?: GlobPattern; - - /** - * Whether to use the default and user-configured excludes. Defaults to true. - */ - useDefaultExcludes?: boolean; - - /** - * The maximum number of results to search for - */ - maxResults?: number; - - /** - * Whether external files that exclude files, like .gitignore, should be respected. - * See the vscode setting `"search.useIgnoreFiles"`. - */ - useIgnoreFiles?: boolean; - - /** - * Whether global files that exclude files, like .gitignore, should be respected. - * See the vscode setting `"search.useGlobalIgnoreFiles"`. - */ - useGlobalIgnoreFiles?: boolean; - - /** - * Whether files in parent directories that exclude files, like .gitignore, should be respected. - * See the vscode setting `"search.useParentIgnoreFiles"`. - */ - useParentIgnoreFiles?: boolean; - - /** - * Whether symlinks should be followed while searching. - * See the vscode setting `"search.followSymlinks"`. - */ - followSymlinks?: boolean; - - /** - * Interpret files using this encoding. - * See the vscode setting `"files.encoding"` - */ - encoding?: string; - - /** - * Options to specify the size of the result text preview. - */ - previewOptions?: TextSearchPreviewOptions; - - /** - * Number of lines of context to include before each match. - */ - beforeContext?: number; - - /** - * Number of lines of context to include after each match. - */ - afterContext?: number; - } - - export namespace workspace { - /** - * Search text in files across all {@link workspace.workspaceFolders workspace folders} in the workspace. - * @param query The query parameters for the search - the search string, whether it's case-sensitive, or a regex, or matches whole words. - * @param callback A callback, called for each result - * @param token A token that can be used to signal cancellation to the underlying search engine. - * @return A thenable that resolves when the search is complete. - */ - export function findTextInFiles( - query: TextSearchQuery, - callback: (result: TextSearchResult) => void, - token?: CancellationToken, - ): Thenable; - - /** - * Search text in files across all {@link workspace.workspaceFolders workspace folders} in the workspace. - * @param query The query parameters for the search - the search string, whether it's case-sensitive, or a regex, or matches whole words. - * @param options An optional set of query options. Include and exclude patterns, maxResults, etc. - * @param callback A callback, called for each result - * @param token A token that can be used to signal cancellation to the underlying search engine. - * @return A thenable that resolves when the search is complete. - */ - export function findTextInFiles( - query: TextSearchQuery, - options: FindTextInFilesOptions, - callback: (result: TextSearchResult) => void, - token?: CancellationToken, - ): Thenable; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.findTextInFiles2.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.findTextInFiles2.d.ts deleted file mode 100644 index f47219f7..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.findTextInFiles2.d.ts +++ /dev/null @@ -1,149 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module "vscode" { - // https://github.com/microsoft/vscode/issues/59924 - - export interface FindTextInFilesOptions2 { - /** - * An array of {@link GlobPattern GlobPattern} that defines the files to search for. - * The glob patterns will be matched against the file paths of files relative to their workspace or {@link baseUri GlobPattern.baseUri} if applicable. - * Use a {@link RelativePattern RelativePattern} to restrict the search results to a {@link WorkspaceFolder workspace folder}. - * - * If more than one value is used, the values are combined with a logical OR. - * - * For example, consider the following code: - * - * ```ts - * const ab = findTextInFiles2('foo', {include: ['*.ts', '*.js']}); - * const a = findTextInFiles2('foo', {include: ['*.ts']}); - * const b = findTextInFiles2('foo', {include: ['*.js']}); - * ``` - * - * In this, `ab` will be the union of results from `a` and `b`. - */ - include?: GlobPattern[]; - - /** - * An array of {@link GlobPattern GlobPattern} that defines files to exclude. - * The glob patterns will be matched against the file paths of files relative to their workspace or {@link RelativePattern.baseUri} if applicable. - * - * If more than one value is used, the values are combined with a logical AND. - * For example, consider the following code: - * - * ```ts - * const ab = findTextInFiles2('foo', {exclude: ['*.ts', '*.js']}); - * const a = findTextInFiles2('foo', {exclude: ['*.ts']}); - * const b = findTextInFiles2('foo', {exclude: ['*.js']}); - * ``` - * - * In this, `ab` will be the intersection of results from `a` and `b`. - */ - exclude?: GlobPattern[]; - - /** - * Which settings to follow when searching for files. Defaults to {@link ExcludeSettingOptions.searchAndFilesExclude}. - */ - useExcludeSettings?: ExcludeSettingOptions; - - /** - * The maximum number of results to search for. Defaults to 20000 results. - */ - maxResults?: number; - - /** - * Which file locations have ignore (`.gitignore` or `.ignore`) files to follow. - * - * When any of these fields are `undefined`, the value will either be assumed (e.g. if only one is valid), - * or it will follow settings based on the corresponding `search.use*IgnoreFiles` setting. - * - * Will log an error if an invalid combination is set. - * - * Although `.ignore` files are uncommon, they can be leveraged if there are patterns - * that should not be known to git, but should be known to the search providers. - * They should be in the same locations where `.gitignore` files are found, and they follow the same format. - */ - useIgnoreFiles?: { - /** - * Use ignore files at the current workspace root. - * May default to `search.useIgnoreFiles` setting if not set. - */ - local?: boolean; - /** - * Use ignore files at the parent directory. When set to `true`, {@link FindTextInFilesOptions2.useIgnoreFiles.local} must be `true`. - * May default to `search.useParentIgnoreFiles` setting if not set. - */ - parent?: boolean; - /** - * Use global ignore files. When set to `true`, {@link FindTextInFilesOptions2.useIgnoreFiles.local} must also be `true`. - * May default to `search.useGlobalIgnoreFiles` setting if not set. - */ - global?: boolean; - }; - - /** - * Whether symlinks should be followed while searching. - * Defaults to the value for `search.followSymlinks` in settings. - * For more info, see the setting description for `search.followSymlinks`. - */ - followSymlinks?: boolean; - - /** - * Interpret files using this encoding. - * See the vscode setting `"files.encoding"` - */ - encoding?: string; - - /** - * Options to specify the size of the result text preview. - */ - previewOptions?: { - /** - * The maximum number of lines in the preview of the match itself (not including surrounding context lines). - * Only search providers that support multiline search will ever return more than one line in the match. - */ - numMatchLines?: number; - - /** - * The maximum number of characters included per line. - */ - charsPerLine?: number; - }; - - /** - * Number of lines of context to include before and after each match. - */ - surroundingContext?: number; - } - - export interface FindTextInFilesResponse { - /** - * The results of the text search, in batches. To get completion information, wait on the `complete` property. - */ - results: AsyncIterable; - /** - * The text search completion information. This resolves on completion. - */ - complete: Thenable; - } - - export namespace workspace { - /** - * WARNING: VERY EXPERIMENTAL. - * - * Search text in files across all {@link workspace.workspaceFolders workspace folders} in the workspace. - * @param query The query parameters for the search - the search string, whether it's case-sensitive, or a regex, or matches whole words. - * @param options An optional set of query options. - * @param callback A callback, called for each {@link TextSearchResult2 result}. This can be a direct match, or context that surrounds a match. - * @param token A token that can be used to signal cancellation to the underlying search engine. - * @return A thenable that resolves when the search is complete. - */ - export function findTextInFiles2( - query: TextSearchQuery2, - options?: FindTextInFilesOptions2, - token?: CancellationToken, - ): FindTextInFilesResponse; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.fsChunks.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.fsChunks.d.ts deleted file mode 100644 index cc1cd3e1..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.fsChunks.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module "vscode" { - // https://github.com/microsoft/vscode/issues/84515 - - export interface FileSystemProvider { - open?( - resource: Uri, - options: { create: boolean }, - ): number | Thenable; - close?(fd: number): void | Thenable; - read?( - fd: number, - pos: number, - data: Uint8Array, - offset: number, - length: number, - ): number | Thenable; - write?( - fd: number, - pos: number, - data: Uint8Array, - offset: number, - length: number, - ): number | Thenable; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.idToken.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.idToken.d.ts deleted file mode 100644 index 712a5e06..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.idToken.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module "vscode" { - /** - * Represents a session of a currently logged in user. - */ - export interface AuthenticationSession { - /** - * An optional ID token that may be included in the session. - */ - readonly idToken?: string; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.inlineCompletionsAdditions.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.inlineCompletionsAdditions.d.ts deleted file mode 100644 index 865bee84..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.inlineCompletionsAdditions.d.ts +++ /dev/null @@ -1,112 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module "vscode" { - // https://github.com/microsoft/vscode/issues/124024 @hediet - - export namespace languages { - /** - * Registers an inline completion provider. - * - * Multiple providers can be registered for a language. In that case providers are asked in - * parallel and the results are merged. A failing provider (rejected promise or exception) will - * not cause a failure of the whole operation. - * - * @param selector A selector that defines the documents this provider is applicable to. - * @param provider An inline completion provider. - * @param metadata Metadata about the provider. - * @return A {@link Disposable} that unregisters this provider when being disposed. - */ - export function registerInlineCompletionItemProvider( - selector: DocumentSelector, - provider: InlineCompletionItemProvider, - metadata: InlineCompletionItemProviderMetadata, - ): Disposable; - } - - export interface InlineCompletionItem { - /** - * If set to `true`, unopened closing brackets are removed and unclosed opening brackets are closed. - * Defaults to `false`. - */ - completeBracketPairs?: boolean; - } - - export interface InlineCompletionItemProviderMetadata { - /** - * Specifies a list of extension ids that this provider yields to if they return a result. - * If some inline completion provider registered by such an extension returns a result, this provider is not asked. - */ - yieldTo: string[]; - } - - export interface InlineCompletionItemProvider { - /** - * @param completionItem The completion item that was shown. - * @param updatedInsertText The actual insert text (after brackets were fixed). - */ - // eslint-disable-next-line local/vscode-dts-provider-naming - handleDidShowCompletionItem?( - completionItem: InlineCompletionItem, - updatedInsertText: string, - ): void; - - /** - * Is called when an inline completion item was accepted partially. - * @param acceptedLength The length of the substring of the inline completion that was accepted already. - */ - // eslint-disable-next-line local/vscode-dts-provider-naming - handleDidPartiallyAcceptCompletionItem?( - completionItem: InlineCompletionItem, - acceptedLength: number, - ): void; - - /** - * Is called when an inline completion item was accepted partially. - * @param info Additional info for the partial accepted trigger. - */ - // eslint-disable-next-line local/vscode-dts-provider-naming - handleDidPartiallyAcceptCompletionItem?( - completionItem: InlineCompletionItem, - info: PartialAcceptInfo, - ): void; - - provideInlineEditsForRange?( - document: TextDocument, - range: Range, - context: InlineCompletionContext, - token: CancellationToken, - ): ProviderResult; - } - - export interface InlineCompletionContext { - readonly userPrompt?: string; - } - - export interface PartialAcceptInfo { - kind: PartialAcceptTriggerKind; - } - - export enum PartialAcceptTriggerKind { - Unknown = 0, - Word = 1, - Line = 2, - Suggest = 3, - } - - // When finalizing `commands`, make sure to add a corresponding constructor parameter. - export interface InlineCompletionList { - /** - * A list of commands associated with the inline completions of this list. - */ - commands?: Command[]; - - /** - * When set and the user types a suggestion without derivating from it, the inline suggestion is not updated. - * Defaults to false (might change). - */ - enableForwardStability?: boolean; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.inlineEdit.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.inlineEdit.d.ts deleted file mode 100644 index 98d7fddc..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.inlineEdit.d.ts +++ /dev/null @@ -1,91 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module "vscode" { - export class InlineEdit { - /** - * The new text for this edit. - */ - readonly text: string; - - /** - * An range that will be replaced by the text of the inline edit. - * If change is only additive, this can be empty (same start and end position). - */ - readonly range: Range; - - /** - * An optional command that will be executed after applying the inline edit. - */ - accepted?: Command; - - /** - * An optional command that will be executed after rejecting the inline edit. - */ - rejected?: Command; - - commands?: Command[]; - - /** - * Creates a new inline edit. - * - * @param text The new text for this edit. - * @param replaceRange An range that will be replaced by the text of the inline edit. - */ - constructor(text: string, range: Range); - } - - export interface InlineEditContext { - /** - * Describes how the inline edit was triggered. - */ - triggerKind: InlineEditTriggerKind; - } - - export enum InlineEditTriggerKind { - /** - * Completion was triggered explicitly by a user gesture. - * Return multiple completion items to enable cycling through them. - */ - Invoke = 0, - - /** - * Completion was triggered automatically while editing. - * It is sufficient to return a single completion item in this case. - */ - Automatic = 1, - } - - export interface InlineEditProvider { - /** - * Provide inline edit for the given document. - * - * @param document The document for which the inline edit are computed. - * @param context Additional context information about the request. - * @param token A cancellation token. - * @return An inline edit or a thenable that resolves to such. The lack of a result can be - * signaled by returning `undefined` or `null`. - */ - provideInlineEdit( - document: TextDocument, - context: InlineEditContext, - token: CancellationToken, - ): ProviderResult; - } - - export namespace languages { - /** - * Register a provider that can handle inline edits. - * - * @param selector A selector that defines the documents this provider is applicable to. - * @param provider A provider that can handle inline edits. - * @return A {@link Disposable} that unregisters this provider when being disposed. - */ - export function registerInlineEditProvider( - selector: DocumentSelector, - provider: InlineEditProvider, - ): Disposable; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.interactive.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.interactive.d.ts deleted file mode 100644 index 318fca27..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.interactive.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module "vscode" { - export namespace interactive { - export function transferActiveChat(toWorkspace: Uri): void; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.interactiveWindow.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.interactiveWindow.d.ts deleted file mode 100644 index 8cd2d655..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.interactiveWindow.d.ts +++ /dev/null @@ -1,34 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module "vscode" { - /** - * The tab represents an interactive window. - */ - export class TabInputInteractiveWindow { - /** - * The uri of the history notebook in the interactive window. - */ - readonly uri: Uri; - /** - * The uri of the input box in the interactive window. - */ - readonly inputBoxUri: Uri; - private constructor(uri: Uri, inputBoxUri: Uri); - } - - export interface Tab { - readonly input: - | TabInputText - | TabInputTextDiff - | TabInputCustom - | TabInputWebview - | TabInputNotebook - | TabInputNotebookDiff - | TabInputTerminal - | TabInputInteractiveWindow - | unknown; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.ipc.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.ipc.d.ts deleted file mode 100644 index ecd5be49..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.ipc.d.ts +++ /dev/null @@ -1,34 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module "vscode" { - /** - * A message passing protocol, which enables sending and receiving messages - * between two parties. - */ - export interface MessagePassingProtocol { - /** - * Fired when a message is received from the other party. - */ - readonly onDidReceiveMessage: Event; - - /** - * Post a message to the other party. - * - * @param message Body of the message. This must be a JSON serializable object. - * @param transfer A collection of `ArrayBuffer` instances which can be transferred - * to the other party, saving costly memory copy operations. - */ - postMessage(message: any, transfer?: ArrayBuffer[]): void; - } - - export interface ExtensionContext { - /** - * When not `undefined`, this is an instance of {@link MessagePassingProtocol} in - * which the other party is owned by the web embedder. - */ - readonly messagePassingProtocol: MessagePassingProtocol | undefined; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.languageModelSystem.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.languageModelSystem.d.ts deleted file mode 100644 index 37c48486..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.languageModelSystem.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module "vscode" { - // https://github.com/microsoft/vscode/issues/206265 - - // TODO@API don't have this dedicated type but as property, e.g anthropic doesn't have a system-role, see - // https://github.com/anthropics/anthropic-sdk-typescript/blob/c2da9604646ff103fbdbca016a9a9d49b03b387b/src/resources/messages.ts#L384 - // So, we could have `LanguageModelChatRequestOptions#system` which would be more limiting but also more natural? - - export enum LanguageModelChatMessageRole { - System = 3, - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.languageStatusText.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.languageStatusText.d.ts deleted file mode 100644 index bc5b7829..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.languageStatusText.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module "vscode" { - export interface LanguageStatusItem { - text2: string | { value: string; shortValue: string }; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.mappedEditsProvider.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.mappedEditsProvider.d.ts deleted file mode 100644 index 12b7377e..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.mappedEditsProvider.d.ts +++ /dev/null @@ -1,99 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module "vscode" { - export interface DocumentContextItem { - readonly uri: Uri; - readonly version: number; - readonly ranges: Range[]; - } - - export interface ConversationRequest { - // eslint-disable-next-line local/vscode-dts-string-type-literals - readonly type: "request"; - readonly message: string; - } - - export interface ConversationResponse { - // eslint-disable-next-line local/vscode-dts-string-type-literals - readonly type: "response"; - readonly message: string; - readonly result?: ChatResult; - readonly references?: DocumentContextItem[]; - } - - export interface MappedEditsContext { - readonly documents: DocumentContextItem[][]; - /** - * The conversation that led to the current code block(s). - * The last conversation part contains the code block(s) for which the code mapper should provide edits. - */ - readonly conversation?: Array< - ConversationRequest | ConversationResponse - >; - } - - /** - * Interface for providing mapped edits for a given document. - */ - export interface MappedEditsProvider { - /** - * Provide mapped edits for a given document. - * @param document The document to provide mapped edits for. - * @param codeBlocks Code blocks that come from an LLM's reply. - * "Apply in Editor" in the panel chat only sends one edit that the user clicks on, but inline chat can send multiple blocks and let the lang server decide what to do with them. - * @param context The context for providing mapped edits. - * @param token A cancellation token. - * @returns A provider result of text edits. - */ - provideMappedEdits( - document: TextDocument, - codeBlocks: string[], - context: MappedEditsContext, - token: CancellationToken, - ): ProviderResult; - } - - export interface MappedEditsRequest { - readonly codeBlocks: { - code: string; - resource: Uri; - markdownBeforeBlock?: string; - }[]; - readonly conversation: Array< - ConversationRequest | ConversationResponse - >; // for every prior response that contains codeblocks, make sure we pass the code as well as the resources based on the reported codemapper URIs - } - - export interface MappedEditsResponseStream { - textEdit(target: Uri, edits: TextEdit | TextEdit[]): void; - } - - export interface MappedEditsResult { - readonly errorMessage?: string; - } - - /** - * Interface for providing mapped edits for a given document. - */ - export interface MappedEditsProvider2 { - provideMappedEdits( - request: MappedEditsRequest, - result: MappedEditsResponseStream, - token: CancellationToken, - ): ProviderResult; - } - - namespace chat { - export function registerMappedEditsProvider( - documentSelector: DocumentSelector, - provider: MappedEditsProvider, - ): Disposable; - - export function registerMappedEditsProvider2( - provider: MappedEditsProvider2, - ): Disposable; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.multiDocumentHighlightProvider.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.multiDocumentHighlightProvider.d.ts deleted file mode 100644 index 7bf14ad7..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.multiDocumentHighlightProvider.d.ts +++ /dev/null @@ -1,66 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module "vscode" { - /** - * Represents a collection of document highlights from multiple documents. - */ - export class MultiDocumentHighlight { - /** - * The URI of the document containing the highlights. - */ - uri: Uri; - - /** - * The highlights for the document. - */ - highlights: DocumentHighlight[]; - - /** - * Creates a new instance of MultiDocumentHighlight. - * @param uri The URI of the document containing the highlights. - * @param highlights The highlights for the document. - */ - constructor(uri: Uri, highlights: DocumentHighlight[]); - } - - export interface MultiDocumentHighlightProvider { - /** - * Provide a set of document highlights, like all occurrences of a variable or - * all exit-points of a function. - * - * @param document The document in which the command was invoked. - * @param position The position at which the command was invoked. - * @param otherDocuments An array of additional valid documents for which highlights should be provided. - * @param token A cancellation token. - * @returns A Map containing a mapping of the Uri of a document to the document highlights or a thenable that resolves to such. The lack of a result can be - * signaled by returning `undefined`, `null`, or an empty map. - */ - provideMultiDocumentHighlights( - document: TextDocument, - position: Position, - otherDocuments: TextDocument[], - token: CancellationToken, - ): ProviderResult; - } - - namespace languages { - /** - * Register a multi document highlight provider. - * - * Multiple providers can be registered for a language. In that case providers are sorted - * by their {@link languages.match score} and groups sequentially asked for document highlights. - * The process stops when a provider returns a `non-falsy` or `non-failure` result. - * - * @param selector A selector that defines the documents this provider is applicable to. - * @param provider A multi-document highlight provider. - * @returns A {@link Disposable} that unregisters this provider when being disposed. - */ - export function registerMultiDocumentHighlightProvider( - selector: DocumentSelector, - provider: MultiDocumentHighlightProvider, - ): Disposable; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.newSymbolNamesProvider.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.newSymbolNamesProvider.d.ts deleted file mode 100644 index 962c2678..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.newSymbolNamesProvider.d.ts +++ /dev/null @@ -1,53 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -// https://github.com/microsoft/vscode/issues/204345 @ulugbekna - -declare module "vscode" { - export enum NewSymbolNameTag { - AIGenerated = 1, - } - - export enum NewSymbolNameTriggerKind { - Invoke = 0, - Automatic = 1, - } - - export class NewSymbolName { - readonly newSymbolName: string; - readonly tags?: readonly NewSymbolNameTag[]; - - constructor(newSymbolName: string, tags?: readonly NewSymbolNameTag[]); - } - - export interface NewSymbolNamesProvider { - /** - * @default false - */ - readonly supportsAutomaticTriggerKind?: Thenable; - - /** - * Provide possible new names for the symbol at the given range. - * - * @param document The document in which the symbol is defined. - * @param range The range that spans the symbol being renamed. - * @param token A cancellation token. - * @return A list of new symbol names. - */ - provideNewSymbolNames( - document: TextDocument, - range: Range, - triggerKind: NewSymbolNameTriggerKind, - token: CancellationToken, - ): ProviderResult; - } - - export namespace languages { - export function registerNewSymbolNamesProvider( - selector: DocumentSelector, - provider: NewSymbolNamesProvider, - ): Disposable; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.notebookCellExecution.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.notebookCellExecution.d.ts deleted file mode 100644 index 99c7f164..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.notebookCellExecution.d.ts +++ /dev/null @@ -1,45 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module "vscode" { - export interface NotebookCellExecution { - /** - * Signal that execution has ended. - * - * @param success If true, a green check is shown on the cell status bar. - * If false, a red X is shown. - * If undefined, no check or X icon is shown. - * @param endTime The time that execution finished, in milliseconds in the Unix epoch. - * @param error Details about an error that occurred during execution if any. - */ - end( - success: boolean | undefined, - endTime?: number, - error?: CellExecutionError, - ): void; - } - - export interface CellExecutionError { - /** - * The error message. - */ - readonly message: string; - - /** - * The error stack trace. - */ - readonly stack: string | undefined; - - /** - * The cell resource which had the error. - */ - uri: Uri; - - /** - * The location within the resource where the error occurred. - */ - readonly location: Range | undefined; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.notebookCellExecutionState.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.notebookCellExecutionState.d.ts deleted file mode 100644 index e189882c..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.notebookCellExecutionState.d.ts +++ /dev/null @@ -1,50 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module "vscode" { - // https://github.com/microsoft/vscode/issues/124970 - - /** - * The execution state of a notebook cell. - */ - export enum NotebookCellExecutionState { - /** - * The cell is idle. - */ - Idle = 1, - /** - * Execution for the cell is pending. - */ - Pending = 2, - /** - * The cell is currently executing. - */ - Executing = 3, - } - - /** - * An event describing a cell execution state change. - */ - export interface NotebookCellExecutionStateChangeEvent { - /** - * The {@link NotebookCell cell} for which the execution state has changed. - */ - readonly cell: NotebookCell; - - /** - * The new execution state of the cell. - */ - readonly state: NotebookCellExecutionState; - } - - export namespace notebooks { - /** - * An {@link Event} which fires when the execution state of a cell has changed. - */ - // todo@API this is an event that is fired for a property that cells don't have and that makes me wonder - // how a correct consumer works, e.g the consumer could have been late and missed an event? - export const onDidChangeNotebookCellExecutionState: Event; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.notebookControllerAffinityHidden.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.notebookControllerAffinityHidden.d.ts deleted file mode 100644 index 4493b88c..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.notebookControllerAffinityHidden.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module "vscode" { - // https://github.com/microsoft/vscode/issues/161144 - export enum NotebookControllerAffinity2 { - Default = 1, - Preferred = 2, - Hidden = -1, - } - - export interface NotebookController { - updateNotebookAffinity( - notebook: NotebookDocument, - affinity: NotebookControllerAffinity | NotebookControllerAffinity2, - ): void; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.notebookDeprecated.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.notebookDeprecated.d.ts deleted file mode 100644 index 86ec2278..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.notebookDeprecated.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module "vscode" { - // https://github.com/microsoft/vscode/issues/106744 - - export interface NotebookCellOutput { - /** - * @deprecated - */ - id: string; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.notebookExecution.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.notebookExecution.d.ts deleted file mode 100644 index 7a882d5c..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.notebookExecution.d.ts +++ /dev/null @@ -1,38 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module "vscode" { - /** - * A NotebookExecution is how {@link NotebookController notebook controller} can indicate whether the notebook controller is busy or not. - * - * When {@linkcode NotebookExecution.start start()} is called on the execution task, it causes the Notebook to enter a executing state . - * When {@linkcode NotebookExecution.end end()} is called, it enters the idle state. - */ - export interface NotebookExecution { - /** - * Signal that the execution has begun. - */ - start(): void; - - /** - * Signal that execution has ended. - */ - end(): void; - } - - export interface NotebookController { - /** - * Create an execution task. - * - * _Note_ that there can only be one execution per Notebook, that also includes NotebookCellExecutions and t an error is thrown if - * a cell execution or another NotebookExecution is created while another is still active. - * - * This should be used to indicate the {@link NotebookController notebook controller} is busy even though user may not have executed any cell though the UI. - * @param notebook - * @returns A notebook execution. - */ - createNotebookExecution(notebook: NotebookDocument): NotebookExecution; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.notebookKernelSource.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.notebookKernelSource.d.ts deleted file mode 100644 index a926222f..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.notebookKernelSource.d.ts +++ /dev/null @@ -1,53 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module "vscode" { - export interface NotebookControllerDetectionTask { - /** - * Dispose and remove the detection task. - */ - dispose(): void; - } - - export class NotebookKernelSourceAction { - readonly label: string; - readonly description?: string; - readonly detail?: string; - readonly command: string | Command; - readonly documentation?: Uri; - - constructor(label: string); - } - - export interface NotebookKernelSourceActionProvider { - /** - * An optional event to signal that the kernel source actions have changed. - */ - onDidChangeNotebookKernelSourceActions?: Event; - /** - * Provide kernel source actions - */ - provideNotebookKernelSourceActions( - token: CancellationToken, - ): ProviderResult; - } - - export namespace notebooks { - /** - * Create notebook controller detection task - */ - export function createNotebookControllerDetectionTask( - notebookType: string, - ): NotebookControllerDetectionTask; - - /** - * Register a notebook kernel source action provider - */ - export function registerKernelSourceActionProvider( - notebookType: string, - provider: NotebookKernelSourceActionProvider, - ): Disposable; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.notebookLiveShare.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.notebookLiveShare.d.ts deleted file mode 100644 index 2ff1b55b..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.notebookLiveShare.d.ts +++ /dev/null @@ -1,27 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module "vscode" { - // https://github.com/microsoft/vscode/issues/106744 - - export interface NotebookRegistrationData { - readonly displayName: string; - readonly filenamePattern: ReadonlyArray< - | GlobPattern - | { readonly include: GlobPattern; readonly exclude: GlobPattern } - >; - readonly exclusive?: boolean; - } - - export namespace workspace { - // SPECIAL overload with NotebookRegistrationData - export function registerNotebookSerializer( - notebookType: string, - serializer: NotebookSerializer, - options?: NotebookDocumentContentOptions, - registration?: NotebookRegistrationData, - ): Disposable; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.notebookMessaging.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.notebookMessaging.d.ts deleted file mode 100644 index 53185894..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.notebookMessaging.d.ts +++ /dev/null @@ -1,77 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module "vscode" { - // https://github.com/microsoft/vscode/issues/123601 - - /** - * Represents a script that is loaded into the notebook renderer before rendering output. This allows - * to provide and share functionality for notebook markup and notebook output renderers. - */ - export class NotebookRendererScript { - /** - * APIs that the preload provides to the renderer. These are matched - * against the `dependencies` and `optionalDependencies` arrays in the - * notebook renderer contribution point. - */ - provides: readonly string[]; - - /** - * URI of the JavaScript module to preload. - * - * This module must export an `activate` function that takes a context object that contains the notebook API. - */ - uri: Uri; - - /** - * @param uri URI of the JavaScript module to preload - * @param provides Value for the `provides` property - */ - constructor(uri: Uri, provides?: string | readonly string[]); - } - - export interface NotebookController { - // todo@API allow add, not remove - readonly rendererScripts: NotebookRendererScript[]; - - /** - * An event that fires when a {@link NotebookController.rendererScripts renderer script} has send a message to - * the controller. - */ - readonly onDidReceiveMessage: Event<{ - readonly editor: NotebookEditor; - readonly message: any; - }>; - - /** - * Send a message to the renderer of notebook editors. - * - * Note that only editors showing documents that are bound to this controller - * are receiving the message. - * - * @param message The message to send. - * @param editor A specific editor to send the message to. When `undefined` all applicable editors are receiving the message. - * @returns A promise that resolves to a boolean indicating if the message has been send or not. - */ - postMessage(message: any, editor?: NotebookEditor): Thenable; - - //todo@API validate this works - asWebviewUri(localResource: Uri): Uri; - } - - export namespace notebooks { - export function createNotebookController( - id: string, - viewType: string, - label: string, - handler?: ( - cells: NotebookCell[], - notebook: NotebookDocument, - controller: NotebookController, - ) => void | Thenable, - rendererScripts?: NotebookRendererScript[], - ): NotebookController; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.notebookMime.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.notebookMime.d.ts deleted file mode 100644 index f6f7fbc4..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.notebookMime.d.ts +++ /dev/null @@ -1,32 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module "vscode" { - // https://github.com/microsoft/vscode/issues/126280 @mjbvz - - export interface NotebookCellData { - /** - * Mime type determines how the cell's `value` is interpreted. - * - * The mime selects which notebook renders is used to render the cell. - * - * If not set, internally the cell is treated as having a mime type of `text/plain`. - * Cells that set `language` to `markdown` instead are treated as `text/markdown`. - */ - mime?: string; - } - - export interface NotebookCell { - /** - * Mime type determines how the markup cell's `value` is interpreted. - * - * The mime selects which notebook renders is used to render the cell. - * - * If not set, internally the cell is treated as having a mime type of `text/plain`. - * Cells that set `language` to `markdown` instead are treated as `text/markdown`. - */ - mime: string | undefined; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.notebookReplDocument.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.notebookReplDocument.d.ts deleted file mode 100644 index d3ca539d..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.notebookReplDocument.d.ts +++ /dev/null @@ -1,35 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module "vscode" { - export interface NotebookDocumentShowOptions { - /** - * The notebook should be opened in a REPL editor, - * where the last cell of the notebook is an input box and the other cells are the read-only history. - * When the value is a string, it will be used as the label for the editor tab. - */ - readonly asRepl?: - | boolean - | string - | { - /** - * The label to be used for the editor tab. - */ - readonly label: string; - }; - } - - export interface NotebookEditor { - /** - * Information about the REPL editor if the notebook was opened as a repl. - */ - replOptions?: { - /** - * The index where new cells should be appended. - */ - appendIndex: number; - }; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.notebookVariableProvider.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.notebookVariableProvider.d.ts deleted file mode 100644 index e348c197..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.notebookVariableProvider.d.ts +++ /dev/null @@ -1,59 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ -declare module "vscode" { - export interface NotebookController { - /** Set this to attach a variable provider to this controller. */ - variableProvider?: NotebookVariableProvider; - } - - export enum NotebookVariablesRequestKind { - Named = 1, - Indexed = 2, - } - - interface VariablesResult { - variable: Variable; - hasNamedChildren: boolean; - indexedChildrenCount: number; - } - - interface NotebookVariableProvider { - onDidChangeVariables: Event; - - /** When parent is undefined, this is requesting global Variables. When a variable is passed, it's requesting child props of that Variable. */ - provideVariables( - notebook: NotebookDocument, - parent: Variable | undefined, - kind: NotebookVariablesRequestKind, - start: number, - token: CancellationToken, - ): AsyncIterable; - } - - interface Variable { - /** The variable's name. */ - name: string; - - /** The variable's value. - This can be a multi-line text, e.g. for a function the body of a function. - For structured variables (which do not have a simple value), it is recommended to provide a one-line representation of the structured object. - This helps to identify the structured object in the collapsed state when its children are not yet visible. - An empty string can be used if no value should be shown in the UI. - */ - value: string; - - /** The code that represents how the variable would be accessed in the runtime environment */ - expression?: string; - - /** The type of the variable's value */ - type?: string; - - /** The interfaces or contracts that the type satisfies */ - interfaces?: string[]; - - /** The language of the variable's value */ - language?: string; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.portsAttributes.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.portsAttributes.d.ts deleted file mode 100644 index c8ffc538..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.portsAttributes.d.ts +++ /dev/null @@ -1,105 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module "vscode" { - // https://github.com/microsoft/vscode/issues/115616 @alexr00 - - /** - * The action that should be taken when a port is discovered through automatic port forwarding discovery. - */ - export enum PortAutoForwardAction { - /** - * Notify the user that the port is being forwarded. This is the default action. - */ - Notify = 1, - /** - * Once the port is forwarded, open the user's web browser to the forwarded port. - */ - OpenBrowser = 2, - /** - * Once the port is forwarded, open the preview browser to the forwarded port. - */ - OpenPreview = 3, - /** - * Forward the port silently. - */ - Silent = 4, - /** - * Do not forward the port. - */ - Ignore = 5, - } - - /** - * The attributes that a forwarded port can have. - */ - export class PortAttributes { - /** - * The action to be taken when this port is detected for auto forwarding. - */ - autoForwardAction: PortAutoForwardAction; - - /** - * Creates a new PortAttributes object - * @param port the port number - * @param autoForwardAction the action to take when this port is detected - */ - constructor(autoForwardAction: PortAutoForwardAction); - } - - /** - * A provider of port attributes. Port attributes are used to determine what action should be taken when a port is discovered. - */ - export interface PortAttributesProvider { - /** - * Provides attributes for the given port. For ports that your extension doesn't know about, simply - * return undefined. For example, if `providePortAttributes` is called with ports 3000 but your - * extension doesn't know anything about 3000 you should return undefined. - * @param port The port number of the port that attributes are being requested for. - * @param pid The pid of the process that is listening on the port. If the pid is unknown, undefined will be passed. - * @param commandLine The command line of the process that is listening on the port. If the command line is unknown, undefined will be passed. - * @param token A cancellation token that indicates the result is no longer needed. - */ - providePortAttributes( - attributes: { port: number; pid?: number; commandLine?: string }, - token: CancellationToken, - ): ProviderResult; - } - - /** - * A selector that will be used to filter which {@link PortAttributesProvider} should be called for each port. - */ - export interface PortAttributesSelector { - /** - * Specifying a port range will cause your provider to only be called for ports within the range. - * The start is inclusive and the end is exclusive. - */ - portRange?: [number, number] | number; - - /** - * Specifying a command pattern will cause your provider to only be called for processes whose command line matches the pattern. - */ - commandPattern?: RegExp; - } - - export namespace workspace { - /** - * If your extension listens on ports, consider registering a PortAttributesProvider to provide information - * about the ports. For example, a debug extension may know about debug ports in it's debuggee. By providing - * this information with a PortAttributesProvider the extension can tell the editor that these ports should be - * ignored, since they don't need to be user facing. - * - * The results of the PortAttributesProvider are merged with the user setting `remote.portsAttributes`. If the values conflict, the user setting takes precedence. - * - * @param portSelector It is best practice to specify a port selector to avoid unnecessary calls to your provider. - * If you don't specify a port selector your provider will be called for every port, which will result in slower port forwarding for the user. - * @param provider The {@link PortAttributesProvider PortAttributesProvider}. - */ - export function registerPortAttributesProvider( - portSelector: PortAttributesSelector, - provider: PortAttributesProvider, - ): Disposable; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.profileContentHandlers.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.profileContentHandlers.d.ts deleted file mode 100644 index 466a49d8..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.profileContentHandlers.d.ts +++ /dev/null @@ -1,27 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module "vscode" { - export interface ProfileContentHandler { - readonly name: string; - readonly description?: string; - saveProfile( - name: string, - content: string, - token: CancellationToken, - ): Thenable<{ readonly id: string; readonly link: Uri } | null>; - readProfile( - idOrUri: string | Uri, - token: CancellationToken, - ): Thenable; - } - - export namespace window { - export function registerProfileContentHandler( - id: string, - profileContentHandler: ProfileContentHandler, - ): Disposable; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.quickDiffProvider.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.quickDiffProvider.d.ts deleted file mode 100644 index 5a904b5b..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.quickDiffProvider.d.ts +++ /dev/null @@ -1,21 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module "vscode" { - // https://github.com/microsoft/vscode/issues/169012 - - export namespace window { - export function registerQuickDiffProvider( - selector: DocumentSelector, - quickDiffProvider: QuickDiffProvider, - label: string, - rootUri?: Uri, - ): Disposable; - } - - interface QuickDiffProvider { - label?: string; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.quickInputButtonLocation.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.quickInputButtonLocation.d.ts deleted file mode 100644 index b19cd30d..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.quickInputButtonLocation.d.ts +++ /dev/null @@ -1,28 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module "vscode" { - // https://github.com/microsoft/vscode/issues/175662 - - export enum QuickInputButtonLocation { - /** - * In the title bar. - */ - Title = 1, - - /** - * To the right of the input box. - */ - Inline = 2, - } - - export interface QuickInputButton { - /** - * Where the button should be rendered. The default is {@link QuickInputButtonLocation.Title}. - * @note This property is ignored if the button was added to a QuickPickItem. - */ - location?: QuickInputButtonLocation; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.quickPickItemTooltip.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.quickPickItemTooltip.d.ts deleted file mode 100644 index ec784d89..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.quickPickItemTooltip.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module "vscode" { - // https://github.com/microsoft/vscode/issues/175662 - - export interface QuickPickItem { - /** - * A tooltip that is rendered when hovering over the item. - */ - tooltip?: string | MarkdownString; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.quickPickSortByLabel.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.quickPickSortByLabel.d.ts deleted file mode 100644 index 0e975b33..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.quickPickSortByLabel.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module "vscode" { - // https://github.com/microsoft/vscode/issues/73904 - - export interface QuickPick extends QuickInput { - /** - * An optional flag to sort the final results by index of first query match in label. Defaults to true. - */ - // @API is a bug that we need this API at all. why do we change the sort order - // when extensions give us a (sorted) array of items? - // @API sortByLabel isn't a great name - sortByLabel: boolean; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.resolvers.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.resolvers.d.ts deleted file mode 100644 index 09b86328..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.resolvers.d.ts +++ /dev/null @@ -1,524 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module "vscode" { - //resolvers: @alexdima - - export interface MessageOptions { - /** - * Do not render a native message box. - */ - useCustom?: boolean; - } - - export interface RemoteAuthorityResolverContext { - resolveAttempt: number; - /** - * Exec server from a recursively-resolved remote authority. If the - * remote authority includes nested authorities delimited by `@`, it is - * resolved from outer to inner authorities with ExecServer passed down - * to each resolver in the chain. - */ - execServer?: ExecServer; - } - - export class ResolvedAuthority { - readonly host: string; - readonly port: number; - readonly connectionToken: string | undefined; - - constructor(host: string, port: number, connectionToken?: string); - } - - export interface ManagedMessagePassing { - onDidReceiveMessage: Event; - onDidClose: Event; - onDidEnd: Event; - - send: (data: Uint8Array) => void; - end: () => void; - drain?: () => Thenable; - } - - export class ManagedResolvedAuthority { - readonly makeConnection: () => Thenable; - readonly connectionToken: string | undefined; - - constructor( - makeConnection: () => Thenable, - connectionToken?: string, - ); - } - - export interface ResolvedOptions { - extensionHostEnv?: { [key: string]: string | null }; - - isTrusted?: boolean; - - /** - * When provided, remote server will be initialized with the extensions synced using the given user account. - */ - authenticationSessionForInitializingExtensions?: AuthenticationSession & { - providerId: string; - }; - } - - export interface TunnelPrivacy { - themeIcon: string; - id: string; - label: string; - } - - export namespace env { - /** Quality of the application. May be undefined if running from sources. */ - export const appQuality: string | undefined; - /** Commit of the application. May be undefined if running from sources. */ - export const appCommit: string | undefined; - } - - interface TunnelOptions { - remoteAddress: { port: number; host: string }; - // The desired local port. If this port can't be used, then another will be chosen. - localAddressPort?: number; - label?: string; - /** - * @deprecated Use privacy instead - */ - public?: boolean; - privacy?: string; - protocol?: string; - } - - interface TunnelDescription { - remoteAddress: { port: number; host: string }; - //The complete local address(ex. localhost:1234) - localAddress: { port: number; host: string } | string; - /** - * @deprecated Use privacy instead - */ - public?: boolean; - privacy?: string; - // If protocol is not provided it is assumed to be http, regardless of the localAddress. - protocol?: string; - } - - interface Tunnel extends TunnelDescription { - // Implementers of Tunnel should fire onDidDispose when dispose is called. - onDidDispose: Event; - dispose(): void | Thenable; - } - - /** - * Used as part of the ResolverResult if the extension has any candidate, - * published, or forwarded ports. - */ - export interface TunnelInformation { - /** - * Tunnels that are detected by the extension. The remotePort is used for display purposes. - * The localAddress should be the complete local address (ex. localhost:1234) for connecting to the port. Tunnels provided through - * detected are read-only from the forwarded ports UI. - */ - environmentTunnels?: TunnelDescription[]; - - tunnelFeatures?: { - elevation: boolean; - /** - * One of the the options must have the ID "private". - */ - privacyOptions: TunnelPrivacy[]; - /** - * Defaults to true for backwards compatibility. - */ - protocol?: boolean; - }; - } - - export interface TunnelCreationOptions { - /** - * True when the local operating system will require elevation to use the requested local port. - */ - elevationRequired?: boolean; - } - - export enum CandidatePortSource { - None = 0, - Process = 1, - Output = 2, - Hybrid = 3, - } - - export type ResolverResult = ( - | ResolvedAuthority - | ManagedResolvedAuthority - ) & - ResolvedOptions & - TunnelInformation; - - export class RemoteAuthorityResolverError extends Error { - static NotAvailable( - message?: string, - handled?: boolean, - ): RemoteAuthorityResolverError; - static TemporarilyNotAvailable( - message?: string, - ): RemoteAuthorityResolverError; - - constructor(message?: string); - } - - /** - * An ExecServer allows spawning processes on a remote machine. An ExecServer is provided by resolvers. It can be - * acquired by `workspace.getRemoteExecServer` or from the context when in a resolver (`RemoteAuthorityResolverContext.execServer`). - */ - export interface ExecServer { - /** - * Spawns a given subprocess with the given command and arguments. - * @param command The command to execute. - * @param args The arguments to pass to the command. - * @param options Additional options for the spawned process. - * @returns A promise that gives access to the process' stdin, stdout and stderr streams, as well as the process' exit code. - */ - spawn( - command: string, - args: string[], - options?: ExecServerSpawnOptions, - ): Thenable; - - /** - * Spawns an connector that allows to start a remote server. It is assumed the command starts a Code CLI. Additional - * arguments will be passed to the connector. - * @param command The command to execute. It is assumed the command spawns a Code CLI executable. - * @param args The arguments to pass to the connector - * @param options Additional options for the spawned process. - * @returns A promise that gives access to the spawned {@link RemoteServerConnector}. It also provides a stream to which standard - * log messages are written. - */ - spawnRemoteServerConnector?( - command: string, - args: string[], - options?: ExecServerSpawnOptions, - ): Thenable; - - /** - * Downloads the CLI executable of the desired platform and quality and pipes it to the - * provided process' stdin. - * @param buildTarget The CLI build target to download. - * @param command The command to execute. The downloaded bits will be piped to the command's stdin. - * @param args The arguments to pass to the command. - * @param options Additional options for the spawned process. - * @returns A promise that resolves when the process exits with a {@link ProcessExit} object. - */ - downloadCliExecutable?( - buildTarget: CliBuild, - command: string, - args: string[], - options?: ExecServerSpawnOptions, - ): Thenable; - - /** - * Gets the environment where the exec server is running. - * @returns A promise that resolves to an {@link ExecEnvironment} object. - */ - env(): Thenable; - - /** - * Kills a process with the given ID. - * - * @param processId process ID to kill. - */ - kill(processId: number): Thenable; - - /** - * Connects to the given TCP host/port on the remote. - * - * @param host The hostname or IP to connect to - * @param port The port number to connect to - * @returns a duplex stream, and a promise the resolves when both sides - * have closed. - */ - tcpConnect( - host: string, - port: number, - ): Thenable<{ stream: WriteStream & ReadStream; done: Thenable }>; - - /** - * Access to the file system of the remote. - */ - readonly fs: RemoteFileSystem; - } - - export type ProcessEnv = Record; - - export interface ExecServerSpawnOptions { - readonly env?: ProcessEnv; - readonly cwd?: string; - } - - export interface SpawnedCommand { - readonly stdin: WriteStream; - readonly stdout: ReadStream; - readonly stderr: ReadStream; - readonly onExit: Thenable; - } - - export interface RemoteServerConnector { - readonly logs: ReadStream; - readonly onExit: Thenable; - /** - * Connect to a new code server, returning a stream that can be used to communicate with it. - * @param params The parameters for the code server. - * @returns A promise that resolves to a {@link ManagedMessagePassing} object that can be used with a resolver - */ - connect(params: ServeParams): Thenable; - } - - export interface ProcessExit { - readonly status: number; - readonly message?: string; - } - - export interface ReadStream { - readonly onDidReceiveMessage: Event; - readonly onEnd: Thenable; - } - - export interface WriteStream { - write(data: Uint8Array): void; - end(): void; - } - - export interface ServeParams { - readonly socketId: number; - readonly commit?: string; - readonly quality: string; - readonly extensions: string[]; - /** Whether server traffic should be compressed. */ - readonly compress?: boolean; - /** Optional explicit connection token for the server. */ - readonly connectionToken?: string; - } - - export interface CliBuild { - readonly quality: string; - /** 'LinuxAlpineX64' | 'LinuxAlpineARM64', 'LinuxX64' | 'LinuxARM64' | 'LinuxARM32' | 'DarwinX64' | 'DarwinARM64' | 'WindowsX64' | 'WindowsX86' | 'WindowsARM64' */ - readonly buildTarget: string; - readonly commit: string; - } - - export interface ExecEnvironment { - readonly env: ProcessEnv; - /** 'darwin' | 'linux' | 'win32' */ - readonly osPlatform: string; - /** uname.version or windows version number, undefined if it could not be read. */ - readonly osRelease?: string; - } - - export interface RemoteFileSystem { - /** - * Retrieve metadata about a file. - * - * @param path The path of the file to retrieve metadata about. - * @returns The file metadata about the file. - * @throws an exception when `path` doesn't exist. - */ - stat(path: string): Thenable; - - /** - * Recursively creates the given directory on the remote. - * - * @param path The path of the folder to create - * @throws an exception when `path` is a file, or other i/o operations happen - */ - mkdirp(path: string): Thenable; - - /** - * Recursively deletes the given path on the remote. - * - * @param path The path of the file or folder to delete. - * @throws if an i/o error happens during removal. It does not throw if - * the path already does not exist. - */ - rm(path: string): Thenable; - - /** - * Reads the given file from the remote. - * - * @param path The path of the file to read. - * @throws if the path doesn't exist or can't be accessed - * @returns a readable stream of the file data - */ - read(path: string): Thenable; - - /** - * Writes the given file on the remote. Truncates the file if it exists. - * - * @param path The path of the file to write. - * @throws if the path can't be accessed - * @returns a writable `stream` that accepts data, and a `done` promise that - * will resolve after `stream.end()` is called once the write is complete. - */ - write( - path: string, - ): Thenable<{ stream: WriteStream; done: Thenable }>; - - /** - * Connects to the given unix socket or named pipe on the remote. - * - * @param path The path of the unix socket or named pipe - * @throws if the path can't be accessed - * @returns a duplex stream, and a promise the resolves when both sides - * have closed. - */ - connect( - path: string, - ): Thenable<{ stream: WriteStream & ReadStream; done: Thenable }>; - - /** - * Renames the file. - * - * @param fromPath The existing file path. - * @param toPath The new file path. - * @throws if the original path doesn't exist, or the toPath can't be accessed - */ - rename(fromPath: string, toPath: string): Thenable; - - /** - * Reads the contents of a directory. - * - * @param path The path of the folder to read. - * @throws if the folder doesn't exist - * @returns a list of directory entries - */ - readdir(path: string): Thenable; - } - - export interface DirectoryEntry { - /** - * The type of the file, e.g. is a regular file, a directory, or symbolic link - * to a file. - * - * *Note:* This value might be a bitmask, e.g. `FileType.File | FileType.SymbolicLink`. - */ - type: FileType; - - /** - * Non-absolute name of the file in the directory. - */ - name: string; - } - - export interface RemoteAuthorityResolver { - /** - * Resolve the authority part of the current opened `vscode-remote://` URI. - * - * This method will be invoked once during the startup of the editor and again each time - * the editor detects a disconnection. - * - * @param authority The authority part of the current opened `vscode-remote://` URI. - * @param context A context indicating if this is the first call or a subsequent call. - */ - resolve( - authority: string, - context: RemoteAuthorityResolverContext, - ): ResolverResult | Thenable; - - /** - * Resolves an exec server interface for the authority. Called if an - * authority is a midpoint in a transit to the desired remote. - * - * @param authority The authority part of the current opened `vscode-remote://` URI. - * @returns The exec server interface, as defined in a contract between extensions. - */ - resolveExecServer?( - remoteAuthority: string, - context: RemoteAuthorityResolverContext, - ): ExecServer | Thenable; - - /** - * Get the canonical URI (if applicable) for a `vscode-remote://` URI. - * - * @returns The canonical URI or undefined if the uri is already canonical. - */ - getCanonicalURI?(uri: Uri): ProviderResult; - - /** - * Can be optionally implemented if the extension can forward ports better than the core. - * When not implemented, the core will use its default forwarding logic. - * When implemented, the core will use this to forward ports. - * - * To enable the "Change Local Port" action on forwarded ports, make sure to set the `localAddress` of - * the returned `Tunnel` to a `{ port: number, host: string; }` and not a string. - */ - tunnelFactory?: ( - tunnelOptions: TunnelOptions, - tunnelCreationOptions: TunnelCreationOptions, - ) => Thenable | undefined; - - /**p - * Provides filtering for candidate ports. - */ - showCandidatePort?: ( - host: string, - port: number, - detail: string, - ) => Thenable; - - /** - * @deprecated Return tunnelFeatures as part of the resolver result in tunnelInformation. - */ - tunnelFeatures?: { - elevation: boolean; - public: boolean; - privacyOptions: TunnelPrivacy[]; - }; - - candidatePortSource?: CandidatePortSource; - } - - export interface ResourceLabelFormatter { - scheme: string; - authority?: string; - formatting: ResourceLabelFormatting; - } - - export interface ResourceLabelFormatting { - label: string; // myLabel:/${path} - // For historic reasons we use an or string here. Once we finalize this API we should start using enums instead and adopt it in extensions. - // eslint-disable-next-line local/vscode-dts-literal-or-types, local/vscode-dts-string-type-literals - separator: "/" | "\\" | ""; - tildify?: boolean; - normalizeDriveLetter?: boolean; - workspaceSuffix?: string; - workspaceTooltip?: string; - authorityPrefix?: string; - stripPathStartingSeparator?: boolean; - } - - export namespace workspace { - export function registerRemoteAuthorityResolver( - authorityPrefix: string, - resolver: RemoteAuthorityResolver, - ): Disposable; - export function registerResourceLabelFormatter( - formatter: ResourceLabelFormatter, - ): Disposable; - export function getRemoteExecServer( - authority: string, - ): Thenable; - } - - export namespace env { - /** - * The authority part of the current opened `vscode-remote://` URI. - * Defined by extensions, e.g. `ssh-remote+${host}` for remotes using a secure shell. - * - * *Note* that the value is `undefined` when there is no remote extension host but that the - * value is defined in all extension hosts (local and remote) in case a remote extension host - * exists. Use {@link Extension.extensionKind} to know if - * a specific extension runs remote or not. - */ - export const remoteAuthority: string | undefined; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.scmActionButton.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.scmActionButton.d.ts deleted file mode 100644 index af7aaef7..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.scmActionButton.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module "vscode" { - // https://github.com/microsoft/vscode/issues/133935 - - export interface SourceControlActionButton { - command: Command & { shortTitle?: string }; - secondaryCommands?: Command[][]; - enabled: boolean; - } - - export interface SourceControl { - actionButton?: SourceControlActionButton; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.scmHistoryProvider.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.scmHistoryProvider.d.ts deleted file mode 100644 index c0d4c2aa..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.scmHistoryProvider.d.ts +++ /dev/null @@ -1,105 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module "vscode" { - // https://github.com/microsoft/vscode/issues/185269 - - export interface SourceControl { - historyProvider?: SourceControlHistoryProvider; - } - - export interface SourceControlHistoryProvider { - readonly currentHistoryItemRef: SourceControlHistoryItemRef | undefined; - readonly currentHistoryItemRemoteRef: - | SourceControlHistoryItemRef - | undefined; - readonly currentHistoryItemBaseRef: - | SourceControlHistoryItemRef - | undefined; - - /** - * Fires when the current history item refs (local, remote, base) - * change after a user action (ex: commit, checkout, fetch, pull, push) - */ - onDidChangeCurrentHistoryItemRefs: Event; - - /** - * Fires when history item refs change - */ - onDidChangeHistoryItemRefs: Event; - - provideHistoryItemRefs( - historyItemRefs: string[] | undefined, - token: CancellationToken, - ): ProviderResult; - provideHistoryItems( - options: SourceControlHistoryOptions, - token: CancellationToken, - ): ProviderResult; - provideHistoryItemChanges( - historyItemId: string, - historyItemParentId: string | undefined, - token: CancellationToken, - ): ProviderResult; - - resolveHistoryItemRefsCommonAncestor( - historyItemRefs: string[], - token: CancellationToken, - ): ProviderResult; - } - - export interface SourceControlHistoryOptions { - readonly skip?: number; - readonly limit?: number | { id?: string }; - readonly historyItemRefs?: readonly string[]; - } - - export interface SourceControlHistoryItemStatistics { - readonly files: number; - readonly insertions: number; - readonly deletions: number; - } - - export interface SourceControlHistoryItem { - readonly id: string; - readonly parentIds: string[]; - readonly message: string; - readonly displayId?: string; - readonly author?: string; - readonly timestamp?: number; - readonly statistics?: SourceControlHistoryItemStatistics; - readonly references?: SourceControlHistoryItemRef[]; - } - - export interface SourceControlHistoryItemRef { - readonly id: string; - readonly name: string; - readonly description?: string; - readonly revision?: string; - readonly category?: string; - readonly icon?: Uri | { light: Uri; dark: Uri } | ThemeIcon; - } - - export interface SourceControlHistoryItemChange { - readonly uri: Uri; - readonly originalUri: Uri | undefined; - readonly modifiedUri: Uri | undefined; - readonly renameUri: Uri | undefined; - } - - export interface SourceControlHistoryItemRefsChangeEvent { - readonly added: readonly SourceControlHistoryItemRef[]; - readonly removed: readonly SourceControlHistoryItemRef[]; - readonly modified: readonly SourceControlHistoryItemRef[]; - - /** - * Flag to indicate if the operation that caused the event to trigger was due - * to a user action or a background operation (ex: Auto Fetch). The flag is used - * to determine whether to automatically refresh the user interface or present - * the user with a visual cue that the user interface is outdated. - */ - readonly silent: boolean; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.scmMultiDiffEditor.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.scmMultiDiffEditor.d.ts deleted file mode 100644 index 373fe1c7..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.scmMultiDiffEditor.d.ts +++ /dev/null @@ -1,38 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module "vscode" { - // https://github.com/microsoft/vscode/issues/199291 - - export interface SourceControlResourceState { - /** - * The uri that resolves to the original document of this resource (before the change). - * Used for the multi diff editor exclusively. - */ - readonly multiDiffEditorOriginalUri?: Uri; - - /** - * The uri that resolves to the modified document of this resource (after the change). - * Used for the multi diff editor exclusively. - */ - readonly multiFileDiffEditorModifiedUri?: Uri; - } - - export interface SourceControl { - /** - * Create a new {@link SourceControlResourceGroup resource group}. - * @param id An `id` for the {@link SourceControlResourceGroup resource group}. - * @param label A human-readable string for the {@link SourceControlResourceGroup resource group}. - * @param options Options for the {@link SourceControlResourceGroup resource group}. - * Set `multiDiffEditorEnableViewChanges` to `true` to enable the "View Changes" option which opens the multi file diff editor. - * @return An instance of {@link SourceControlResourceGroup resource group}. - */ - createResourceGroup( - id: string, - label: string, - options: { multiDiffEditorEnableViewChanges?: boolean }, - ): SourceControlResourceGroup; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.scmSelectedProvider.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.scmSelectedProvider.d.ts deleted file mode 100644 index ead2a92c..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.scmSelectedProvider.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module "vscode" { - // todo@joaomoreno add issue reference - - export interface SourceControl { - /** - * Whether the source control is selected. - */ - readonly selected: boolean; - - /** - * An event signaling when the selection state changes. - */ - readonly onDidChangeSelection: Event; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.scmTextDocument.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.scmTextDocument.d.ts deleted file mode 100644 index 5d6cb9dc..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.scmTextDocument.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module "vscode" { - // https://github.com/microsoft/vscode/issues/166615 - - /** - * Represents the input box in the Source Control viewlet. - */ - export interface SourceControlInputBox { - /** - * The {@link TextDocument text} of the input box. - */ - readonly document: TextDocument; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.scmValidation.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.scmValidation.d.ts deleted file mode 100644 index 49583e0b..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.scmValidation.d.ts +++ /dev/null @@ -1,62 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module "vscode" { - // todo@joaomoreno add issue reference - - /** - * Represents the validation type of the Source Control input. - */ - export enum SourceControlInputBoxValidationType { - /** - * Something not allowed by the rules of a language or other means. - */ - Error = 0, - - /** - * Something suspicious but allowed. - */ - Warning = 1, - - /** - * Something to inform about but not a problem. - */ - Information = 2, - } - - export interface SourceControlInputBoxValidation { - /** - * The validation message to display. - */ - readonly message: string | MarkdownString; - - /** - * The validation type. - */ - readonly type: SourceControlInputBoxValidationType; - } - - /** - * Represents the input box in the Source Control viewlet. - */ - export interface SourceControlInputBox { - /** - * Shows a transient contextual message on the input. - */ - showValidationMessage( - message: string | MarkdownString, - type: SourceControlInputBoxValidationType, - ): void; - - /** - * A validation function for the input box. It's possible to change - * the validation provider simply by setting this property to a different function. - */ - validateInput?( - value: string, - cursorPosition: number, - ): ProviderResult; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.shareProvider.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.shareProvider.d.ts deleted file mode 100644 index f25bb1f9..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.shareProvider.d.ts +++ /dev/null @@ -1,76 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -// https://github.com/microsoft/vscode/issues/176316 @joyceerhl - -declare module "vscode" { - /** - * Data about an item which can be shared. - */ - export interface ShareableItem { - /** - * A resource in the workspace that can be shared. - */ - resourceUri: Uri; - - /** - * If present, a selection within the `resourceUri`. - */ - selection?: Range; - } - - /** - * A provider which generates share links for resources in the editor. - */ - export interface ShareProvider { - /** - * A unique ID for the provider. - * This will be used to activate specific extensions contributing share providers if necessary. - */ - readonly id: string; - - /** - * A label which will be used to present this provider's options in the UI. - */ - readonly label: string; - - /** - * The order in which the provider should be listed in the UI when there are multiple providers. - */ - readonly priority: number; - - /** - * - * @param item Data about an item which can be shared. - * @param token A cancellation token. - * @returns A {@link Uri} representing an external link or sharing text. The provider result - * will be copied to the user's clipboard and presented in a confirmation dialog. - */ - provideShare( - item: ShareableItem, - token: CancellationToken, - ): ProviderResult; - } - - export namespace window { - /** - * Register a share provider. An extension may register multiple share providers. - * There may be multiple share providers for the same {@link ShareableItem}. - * @param selector A document selector to filter whether the provider should be shown for a {@link ShareableItem}. - * @param provider A share provider. - */ - export function registerShareProvider( - selector: DocumentSelector, - provider: ShareProvider, - ): Disposable; - } - - export interface TreeItem { - /** - * An optional property which, when set, inlines a `Share` option in the context menu for this tree item. - */ - shareableItem?: ShareableItem; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.showLocal.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.showLocal.d.ts deleted file mode 100644 index fc4158bd..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.showLocal.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -// https://github.com/microsoft/vscode/issues/131138 - -declare module "vscode" { - export interface OpenDialogOptions { - /** - * Controls whether the dialog allows users to select local files via the "Show Local" button. - * Extensions that set this to `true` should check the scheme of the selected file. - * Resources with the `file` scheme come from the same extension host as the extension. - * Resources with the `vscode-local` scheme come from an extension host running in the same place as the UI. - */ - allowUIResources?: boolean; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.speech.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.speech.d.ts deleted file mode 100644 index 1e0128f3..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.speech.d.ts +++ /dev/null @@ -1,83 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module "vscode" { - export interface SpeechToTextOptions { - readonly language?: string; - } - - export enum SpeechToTextStatus { - Started = 1, - Recognizing = 2, - Recognized = 3, - Stopped = 4, - Error = 5, - } - - export interface SpeechToTextEvent { - readonly status: SpeechToTextStatus; - readonly text?: string; - } - - export interface SpeechToTextSession { - readonly onDidChange: Event; - } - - export interface TextToSpeechOptions { - readonly language?: string; - } - - export enum TextToSpeechStatus { - Started = 1, - Stopped = 2, - Error = 3, - } - - export interface TextToSpeechEvent { - readonly status: TextToSpeechStatus; - readonly text?: string; - } - - export interface TextToSpeechSession { - readonly onDidChange: Event; - - synthesize(text: string): void; - } - - export enum KeywordRecognitionStatus { - Recognized = 1, - Stopped = 2, - } - - export interface KeywordRecognitionEvent { - readonly status: KeywordRecognitionStatus; - readonly text?: string; - } - - export interface KeywordRecognitionSession { - readonly onDidChange: Event; - } - - export interface SpeechProvider { - provideSpeechToTextSession( - token: CancellationToken, - options?: SpeechToTextOptions, - ): ProviderResult; - provideTextToSpeechSession( - token: CancellationToken, - options?: TextToSpeechOptions, - ): ProviderResult; - provideKeywordRecognitionSession( - token: CancellationToken, - ): ProviderResult; - } - - export namespace speech { - export function registerSpeechProvider( - id: string, - provider: SpeechProvider, - ): Disposable; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.tabInputMultiDiff.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.tabInputMultiDiff.d.ts deleted file mode 100644 index 0a4a19d0..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.tabInputMultiDiff.d.ts +++ /dev/null @@ -1,27 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -// https://github.com/microsoft/vscode/issues/206411 - -declare module "vscode" { - export class TabInputTextMultiDiff { - readonly textDiffs: TabInputTextDiff[]; - - constructor(textDiffs: TabInputTextDiff[]); - } - - export interface Tab { - readonly input: - | TabInputText - | TabInputTextDiff - | TabInputTextMultiDiff - | TabInputCustom - | TabInputWebview - | TabInputNotebook - | TabInputNotebookDiff - | TabInputTerminal - | unknown; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.tabInputTextMerge.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.tabInputTextMerge.d.ts deleted file mode 100644 index c8b4ee94..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.tabInputTextMerge.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -// https://github.com/microsoft/vscode/issues/153213 - -declare module "vscode" { - export class TabInputTextMerge { - readonly base: Uri; - readonly input1: Uri; - readonly input2: Uri; - readonly result: Uri; - - constructor(base: Uri, input1: Uri, input2: Uri, result: Uri); - } - - export interface Tab { - readonly input: - | TabInputText - | TabInputTextDiff - | TabInputTextMerge - | TabInputCustom - | TabInputWebview - | TabInputNotebook - | TabInputNotebookDiff - | TabInputTerminal - | unknown; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.taskPresentationGroup.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.taskPresentationGroup.d.ts deleted file mode 100644 index 24b1bfca..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.taskPresentationGroup.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module "vscode" { - // https://github.com/microsoft/vscode/issues/47265 - - export interface TaskPresentationOptions { - /** - * Controls whether the task is executed in a specific terminal group using split panes. - */ - group?: string; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.telemetry.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.telemetry.d.ts deleted file mode 100644 index 55608e79..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.telemetry.d.ts +++ /dev/null @@ -1,37 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module "vscode" { - export interface TelemetryConfiguration { - /** - * Whether or not usage telemetry collection is allowed - */ - readonly isUsageEnabled: boolean; - /** - * Whether or not crash error telemetry collection is allowed - */ - readonly isErrorsEnabled: boolean; - /** - * Whether or not crash report collection is allowed - */ - readonly isCrashEnabled: boolean; - } - - export namespace env { - /** - * Indicates what telemetry is enabled / disabled - * Can be observed to determine what telemetry the extension is allowed to send - */ - export const telemetryConfiguration: TelemetryConfiguration; - - /** - * An {@link Event} which fires when the collectable state of telemetry changes - * Returns a {@link TelemetryConfiguration} object - */ - export const onDidChangeTelemetryConfiguration: Event< - TelemetryConfiguration | undefined - >; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.terminalDataWriteEvent.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.terminalDataWriteEvent.d.ts deleted file mode 100644 index b3d19857..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.terminalDataWriteEvent.d.ts +++ /dev/null @@ -1,31 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module "vscode" { - // https://github.com/microsoft/vscode/issues/78502 - // - // This API is still proposed but we don't intent on promoting it to stable due to problems - // around performance. See #145234 for a more likely API to get stabilized. - - export interface TerminalDataWriteEvent { - /** - * The {@link Terminal} for which the data was written. - */ - readonly terminal: Terminal; - /** - * The data being written. - */ - readonly data: string; - } - - namespace window { - /** - * An event which fires when the terminal's child pseudo-device is written to (the shell). - * In other words, this provides access to the raw data stream from the process running - * within the terminal, including VT sequences. - */ - export const onDidWriteTerminalData: Event; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.terminalDimensions.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.terminalDimensions.d.ts deleted file mode 100644 index c99e43b7..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.terminalDimensions.d.ts +++ /dev/null @@ -1,38 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module "vscode" { - // https://github.com/microsoft/vscode/issues/55718 - - /** - * An {@link Event} which fires when a {@link Terminal}'s dimensions change. - */ - export interface TerminalDimensionsChangeEvent { - /** - * The {@link Terminal} for which the dimensions have changed. - */ - readonly terminal: Terminal; - /** - * The new value for the {@link Terminal.dimensions terminal's dimensions}. - */ - readonly dimensions: TerminalDimensions; - } - - export namespace window { - /** - * An event which fires when the {@link Terminal.dimensions dimensions} of the terminal change. - */ - export const onDidChangeTerminalDimensions: Event; - } - - export interface Terminal { - /** - * The current dimensions of the terminal. This will be `undefined` immediately after the - * terminal is created as the dimensions are not known until shortly after the terminal is - * created. - */ - readonly dimensions: TerminalDimensions | undefined; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.terminalExecuteCommandEvent.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.terminalExecuteCommandEvent.d.ts deleted file mode 100644 index 59ff7414..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.terminalExecuteCommandEvent.d.ts +++ /dev/null @@ -1,47 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module "vscode" { - // https://github.com/microsoft/vscode/issues/145234 - - export interface TerminalExecutedCommand { - /** - * The {@link Terminal} the command was executed in. - */ - terminal: Terminal; - /** - * The full command line that was executed, including both the command and the arguments. - */ - commandLine: string | undefined; - /** - * The current working directory that was reported by the shell. This will be a {@link Uri} - * if the string reported by the shell can reliably be mapped to the connected machine. - */ - cwd: Uri | string | undefined; - /** - * The exit code reported by the shell. - */ - exitCode: number | undefined; - /** - * The output of the command when it has finished executing. This is the plain text shown in - * the terminal buffer and does not include raw escape sequences. Depending on the shell - * setup, this may include the command line as part of the output. - */ - output: string | undefined; - } - - export namespace window { - /** - * An event that is emitted when a terminal with shell integration activated has completed - * executing a command. - * - * Note that this event will not fire if the executed command exits the shell, listen to - * {@link onDidCloseTerminal} to handle that case. - * - * @deprecated Use {@link window.onDidStartTerminalShellExecution} - */ - export const onDidExecuteTerminalCommand: Event; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.terminalQuickFixProvider.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.terminalQuickFixProvider.d.ts deleted file mode 100644 index f0c21577..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.terminalQuickFixProvider.d.ts +++ /dev/null @@ -1,97 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module "vscode" { - // https://github.com/microsoft/vscode/issues/162950 - - export type SingleOrMany = T[] | T; - - export interface TerminalQuickFixProvider { - /** - * Provides terminal quick fixes - * @param commandMatchResult The command match result for which to provide quick fixes - * @param token A cancellation token indicating the result is no longer needed - * @return Terminal quick fix(es) if any - */ - provideTerminalQuickFixes( - commandMatchResult: TerminalCommandMatchResult, - token: CancellationToken, - ): ProviderResult< - SingleOrMany< - | TerminalQuickFixTerminalCommand - | TerminalQuickFixOpener - | Command - > - >; - } - - export interface TerminalCommandMatchResult { - commandLine: string; - commandLineMatch: RegExpMatchArray; - outputMatch?: { - regexMatch: RegExpMatchArray; - outputLines: string[]; - }; - } - - export namespace window { - /** - * @param provider A terminal quick fix provider - * @return A {@link Disposable} that unregisters the provider when being disposed - */ - export function registerTerminalQuickFixProvider( - id: string, - provider: TerminalQuickFixProvider, - ): Disposable; - } - - export class TerminalQuickFixTerminalCommand { - /** - * The terminal command to insert or run - */ - terminalCommand: string; - /** - * Whether the command should be executed or just inserted (default) - */ - shouldExecute?: boolean; - constructor(terminalCommand: string, shouldExecute?: boolean); - } - export class TerminalQuickFixOpener { - /** - * The uri to open - */ - uri: Uri; - constructor(uri: Uri); - } - - /** - * A matcher that runs on a sub-section of a terminal command's output - */ - interface TerminalOutputMatcher { - /** - * A string or regex to match against the unwrapped line. If this is a regex with the multiline - * flag, it will scan an amount of lines equal to `\n` instances in the regex + 1. - */ - lineMatcher: string | RegExp; - /** - * Which side of the output to anchor the {@link offset} and {@link length} against. - */ - anchor: TerminalOutputAnchor; - /** - * The number of rows above or below the {@link anchor} to start matching against. - */ - offset: number; - /** - * The number of wrapped lines to match against, this should be as small as possible for performance - * reasons. This is capped at 40. - */ - length: number; - } - - enum TerminalOutputAnchor { - Top = 0, - Bottom = 1, - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.terminalSelection.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.terminalSelection.d.ts deleted file mode 100644 index a08e719b..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.terminalSelection.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module "vscode" { - // https://github.com/microsoft/vscode/issues/188173 - - export interface Terminal { - /** - * The selected text of the terminal or undefined if there is no selection. - */ - readonly selection: string | undefined; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.testObserver.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.testObserver.d.ts deleted file mode 100644 index 013dae96..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.testObserver.d.ts +++ /dev/null @@ -1,212 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module "vscode" { - // https://github.com/microsoft/vscode/issues/107467 - - export namespace tests { - /** - * Requests that tests be run by their controller. - * @param run Run options to use. - * @param token Cancellation token for the test run - */ - export function runTests( - run: TestRunRequest, - token?: CancellationToken, - ): Thenable; - - /** - * Registers a provider that can provide follow-up actions for a test failure. - */ - export function registerTestFollowupProvider( - provider: TestFollowupProvider, - ): Disposable; - - /** - * Returns an observer that watches and can request tests. - */ - export function createTestObserver(): TestObserver; - /** - * List of test results stored by the editor, sorted in descending - * order by their `completedAt` time. - */ - export const testResults: ReadonlyArray; - - /** - * Event that fires when the {@link testResults} array is updated. - */ - export const onDidChangeTestResults: Event; - } - - export interface TestFollowupProvider { - provideFollowup( - result: TestRunResult, - test: TestResultSnapshot, - taskIndex: number, - messageIndex: number, - token: CancellationToken, - ): ProviderResult; - } - - export interface TestObserver { - /** - * List of tests returned by test provider for files in the workspace. - */ - readonly tests: ReadonlyArray; - - /** - * An event that fires when an existing test in the collection changes, or - * null if a top-level test was added or removed. When fired, the consumer - * should check the test item and all its children for changes. - */ - readonly onDidChangeTest: Event; - - /** - * Dispose of the observer, allowing the editor to eventually tell test - * providers that they no longer need to update tests. - */ - dispose(): void; - } - - export interface TestsChangeEvent { - /** - * List of all tests that are newly added. - */ - readonly added: ReadonlyArray; - - /** - * List of existing tests that have updated. - */ - readonly updated: ReadonlyArray; - - /** - * List of existing tests that have been removed. - */ - readonly removed: ReadonlyArray; - } - - /** - * TestResults can be provided to the editor in {@link tests.publishTestResult}, - * or read from it in {@link tests.testResults}. - * - * The results contain a 'snapshot' of the tests at the point when the test - * run is complete. Therefore, information such as its {@link Range} may be - * out of date. If the test still exists in the workspace, consumers can use - * its `id` to correlate the result instance with the living test. - */ - export interface TestRunResult { - /** - * Unix milliseconds timestamp at which the test run was completed. - */ - readonly completedAt: number; - - /** - * Optional raw output from the test run. - */ - readonly output?: string; - - /** - * List of test results. The items in this array are the items that - * were passed in the {@link tests.runTests} method. - */ - readonly results: ReadonlyArray>; - - /** - * Gets coverage information for a URI. This function is available only - * when a test run reported coverage. - */ - getDetailedCoverage?( - uri: Uri, - token?: CancellationToken, - ): Thenable; - } - - /** - * A {@link TestItem}-like interface with an associated result, which appear - * or can be provided in {@link TestResult} interfaces. - */ - export interface TestResultSnapshot { - /** - * Unique identifier that matches that of the associated TestItem. - * This is used to correlate test results and tests in the document with - * those in the workspace (test explorer). - */ - readonly id: string; - - /** - * Parent of this item. - */ - readonly parent?: TestResultSnapshot; - - /** - * URI this TestItem is associated with. May be a file or file. - */ - readonly uri?: Uri; - - /** - * Display name describing the test case. - */ - readonly label: string; - - /** - * Optional description that appears next to the label. - */ - readonly description?: string; - - /** - * Location of the test item in its `uri`. This is only meaningful if the - * `uri` points to a file. - */ - readonly range?: Range; - - /** - * State of the test in each task. In the common case, a test will only - * be executed in a single task and the length of this array will be 1. - */ - readonly taskStates: ReadonlyArray; - - /** - * Optional list of nested tests for this item. - */ - readonly children: Readonly[]; - } - - export interface TestSnapshotTaskState { - /** - * Current result of the test. - */ - readonly state: TestResultState; - - /** - * The number of milliseconds the test took to run. This is set once the - * `state` is `Passed`, `Failed`, or `Errored`. - */ - readonly duration?: number; - - /** - * Associated test run message. Can, for example, contain assertion - * failure information if the test fails. - */ - readonly messages: ReadonlyArray; - } - - /** - * Possible states of tests in a test run. - */ - export enum TestResultState { - // Test will be run, but is not currently running. - Queued = 1, - // Test is currently running - Running = 2, - // Test run has passed - Passed = 3, - // Test run has failed (on an assertion) - Failed = 4, - // Test run has been skipped - Skipped = 5, - // Test run failed for some other reason (compilation error, timeout, etc) - Errored = 6, - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.testRelatedCode.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.testRelatedCode.d.ts deleted file mode 100644 index d8d54b65..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.testRelatedCode.d.ts +++ /dev/null @@ -1,43 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module "vscode" { - export interface TestController { - /** - * A provider used for associating code location with tests. - */ - relatedCodeProvider?: TestRelatedCodeProvider; - } - - export interface TestRelatedCodeProvider { - /** - * Returns the tests related to the given code location. This may be called - * by the user either explicitly via a "go to test" action, or implicitly - * when running tests at a cursor position. - * - * @param document The document in which the code location is located. - * @param position The position in the document. - * @param token A cancellation token. - * @returns A list of tests related to the position in the code. - */ - provideRelatedTests?( - document: TextDocument, - position: Position, - token: CancellationToken, - ): ProviderResult; - - /** - * Returns the code related to the given test case. - * - * @param test The test for which to provide related code. - * @param token A cancellation token. - * @returns A list of locations related to the test. - */ - provideRelatedCode?( - test: TestItem, - token: CancellationToken, - ): ProviderResult; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.textSearchComplete2.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.textSearchComplete2.d.ts deleted file mode 100644 index 5e1d8cb7..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.textSearchComplete2.d.ts +++ /dev/null @@ -1,38 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module "vscode" { - export interface TextSearchComplete2 { - /** - * Additional information regarding the state of the completed search. - * - * Messages with "Information" style support links in markdown syntax: - * - Click to [run a command](command:workbench.action.OpenQuickPick) - * - Click to [open a website](https://aka.ms) - * - * Commands may optionally return { triggerSearch: true } to signal to the editor that the original search should run be again. - */ - message?: TextSearchCompleteMessage2[]; - } - - /** - * A message regarding a completed search. - */ - export interface TextSearchCompleteMessage2 { - /** - * Markdown text of the message. - */ - text: string; - /** - * Whether the source of the message is trusted, command links are disabled for untrusted message sources. - * Messaged are untrusted by default. - */ - trusted?: boolean; - /** - * The message type, this affects how the message will be rendered. - */ - type: TextSearchCompleteMessageType; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.textSearchProvider.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.textSearchProvider.d.ts deleted file mode 100644 index 06d300d5..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.textSearchProvider.d.ts +++ /dev/null @@ -1,288 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module "vscode" { - // https://github.com/microsoft/vscode/issues/59921 - - /** - * The parameters of a query for text search. - */ - export interface TextSearchQuery { - /** - * The text pattern to search for. - */ - pattern: string; - - /** - * Whether or not `pattern` should match multiple lines of text. - */ - isMultiline?: boolean; - - /** - * Whether or not `pattern` should be interpreted as a regular expression. - */ - isRegExp?: boolean; - - /** - * Whether or not the search should be case-sensitive. - */ - isCaseSensitive?: boolean; - - /** - * Whether or not to search for whole word matches only. - */ - isWordMatch?: boolean; - } - - /** - * A file glob pattern to match file paths against. - * TODO@roblourens merge this with the GlobPattern docs/definition in vscode.d.ts. - * @see {@link GlobPattern} - */ - export type GlobString = string; - - /** - * Options common to file and text search - */ - export interface SearchOptions { - /** - * The root folder to search within. - */ - folder: Uri; - - /** - * Files that match an `includes` glob pattern should be included in the search. - */ - includes: GlobString[]; - - /** - * Files that match an `excludes` glob pattern should be excluded from the search. - */ - excludes: GlobString[]; - - /** - * Whether external files that exclude files, like .gitignore, should be respected. - * See the vscode setting `"search.useIgnoreFiles"`. - */ - useIgnoreFiles: boolean; - - /** - * Whether symlinks should be followed while searching. - * See the vscode setting `"search.followSymlinks"`. - */ - followSymlinks: boolean; - - /** - * Whether global files that exclude files, like .gitignore, should be respected. - * See the vscode setting `"search.useGlobalIgnoreFiles"`. - */ - useGlobalIgnoreFiles: boolean; - - /** - * Whether files in parent directories that exclude files, like .gitignore, should be respected. - * See the vscode setting `"search.useParentIgnoreFiles"`. - */ - useParentIgnoreFiles: boolean; - } - - /** - * Options to specify the size of the result text preview. - * These options don't affect the size of the match itself, just the amount of preview text. - */ - export interface TextSearchPreviewOptions { - /** - * The maximum number of lines in the preview. - * Only search providers that support multiline search will ever return more than one line in the match. - */ - matchLines: number; - - /** - * The maximum number of characters included per line. - */ - charsPerLine: number; - } - - /** - * Options that apply to text search. - */ - export interface TextSearchOptions extends SearchOptions { - /** - * The maximum number of results to be returned. - */ - maxResults: number; - - /** - * Options to specify the size of the result text preview. - */ - previewOptions?: TextSearchPreviewOptions; - - /** - * Exclude files larger than `maxFileSize` in bytes. - */ - maxFileSize?: number; - - /** - * Interpret files using this encoding. - * See the vscode setting `"files.encoding"` - */ - encoding?: string; - - /** - * Number of lines of context to include before each match. - */ - beforeContext?: number; - - /** - * Number of lines of context to include after each match. - */ - afterContext?: number; - } - - /** - * Represents the severity of a TextSearchComplete message. - */ - export enum TextSearchCompleteMessageType { - Information = 1, - Warning = 2, - } - - /** - * A message regarding a completed search. - */ - export interface TextSearchCompleteMessage { - /** - * Markdown text of the message. - */ - text: string; - /** - * Whether the source of the message is trusted, command links are disabled for untrusted message sources. - * Messaged are untrusted by default. - */ - trusted?: boolean; - /** - * The message type, this affects how the message will be rendered. - */ - type: TextSearchCompleteMessageType; - } - - /** - * Information collected when text search is complete. - */ - export interface TextSearchComplete { - /** - * Whether the search hit the limit on the maximum number of search results. - * `maxResults` on {@linkcode TextSearchOptions} specifies the max number of results. - * - If exactly that number of matches exist, this should be false. - * - If `maxResults` matches are returned and more exist, this should be true. - * - If search hits an internal limit which is less than `maxResults`, this should be true. - */ - limitHit?: boolean; - - /** - * Additional information regarding the state of the completed search. - * - * Messages with "Information" style support links in markdown syntax: - * - Click to [run a command](command:workbench.action.OpenQuickPick) - * - Click to [open a website](https://aka.ms) - * - * Commands may optionally return { triggerSearch: true } to signal to the editor that the original search should run be again. - */ - message?: TextSearchCompleteMessage | TextSearchCompleteMessage[]; - } - - /** - * A preview of the text result. - */ - export interface TextSearchMatchPreview { - /** - * The matching lines of text, or a portion of the matching line that contains the match. - */ - text: string; - - /** - * The Range within `text` corresponding to the text of the match. - * The number of matches must match the TextSearchMatch's range property. - */ - matches: Range | Range[]; - } - - /** - * A match from a text search - */ - export interface TextSearchMatch { - /** - * The uri for the matching document. - */ - uri: Uri; - - /** - * The range of the match within the document, or multiple ranges for multiple matches. - */ - ranges: Range | Range[]; - - /** - * A preview of the text match. - */ - preview: TextSearchMatchPreview; - } - - /** - * A line of context surrounding a TextSearchMatch. - */ - export interface TextSearchContext { - /** - * The uri for the matching document. - */ - uri: Uri; - - /** - * One line of text. - * previewOptions.charsPerLine applies to this - */ - text: string; - - /** - * The line number of this line of context. - */ - lineNumber: number; - } - - export type TextSearchResult = TextSearchMatch | TextSearchContext; - - /** - * A TextSearchProvider provides search results for text results inside files in the workspace. - */ - export interface TextSearchProvider { - /** - * Provide results that match the given text pattern. - * @param query The parameters for this query. - * @param options A set of options to consider while searching. - * @param progress A progress callback that must be invoked for all results. - * @param token A cancellation token. - */ - provideTextSearchResults( - query: TextSearchQuery, - options: TextSearchOptions, - progress: Progress, - token: CancellationToken, - ): ProviderResult; - } - - export namespace workspace { - /** - * Register a text search provider. - * - * Only one provider can be registered per scheme. - * - * @param scheme The provider will be invoked for workspace folders that have this file scheme. - * @param provider The provider. - * @return A {@link Disposable} that unregisters this provider when being disposed. - */ - export function registerTextSearchProvider( - scheme: string, - provider: TextSearchProvider, - ): Disposable; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.textSearchProvider2.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.textSearchProvider2.d.ts deleted file mode 100644 index 4218dce8..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.textSearchProvider2.d.ts +++ /dev/null @@ -1,285 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module "vscode" { - // https://github.com/microsoft/vscode/issues/59921 - - /** - * The parameters of a query for text search. All optional booleans default to `false`. - */ - export interface TextSearchQuery2 { - /** - * The text pattern to search for. - * - * If explicitly contains a newline character (`\n`), the default search behavior - * will automatically enable {@link isMultiline}. - */ - pattern: string; - - /** - * Whether or not `pattern` should match multiple lines of text. - * - * If using the default search provider, this will be interpreted as `true` if - * `pattern` contains a newline character (`\n`). - */ - isMultiline?: boolean; - - /** - * Whether or not `pattern` should be interpreted as a regular expression. - * - * If using the default search provider, this will be interpreted case-insensitively - * if {@link isCaseSensitive} is `false` or not set. - */ - isRegExp?: boolean; - - /** - * Whether or not the search should be case-sensitive. - * - * If using the default search provider, this can be affected by the `search.smartCase` setting. - * See the setting description for more information. - */ - isCaseSensitive?: boolean; - - /** - * Whether or not to search for whole word matches only. - * - * If enabled, the default search provider will check for boundary characters - * (regex pattern `\b`) surrounding the {@link pattern} to see whether something - * is a word match. - */ - isWordMatch?: boolean; - } - - /** - * Options that apply to text search. - */ - export interface TextSearchProviderOptions { - folderOptions: { - /** - * The root folder to search within. - */ - folder: Uri; - - /** - * Files that match an `includes` glob pattern should be included in the search. - */ - includes: string[]; - - /** - * Files that match an `excludes` glob pattern should be excluded from the search. - */ - excludes: GlobPattern[]; - - /** - * Whether symlinks should be followed while searching. - * For more info, see the setting description for `search.followSymlinks`. - */ - followSymlinks: boolean; - - /** - * Which file locations we should look for ignore (.gitignore or .ignore) files to respect. - */ - useIgnoreFiles: { - /** - * Use ignore files at the current workspace root. - */ - local: boolean; - /** - * Use ignore files at the parent directory. If set, {@link TextSearchProviderOptions.useIgnoreFiles.local} should also be `true`. - */ - parent: boolean; - /** - * Use global ignore files. If set, {@link TextSearchProviderOptions.useIgnoreFiles.local} should also be `true`. - */ - global: boolean; - }; - - /** - * Interpret files using this encoding. - * See the vscode setting `"files.encoding"` - */ - encoding: string; - }[]; - - /** - * The maximum number of results to be returned. - */ - maxResults: number; - - /** - * Options to specify the size of the result text preview. - */ - previewOptions: { - /** - * The maximum number of lines in the preview. - * Only search providers that support multiline search will ever return more than one line in the match. - * Defaults to 100. - */ - matchLines: number; - - /** - * The maximum number of characters included per line. - * Defaults to 10000. - */ - charsPerLine: number; - }; - - /** - * Exclude files larger than `maxFileSize` in bytes. - */ - maxFileSize: number | undefined; - - /** - * Number of lines of context to include before and after each match. - */ - surroundingContext: number; - } - - /** - * Information collected when text search is complete. - */ - export interface TextSearchComplete2 { - /** - * Whether the search hit the limit on the maximum number of search results. - * `maxResults` on {@linkcode TextSearchProviderOptions} specifies the max number of results. - * - If exactly that number of matches exist, this should be false. - * - If `maxResults` matches are returned and more exist, this should be true. - * - If search hits an internal limit which is less than `maxResults`, this should be true. - */ - limitHit?: boolean; - } - - /** - * A query match instance in a file. - * - * For example, consider this excerpt: - * - * ```ts - * const bar = 1; - * console.log(bar); - * const foo = bar; - * ``` - * - * If the query is `log`, then the line `console.log(bar);` should be represented using a {@link TextSearchMatch2}. - */ - export class TextSearchMatch2 { - /** - * @param uri The uri for the matching document. - * @param ranges The ranges associated with this match. - * @param previewText The text that is used to preview the match. The highlighted range in `previewText` is specified in `ranges`. - */ - constructor( - uri: Uri, - ranges: { sourceRange: Range; previewRange: Range }[], - previewText: string, - ); - - /** - * The uri for the matching document. - */ - uri: Uri; - - /** - * The ranges associated with this match. - */ - ranges: { - /** - * The range of the match within the document, or multiple ranges for multiple matches. - */ - sourceRange: Range; - /** - * The Range within `previewText` corresponding to the text of the match. - */ - previewRange: Range; - }[]; - - previewText: string; - } - - /** - * The context lines of text that are not a part of a match, - * but that surround a match line of type {@link TextSearchMatch2}. - * - * For example, consider this excerpt: - * - * ```ts - * const bar = 1; - * console.log(bar); - * const foo = bar; - * ``` - * - * If the query is `log`, then the lines `const bar = 1;` and `const foo = bar;` - * should be represented using two separate {@link TextSearchContext2} for the search instance. - * This example assumes that the finder requests one line of surrounding context. - */ - export class TextSearchContext2 { - /** - * @param uri The uri for the matching document. - * @param text The line of context text. - * @param lineNumber The line number of this line of context. - */ - constructor(uri: Uri, text: string, lineNumber: number); - - /** - * The uri for the matching document. - */ - uri: Uri; - - /** - * One line of text. - * previewOptions.charsPerLine applies to this - */ - text: string; - - /** - * The line number of this line of context. - */ - lineNumber: number; - } - - /** - * A result payload for a text search, pertaining to {@link TextSearchMatch2 matches} - * and its associated {@link TextSearchContext2 context} within a single file. - */ - export type TextSearchResult2 = TextSearchMatch2 | TextSearchContext2; - - /** - * A TextSearchProvider provides search results for text results inside files in the workspace. - */ - export interface TextSearchProvider2 { - /** - * WARNING: VERY EXPERIMENTAL. - * - * Provide results that match the given text pattern. - * @param query The parameters for this query. - * @param options A set of options to consider while searching. - * @param progress A progress callback that must be invoked for all {@link TextSearchResult2 results}. - * These results can be direct matches, or context that surrounds matches. - * @param token A cancellation token. - */ - provideTextSearchResults( - query: TextSearchQuery2, - options: TextSearchProviderOptions, - progress: Progress, - token: CancellationToken, - ): ProviderResult; - } - - export namespace workspace { - /** - * Register a text search provider. - * - * Only one provider can be registered per scheme. - * - * @param scheme The provider will be invoked for workspace folders that have this file scheme. - * @param provider The provider. - * @return A {@link Disposable} that unregisters this provider when being disposed. - */ - export function registerTextSearchProvider2( - scheme: string, - provider: TextSearchProvider2, - ): Disposable; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.timeline.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.timeline.d.ts deleted file mode 100644 index c5311bfa..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.timeline.d.ts +++ /dev/null @@ -1,169 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module "vscode" { - // https://github.com/microsoft/vscode/issues/84297 - - export class TimelineItem { - /** - * A timestamp (in milliseconds since 1 January 1970 00:00:00) for when the timeline item occurred. - */ - timestamp: number; - - /** - * A human-readable string describing the timeline item. - */ - label: string; - - /** - * Optional id for the timeline item. It must be unique across all the timeline items provided by this source. - * - * If not provided, an id is generated using the timeline item's timestamp. - */ - id?: string; - - /** - * The icon path or {@link ThemeIcon} for the timeline item. - */ - iconPath?: Uri | { light: Uri; dark: Uri } | ThemeIcon; - - /** - * A human readable string describing less prominent details of the timeline item. - */ - description?: string; - - /** - * The tooltip text when you hover over the timeline item. - */ - tooltip?: string | MarkdownString | undefined; - - /** - * The {@link Command} that should be executed when the timeline item is selected. - */ - command?: Command; - - /** - * Context value of the timeline item. This can be used to contribute specific actions to the item. - * For example, a timeline item is given a context value as `commit`. When contributing actions to `timeline/item/context` - * using `menus` extension point, you can specify context value for key `timelineItem` in `when` expression like `timelineItem == commit`. - * ``` - * "contributes": { - * "menus": { - * "timeline/item/context": [ - * { - * "command": "extension.copyCommitId", - * "when": "timelineItem == commit" - * } - * ] - * } - * } - * ``` - * This will show the `extension.copyCommitId` action only for items where `contextValue` is `commit`. - */ - contextValue?: string; - - /** - * Accessibility information used when screen reader interacts with this timeline item. - */ - accessibilityInformation?: AccessibilityInformation; - - /** - * @param label A human-readable string describing the timeline item - * @param timestamp A timestamp (in milliseconds since 1 January 1970 00:00:00) for when the timeline item occurred - */ - constructor(label: string, timestamp: number); - } - - export interface TimelineChangeEvent { - /** - * The {@link Uri} of the resource for which the timeline changed. - */ - uri: Uri; - - /** - * A flag which indicates whether the entire timeline should be reset. - */ - reset?: boolean; - } - - export interface Timeline { - readonly paging?: { - /** - * A provider-defined cursor specifying the starting point of timeline items which are after the ones returned. - * Use `undefined` to signal that there are no more items to be returned. - */ - readonly cursor: string | undefined; - }; - - /** - * An array of {@link TimelineItem timeline items}. - */ - readonly items: readonly TimelineItem[]; - } - - export interface TimelineOptions { - /** - * A provider-defined cursor specifying the starting point of the timeline items that should be returned. - */ - cursor?: string; - - /** - * An optional maximum number timeline items or the all timeline items newer (inclusive) than the timestamp or id that should be returned. - * If `undefined` all timeline items should be returned. - */ - limit?: number | { timestamp: number; id?: string }; - } - - export interface TimelineProvider { - /** - * An optional event to signal that the timeline for a source has changed. - * To signal that the timeline for all resources (uris) has changed, do not pass any argument or pass `undefined`. - */ - onDidChange?: Event; - - /** - * An identifier of the source of the timeline items. This can be used to filter sources. - */ - readonly id: string; - - /** - * A human-readable string describing the source of the timeline items. This can be used as the display label when filtering sources. - */ - readonly label: string; - - /** - * Provide {@link TimelineItem timeline items} for a {@link Uri}. - * - * @param uri The {@link Uri} of the file to provide the timeline for. - * @param options A set of options to determine how results should be returned. - * @param token A cancellation token. - * @return The {@link TimelineResult timeline result} or a thenable that resolves to such. The lack of a result - * can be signaled by returning `undefined`, `null`, or an empty array. - */ - provideTimeline( - uri: Uri, - options: TimelineOptions, - token: CancellationToken, - ): ProviderResult; - } - - export namespace workspace { - /** - * Register a timeline provider. - * - * Multiple providers can be registered. In that case, providers are asked in - * parallel and the results are merged. A failing provider (rejected promise or exception) will - * not cause a failure of the whole operation. - * - * @param scheme A scheme or schemes that defines which documents this provider is applicable to. Can be `*` to target all documents. - * @param provider A timeline provider. - * @return A {@link Disposable} that unregisters this provider when being disposed. - */ - export function registerTimelineProvider( - scheme: string | string[], - provider: TimelineProvider, - ): Disposable; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.tokenInformation.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.tokenInformation.d.ts deleted file mode 100644 index 7fe4c192..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.tokenInformation.d.ts +++ /dev/null @@ -1,28 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module "vscode" { - // https://github.com/microsoft/vscode/issues/91555 - - export enum StandardTokenType { - Other = 0, - Comment = 1, - String = 2, - RegEx = 3, - } - - export interface TokenInformation { - type: StandardTokenType; - range: Range; - } - - export namespace languages { - /** @deprecated */ - export function getTokenInformationAtPosition( - document: TextDocument, - position: Position, - ): Thenable; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.treeViewActiveItem.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.treeViewActiveItem.d.ts deleted file mode 100644 index 6e80322a..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.treeViewActiveItem.d.ts +++ /dev/null @@ -1,29 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module "vscode" { - // https://github.com/microsoft/vscode/issues/170248 - - export interface TreeView extends Disposable { - /** - * Currently active item. - */ - readonly activeItem: T | undefined; - /** - * Event that is fired when the {@link TreeView.activeItem active item} has changed - */ - readonly onDidChangeActiveItem: Event>; - } - - /** - * The event that is fired when there is a change in {@link TreeView.activeItem tree view's active item} - */ - export interface TreeViewActiveItemChangeEvent { - /** - * Active item. - */ - readonly activeItem: T | undefined; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.treeViewMarkdownMessage.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.treeViewMarkdownMessage.d.ts deleted file mode 100644 index fd726e17..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.treeViewMarkdownMessage.d.ts +++ /dev/null @@ -1,34 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module "vscode" { - export interface TreeView2 extends Disposable { - readonly onDidExpandElement: Event>; - readonly onDidCollapseElement: Event>; - readonly selection: readonly T[]; - readonly onDidChangeSelection: Event>; - readonly visible: boolean; - readonly onDidChangeVisibility: Event; - readonly onDidChangeCheckboxState: Event>; - title?: string; - description?: string; - badge?: ViewBadge | undefined; - reveal( - element: T, - options?: { - select?: boolean; - focus?: boolean; - expand?: boolean | number; - }, - ): Thenable; - - /** - * An optional human-readable message that will be rendered in the view. - * Only a subset of markdown is supported. - * Setting the message to null, undefined, or empty string will remove the message from the view. - */ - message?: string | MarkdownString; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.treeViewReveal.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.treeViewReveal.d.ts deleted file mode 100644 index 4fdcbc37..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.treeViewReveal.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module "vscode" { - // https://github.com/microsoft/vscode/issues/61313 @alexr00 - - export interface TreeView extends Disposable { - reveal( - element: T | undefined, - options?: { - select?: boolean; - focus?: boolean; - expand?: boolean | number; - }, - ): Thenable; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.tunnelFactory.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.tunnelFactory.d.ts deleted file mode 100644 index a4826029..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.tunnelFactory.d.ts +++ /dev/null @@ -1,54 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module "vscode" { - /** - * Used as part of the ResolverResult if the extension has any candidate, - * published, or forwarded ports. - */ - export interface TunnelInformation { - /** - * Tunnels that are detected by the extension. The remotePort is used for display purposes. - * The localAddress should be the complete local address (ex. localhost:1234) for connecting to the port. Tunnels provided through - * environmentTunnels are read-only from the forwarded ports UI. - */ - environmentTunnels?: TunnelDescription[]; - - tunnelFeatures?: { - elevation: boolean; - /** - * One of the the options must have the ID "private". - */ - privacyOptions: TunnelPrivacy[]; - /** - * Defaults to true for backwards compatibility. - */ - protocol?: boolean; - }; - } - - export interface TunnelProvider { - /** - * Provides port forwarding capabilities. If there is a resolver that already provids tunnels, then the resolver's provider will - * be used. If multiple providers are registered, then only the first will be used. - */ - provideTunnel( - tunnelOptions: TunnelOptions, - tunnelCreationOptions: TunnelCreationOptions, - token: CancellationToken, - ): ProviderResult; - } - - export namespace workspace { - /** - * Registering a tunnel provider enables port forwarding. This will cause the Ports view to show. - * @param provider - */ - export function registerTunnelProvider( - provider: TunnelProvider, - information: TunnelInformation, - ): Thenable; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.tunnels.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.tunnels.d.ts deleted file mode 100644 index 8db95c84..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.tunnels.d.ts +++ /dev/null @@ -1,65 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module "vscode" { - // tunnels @alexr00 - - export interface TunnelOptions { - remoteAddress: { port: number; host: string }; - // The desired local port. If this port can't be used, then another will be chosen. - localAddressPort?: number; - label?: string; - /** - * @deprecated Use privacy instead - */ - public?: boolean; - privacy?: string; - protocol?: string; - } - - export interface TunnelDescription { - remoteAddress: { port: number; host: string }; - //The complete local address(ex. localhost:1234) - localAddress: { port: number; host: string } | string; - /** - * @deprecated Use privacy instead - */ - public?: boolean; - privacy?: string; - // If protocol is not provided it is assumed to be http, regardless of the localAddress. - protocol?: string; - } - - export interface Tunnel extends TunnelDescription { - // Implementers of Tunnel should fire onDidDispose when dispose is called. - onDidDispose: Event; - dispose(): void | Thenable; - } - - export namespace workspace { - /** - * Forwards a port. If the current resolver implements RemoteAuthorityResolver:forwardPort then that will be used to make the tunnel. - * By default, openTunnel only support localhost; however, RemoteAuthorityResolver:tunnelFactory can be used to support other ips. - * - * @throws When run in an environment without a remote. - * - * @param tunnelOptions The `localPort` is a suggestion only. If that port is not available another will be chosen. - */ - export function openTunnel( - tunnelOptions: TunnelOptions, - ): Thenable; - - /** - * Gets an array of the currently available tunnels. This does not include environment tunnels, only tunnels that have been created by the user. - * Note that these are of type TunnelDescription and cannot be disposed. - */ - export let tunnels: Thenable; - - /** - * Fired when the list of tunnels has changed. - */ - export const onDidChangeTunnels: Event; - } -} diff --git a/Example/Input/Editor/vscode-dts/vscode.proposed.workspaceTrust.d.ts b/Example/Input/Editor/vscode-dts/vscode.proposed.workspaceTrust.d.ts deleted file mode 100644 index 0ee781c3..00000000 --- a/Example/Input/Editor/vscode-dts/vscode.proposed.workspaceTrust.d.ts +++ /dev/null @@ -1,31 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module "vscode" { - // https://github.com/microsoft/vscode/issues/120173 - - /** - * The object describing the properties of the workspace trust request - */ - export interface WorkspaceTrustRequestOptions { - /** - * Custom message describing the user action that requires workspace - * trust. If omitted, a generic message will be displayed in the workspace - * trust request dialog. - */ - readonly message?: string; - } - - export namespace workspace { - /** - * Prompt the user to chose whether to trust the current workspace - * @param options Optional object describing the properties of the - * workspace trust request. - */ - export function requestWorkspaceTrust( - options?: WorkspaceTrustRequestOptions, - ): Thenable; - } -} diff --git a/Example/Output/Editor/vs/workbench/workbench.web.main.internal.ts b/Example/Output/Editor/vs/workbench/workbench.web.main.internal.ts index 4569446f..9d61a69a 100644 --- a/Example/Output/Editor/vs/workbench/workbench.web.main.internal.ts +++ b/Example/Output/Editor/vs/workbench/workbench.web.main.internal.ts @@ -143,7 +143,31 @@ registerSingleton(IDiagnosticsService, NullDiagnosticsService, InstantiationType registerSingleton(ILanguagePackService, WebLanguagePacksService, InstantiationType.Delayed); // TODO@esm remove me once we stop supporting our web-esm-bridge if ((globalThis as any).__VSCODE_WEB_ESM_PROMISE) { - const exports = { + { + const exports = { + // Factory + create: create, + // Basic Types + URI: URI, + Event: Event, + Emitter: Emitter, + Disposable: Disposable, + // GroupOrientation, + LogLevel: LogLevel, + RemoteAuthorityResolverError: RemoteAuthorityResolverError, + RemoteAuthorityResolverErrorCode: RemoteAuthorityResolverErrorCode, + // Facade API + env: env, + window: window, + workspace: workspace, + commands: commands, + logger: logger, + Menu: Menu, + }; + (globalThis as any).__VSCODE_WEB_ESM_PROMISE(exports); + delete (globalThis as any).__VSCODE_WEB_ESM_PROMISE; + } + (globalThis as any).__VSCODE_WEB_ESM_PROMISE({ // Factory create: create, // Basic Types @@ -162,8 +186,7 @@ if ((globalThis as any).__VSCODE_WEB_ESM_PROMISE) { commands: commands, logger: logger, Menu: Menu, - }; - (globalThis as any).__VSCODE_WEB_ESM_PROMISE(exports); + }); delete (globalThis as any).__VSCODE_WEB_ESM_PROMISE; } export { diff --git a/Source/Function/Output.ts b/Source/Function/Output.ts index 7d3f6a5d..5a2c8d89 100644 --- a/Source/Function/Output.ts +++ b/Source/Function/Output.ts @@ -24,25 +24,6 @@ export default (async (...[Source]) => { Initializer, )(Node); - const Transformer = ( - await import("@Function/Output/Transformer.js") - ).default(Usage, Initializer); - - let Use = true; - - let NodeTransform = ts.transform(Node, [Transformer]) - .transformed[0] as SourceFile; - - while (Use) { - const { transformed } = ts.transform(NodeTransform, [Transformer]); - - if (transformed[0] === NodeTransform) { - Use = false; - } else { - NodeTransform = transformed[0] as SourceFile; - } - } - return ts .createPrinter({ newLine: ts.NewLineKind.LineFeed, @@ -50,7 +31,14 @@ export default (async (...[Source]) => { omitTrailingSemicolon: false, noEmitHelpers: false, }) - .printFile(NodeTransform); + .printFile( + ts.transform(Node, [ + (await import("@Function/Output/Transformer.js")).default( + Usage, + Initializer, + ), + ]).transformed[0] as SourceFile, + ); }) satisfies Interface as Interface; export const ts = await import("typescript"); diff --git a/Source/Function/Output/Transformer/Visit.ts b/Source/Function/Output/Transformer/Visit.ts index 5573572f..ab43bdbb 100644 --- a/Source/Function/Output/Transformer/Visit.ts +++ b/Source/Function/Output/Transformer/Visit.ts @@ -4,6 +4,7 @@ import type { Identifier, Node, TransformationContext, + VariableDeclaration, VariableStatement, } from "typescript"; @@ -166,7 +167,7 @@ export const Fn = ((usageMap, initializerMap) => { private readonly circularDetector: CircularReferenceDetector; - private readonly preservedVariables = new Set(); + private readonly preservedVariables = new Map(); constructor(context: TransformationContext) { this.state = { @@ -234,7 +235,7 @@ export const Fn = ((usageMap, initializerMap) => { ): VisitResult { const name = node.text; - // Don't replace references to preserved variables + // Check if this identifier refers to a preserved variable if (this.preservedVariables.has(name)) { return this.createVisitResult(node, false); } @@ -245,7 +246,6 @@ export const Fn = ((usageMap, initializerMap) => { return this.createVisitResult(node, false); } - // Try to find an initializer that matches the name let initializer: Node | undefined; for (const [init, varName] of initializerMap.entries()) { @@ -260,12 +260,21 @@ export const Fn = ((usageMap, initializerMap) => { return this.createVisitResult(node, false); } - // Detect self-references + // Don't transform if this is part of the variable's own declaration + const declaration = this.findParentVariableDeclaration(node); + + if ( + declaration && + ts.isIdentifier(declaration.name) && + declaration.name.text === name + ) { + return this.createVisitResult(node, false); + } + if (this.isSelfReference(node, initializer)) { return this.createVisitResult(node, false, new Set([name])); } - // Check for circular references const dependencies = this.collectDependencies(initializer); if (this.circularDetector.detectCircular(name, dependencies)) { @@ -293,6 +302,22 @@ export const Fn = ((usageMap, initializerMap) => { } } + private findParentVariableDeclaration( + node: Node, + ): VariableDeclaration | undefined { + let current = node.parent; + + while (current) { + if (ts.isVariableDeclaration(current)) { + return current; + } + + current = current.parent; + } + + return undefined; + } + private isSelfReference(node: Identifier, initializer: Node): boolean { if (!isIdentifier(initializer)) { return false; @@ -385,43 +410,30 @@ export const Fn = ((usageMap, initializerMap) => { return result; } - private shouldInlineVariable( + private shouldPreserveVariable( name: string, initializer: Node | undefined, node: VariableStatement, ): boolean { const usage = usageMap.get(name); - // Don't inline if: - // 1. No usage count available - // 2. No initializer - // 3. Multiple usages - // 4. Is exported + // Preserve if: + // 1. Multiple usages + // 2. Has complex initializer + // 3. Is exported + // 4. No initializer if ( - !usage || !initializer || + !usage || usage > 1 || node.modifiers?.some( (mod) => mod.kind === ts.SyntaxKind.ExportKeyword, ) ) { - this.preservedVariables.add(name); - - return false; - } - - // Don't inline if the initializer contains function calls or other complex expressions - // that should only be evaluated once - const hasComplexInitializer = - this.containsComplexExpression(initializer); - - if (hasComplexInitializer) { - this.preservedVariables.add(name); - - return false; + return true; } - return true; + return this.containsComplexExpression(initializer); } private containsComplexExpression(node: Node): boolean { @@ -463,47 +475,56 @@ export const Fn = ((usageMap, initializerMap) => { const name = declaration.name.text; - // Evaluate if we should inline this variable + // Check if we should preserve this variable if ( - this.shouldInlineVariable( + this.shouldPreserveVariable( name, declaration.initializer, node, ) ) { - if ( - declaration.initializer && - !initializerMap.has(declaration.initializer) - ) { - initializerMap.set(declaration.initializer, name); + // Store the original declaration for reference + if (declaration.initializer) { + this.preservedVariables.set( + name, + declaration.initializer, + ); } - modified = true; - - continue; - } - // If the variable shouldn't be inlined, try to simplify its initializer if possible - if (declaration.initializer) { - const result = this.visitNode(declaration.initializer); - - if (result.modified && ts.isExpression(result.node)) { - modified = true; - - newDeclarations.push( - factory.updateVariableDeclaration( - declaration, - declaration.name, - declaration.exclamationToken, - declaration.type, - result.node, - ), - ); + if (declaration.initializer) { + const result = this.visitNode(declaration.initializer); + + if (result.modified && ts.isExpression(result.node)) { + modified = true; + + newDeclarations.push( + factory.updateVariableDeclaration( + declaration, + declaration.name, + declaration.exclamationToken, + declaration.type, + result.node, + ), + ); + } else { + newDeclarations.push(declaration); + } } else { newDeclarations.push(declaration); } - } else { - newDeclarations.push(declaration); + + continue; } + + // Only inline if not preserved + if ( + declaration.initializer && + !initializerMap.has(declaration.initializer) + ) { + initializerMap.set(declaration.initializer, name); + } + + modified = true; } if (newDeclarations.length === 0) { diff --git a/Source/Function/Output/Visit.ts b/Source/Function/Output/Visit.ts index f3dc69eb..cdcb2a19 100644 --- a/Source/Function/Output/Visit.ts +++ b/Source/Function/Output/Visit.ts @@ -7,7 +7,7 @@ import type { Node } from "typescript"; */ export const Fn = ((...[Usage, Initializer]) => (...[Node]) => { - const MAX_USAGE_COUNT = 54; + const MAX_USAGE_COUNT = 1000; const MAX_INITIALIZER_SIZE = 1000; diff --git a/Target/Function/Output.js b/Target/Function/Output.js index ecdabfa9..f297d4f1 100644 --- a/Target/Function/Output.js +++ b/Target/Function/Output.js @@ -1 +1 @@ -var m=async(...[p])=>{const r=e.createSourceFile("temp.ts",p,e.ScriptTarget.Latest,!0),i=new Map([]),a=new Map([]);(await import("./Output/Visit.js")).default(i,a)(r);const s=(await import("./Output/Transformer.js")).default(i,a);let o=!0,t=e.transform(r,[s]).transformed[0];for(;o;){const{transformed:n}=e.transform(t,[s]);n[0]===t?o=!1:t=n[0]}return e.createPrinter({newLine:e.NewLineKind.LineFeed,removeComments:!1,omitTrailingSemicolon:!1,noEmitHelpers:!1}).printFile(t)};const e=await import("typescript");export{m as default,e as ts}; +var s=async(...[a])=>{const t=e.createSourceFile("temp.ts",a,e.ScriptTarget.Latest,!0),i=new Map([]),r=new Map([]);return(await import("./Output/Visit.js")).default(i,r)(t),e.createPrinter({newLine:e.NewLineKind.LineFeed,removeComments:!1,omitTrailingSemicolon:!1,noEmitHelpers:!1}).printFile(e.transform(t,[(await import("./Output/Transformer.js")).default(i,r)]).transformed[0])};const e=await import("typescript");export{s as default,e as ts}; diff --git a/Target/Function/Output/Transformer/Visit.js b/Target/Function/Output/Transformer/Visit.js index 2634b2cd..7490b1ae 100644 --- a/Target/Function/Output/Transformer/Visit.js +++ b/Target/Function/Output/Transformer/Visit.js @@ -1 +1 @@ -var m=(r=>(r.MAX_DEPTH_EXCEEDED="MAX_DEPTH_EXCEEDED",r.MAX_VISITS_EXCEEDED="MAX_VISITS_EXCEEDED",r.MAX_ITERATIONS_EXCEEDED="MAX_ITERATIONS_EXCEEDED",r.CIRCULAR_REFERENCE="CIRCULAR_REFERENCE",r.TRANSFORM_ERROR="TRANSFORM_ERROR",r.INVALID_IDENTIFIER="INVALID_IDENTIFIER",r.INVALID_PROPERTY_ACCESS="INVALID_PROPERTY_ACCESS",r.UNINITIALIZED_VARIABLE="UNINITIALIZED_VARIABLE",r.SELF_REFERENCE="SELF_REFERENCE",r))(m||{}),R=(o=>(o.POTENTIAL_SIDE_EFFECT="POTENTIAL_SIDE_EFFECT",o.UNUSED_DECLARATION="UNUSED_DECLARATION",o.COMPLEX_INITIALIZATION="COMPLEX_INITIALIZATION",o))(R||{});const f={MAX_RECURSIVE_DEPTH:100,MAX_NODE_VISITS:1e3,MAX_ITERATIONS:100,BATCH_SIZE:50,CACHE_SIZE_LIMIT:1e4};class I{dependencies=new Map;detectCircular(c,u){const o=new Set,e=[c];for(;e.length>0;){const i=e.pop();o.add(i);const s=this.dependencies.get(i)||u;if(s)for(const t of s){if(t===c)return!0;o.has(t)||e.push(t)}}return this.dependencies.set(c,u),!1}clear(){this.dependencies.clear()}}class N{cache=new Map;size=0;get(c){return this.cache.get(c)}set(c,u){if(this.size>=f.CACHE_SIZE_LIMIT){const o=this.cache.keys().next().value;o&&this.cache.delete(o),this.size--}this.cache.set(c,u),this.size++}clear(){this.cache.clear(),this.size=0}}const V=(E,c)=>{class u{state;cache;circularDetector;preservedVariables=new Set;constructor(e){this.state={visitCount:0,iterationCount:0,context:e,errors:[],warnings:[],processedNodes:new Set,dependencyGraph:new Map},this.cache=new N,this.circularDetector=new I}createVisitResult(e,i,s){return Object.freeze({node:e,modified:i,dependencies:typeof s<"u"?s:new Set([])})}getCacheKey(e){return`${e.kind}-${e.pos}-${e.end}-${this.state.iterationCount}`}validateNode(e,i){return i>f.MAX_RECURSIVE_DEPTH?{isValid:!1,error:{code:"MAX_DEPTH_EXCEEDED",message:`Maximum depth of ${f.MAX_RECURSIVE_DEPTH} exceeded`,node:e}}:this.state.visitCount>f.MAX_NODE_VISITS?{isValid:!1,error:{code:"MAX_VISITS_EXCEEDED",message:`Maximum visits of ${f.MAX_NODE_VISITS} exceeded`,node:e}}:{isValid:!0}}handleIdentifier(e){const i=e.text;if(this.preservedVariables.has(i))return this.createVisitResult(e,!1);if(!E.get(i))return this.createVisitResult(e,!1);let t;for(const[r,l]of c.entries())if(l===i){t=r;break}if(!t)return this.createVisitResult(e,!1);if(this.isSelfReference(e,t))return this.createVisitResult(e,!1,new Set([i]));const a=this.collectDependencies(t);if(this.circularDetector.detectCircular(i,a))return this.createVisitResult(e,!1);try{const r=this.transformNodeSafely(t),l=this.visitNode(r);return n.isExpression(l.node)?this.createVisitResult(l.node,!0,a):this.createVisitResult(e,!1)}catch(r){return this.handleError(r,e),this.createVisitResult(e,!1)}}isSelfReference(e,i){return h(i)?e.text===i.text:!1}collectDependencies(e){const i=new Set,s=t=>{h(t)&&i.add(t.text),n.forEachChild(t,s)};return s(e),i}transformNodeSafely(e){try{return n.transform(e,[s=>t=>t],{noEmitHelpers:!0,preserveConstEnums:!0,preserveValueImports:!0}).transformed[0]||e}catch(i){return console.log(i),e}}handleError(e,i){this.state.errors=[...this.state.errors,{code:"TRANSFORM_ERROR",message:e instanceof Error?e.message:String(e),node:i,stack:e instanceof Error?e.stack??"undefined":"undefined"}]}visitNode(e,i=0){const s=this.validateNode(e,i);if(!s.isValid)return this.handleError(s.error,e),this.createVisitResult(e,!1);const t=this.getCacheKey(e),a=this.cache.get(t);if(a)return a;this.state.visitCount++;let r;return h(e)?r=this.handleIdentifier(e):n.isVariableStatement(e)?r=this.handleVariableStatement(e):r=this.handleGenericNode(e,i),this.cache.set(t,r),r}shouldInlineVariable(e,i,s){const t=E.get(e);return!t||!i||t>1||s.modifiers?.some(r=>r.kind===n.SyntaxKind.ExportKeyword)?(this.preservedVariables.add(e),!1):this.containsComplexExpression(i)?(this.preservedVariables.add(e),!1):!0}containsComplexExpression(e){let i=!1;const s=t=>{if(n.isCallExpression(t)||n.isPropertyAccessExpression(t)||n.isElementAccessExpression(t)||n.isNewExpression(t)){i=!0;return}n.forEachChild(t,s)};return s(e),i}handleVariableStatement(e){const i=[];let s=!1;for(const t of e.declarationList.declarations){if(!h(t.name)){i.push(t);continue}const a=t.name.text;if(this.shouldInlineVariable(a,t.initializer,e)){t.initializer&&!c.has(t.initializer)&&c.set(t.initializer,a),s=!0;continue}if(t.initializer){const r=this.visitNode(t.initializer);r.modified&&n.isExpression(r.node)?(s=!0,i.push(d.updateVariableDeclaration(t,t.name,t.exclamationToken,t.type,r.node))):i.push(t)}else i.push(t)}return i.length===0?this.createVisitResult(e.parent,!0):s?this.createVisitResult(d.updateVariableStatement(e,e.modifiers,d.createVariableDeclarationList(i,e.declarationList.flags)),!0):this.createVisitResult(e,!1)}handleGenericNode(e,i){let s=!1;if(n.isShorthandPropertyAssignment(e)){const a=this.visitNode(e.name);return a.modified&&n.isExpression(a.node)?this.createVisitResult(d.createPropertyAssignment(e.name,a.node),!0):this.createVisitResult(e,!1)}if(n.isPropertyAssignment(e)){const a=n.isComputedPropertyName(e.name)?this.visitNode(e.name.expression):{node:e.name,modified:!1},r=this.visitNode(e.initializer);if(a.modified||r.modified){s=!0;const l=n.isComputedPropertyName(e.name)?d.createComputedPropertyName(a.node):e.name;return this.createVisitResult(d.createPropertyAssignment(l,r.node),!0)}return this.createVisitResult(e,!1)}if(n.isArrayLiteralExpression(e)){const a=e.elements.map(r=>{if(n.isSpreadElement(r)){const p=this.visitNode(r.expression);return s=s||p.modified,d.createSpreadElement(p.node)}const l=this.visitNode(r);return s=s||l.modified,l.node});return s?this.createVisitResult(d.createArrayLiteralExpression(a),!0):this.createVisitResult(e,!1)}if(n.isObjectLiteralExpression(e)){const a=e.properties.map(r=>{if(n.isSpreadAssignment(r))return r;const l=this.visitNode(r);return s=s||l.modified,l.node});return s?this.createVisitResult(d.createObjectLiteralExpression(a),!0):this.createVisitResult(e,!1)}const t=n.visitEachChild(e,a=>{const r=this.visitNode(a,i+1);return s=s||r.modified,r.node},this.state.context);return this.createVisitResult(t,s)}getState(){return this.state}}return o=>e=>{const i=new u(o);let s=e,t=0;for(;t0&&console.error("Transformation errors:",r.errors),r.warnings.length>0&&console.warn("Transformation warnings:",r.warnings)}return s}},{default:n,isIdentifier:h,factory:d}=await import("typescript"),{default:S}=await import("../../Output/Visit/Get.js");var T=V;export{V as Fn,S as Get,T as default,d as factory,h as isIdentifier,n as ts}; +var m=(i=>(i.MAX_DEPTH_EXCEEDED="MAX_DEPTH_EXCEEDED",i.MAX_VISITS_EXCEEDED="MAX_VISITS_EXCEEDED",i.MAX_ITERATIONS_EXCEEDED="MAX_ITERATIONS_EXCEEDED",i.CIRCULAR_REFERENCE="CIRCULAR_REFERENCE",i.TRANSFORM_ERROR="TRANSFORM_ERROR",i.INVALID_IDENTIFIER="INVALID_IDENTIFIER",i.INVALID_PROPERTY_ACCESS="INVALID_PROPERTY_ACCESS",i.UNINITIALIZED_VARIABLE="UNINITIALIZED_VARIABLE",i.SELF_REFERENCE="SELF_REFERENCE",i))(m||{}),R=(l=>(l.POTENTIAL_SIDE_EFFECT="POTENTIAL_SIDE_EFFECT",l.UNUSED_DECLARATION="UNUSED_DECLARATION",l.COMPLEX_INITIALIZATION="COMPLEX_INITIALIZATION",l))(R||{});const E={MAX_RECURSIVE_DEPTH:100,MAX_NODE_VISITS:1e3,MAX_ITERATIONS:100,BATCH_SIZE:50,CACHE_SIZE_LIMIT:1e4};class N{dependencies=new Map;detectCircular(c,f){const l=new Set,e=[c];for(;e.length>0;){const t=e.pop();l.add(t);const s=this.dependencies.get(t)||f;if(s)for(const r of s){if(r===c)return!0;l.has(r)||e.push(r)}}return this.dependencies.set(c,f),!1}clear(){this.dependencies.clear()}}class I{cache=new Map;size=0;get(c){return this.cache.get(c)}set(c,f){if(this.size>=E.CACHE_SIZE_LIMIT){const l=this.cache.keys().next().value;l&&this.cache.delete(l),this.size--}this.cache.set(c,f),this.size++}clear(){this.cache.clear(),this.size=0}}const V=(h,c)=>{class f{state;cache;circularDetector;preservedVariables=new Map;constructor(e){this.state={visitCount:0,iterationCount:0,context:e,errors:[],warnings:[],processedNodes:new Set,dependencyGraph:new Map},this.cache=new I,this.circularDetector=new N}createVisitResult(e,t,s){return Object.freeze({node:e,modified:t,dependencies:typeof s<"u"?s:new Set([])})}getCacheKey(e){return`${e.kind}-${e.pos}-${e.end}-${this.state.iterationCount}`}validateNode(e,t){return t>E.MAX_RECURSIVE_DEPTH?{isValid:!1,error:{code:"MAX_DEPTH_EXCEEDED",message:`Maximum depth of ${E.MAX_RECURSIVE_DEPTH} exceeded`,node:e}}:this.state.visitCount>E.MAX_NODE_VISITS?{isValid:!1,error:{code:"MAX_VISITS_EXCEEDED",message:`Maximum visits of ${E.MAX_NODE_VISITS} exceeded`,node:e}}:{isValid:!0}}handleIdentifier(e){const t=e.text;if(this.preservedVariables.has(t))return this.createVisitResult(e,!1);if(!h.get(t))return this.createVisitResult(e,!1);let r;for(const[o,u]of c.entries())if(u===t){r=o;break}if(!r)return this.createVisitResult(e,!1);const a=this.findParentVariableDeclaration(e);if(a&&n.isIdentifier(a.name)&&a.name.text===t)return this.createVisitResult(e,!1);if(this.isSelfReference(e,r))return this.createVisitResult(e,!1,new Set([t]));const i=this.collectDependencies(r);if(this.circularDetector.detectCircular(t,i))return this.createVisitResult(e,!1);try{const o=this.transformNodeSafely(r),u=this.visitNode(o);return n.isExpression(u.node)?this.createVisitResult(u.node,!0,i):this.createVisitResult(e,!1)}catch(o){return this.handleError(o,e),this.createVisitResult(e,!1)}}findParentVariableDeclaration(e){let t=e.parent;for(;t;){if(n.isVariableDeclaration(t))return t;t=t.parent}}isSelfReference(e,t){return p(t)?e.text===t.text:!1}collectDependencies(e){const t=new Set,s=r=>{p(r)&&t.add(r.text),n.forEachChild(r,s)};return s(e),t}transformNodeSafely(e){try{return n.transform(e,[s=>r=>r],{noEmitHelpers:!0,preserveConstEnums:!0,preserveValueImports:!0}).transformed[0]||e}catch(t){return console.log(t),e}}handleError(e,t){this.state.errors=[...this.state.errors,{code:"TRANSFORM_ERROR",message:e instanceof Error?e.message:String(e),node:t,stack:e instanceof Error?e.stack??"undefined":"undefined"}]}visitNode(e,t=0){const s=this.validateNode(e,t);if(!s.isValid)return this.handleError(s.error,e),this.createVisitResult(e,!1);const r=this.getCacheKey(e),a=this.cache.get(r);if(a)return a;this.state.visitCount++;let i;return p(e)?i=this.handleIdentifier(e):n.isVariableStatement(e)?i=this.handleVariableStatement(e):i=this.handleGenericNode(e,t),this.cache.set(r,i),i}shouldPreserveVariable(e,t,s){const r=h.get(e);return!t||!r||r>1||s.modifiers?.some(a=>a.kind===n.SyntaxKind.ExportKeyword)?!0:this.containsComplexExpression(t)}containsComplexExpression(e){let t=!1;const s=r=>{if(n.isCallExpression(r)||n.isPropertyAccessExpression(r)||n.isElementAccessExpression(r)||n.isNewExpression(r)){t=!0;return}n.forEachChild(r,s)};return s(e),t}handleVariableStatement(e){const t=[];let s=!1;for(const r of e.declarationList.declarations){if(!p(r.name)){t.push(r);continue}const a=r.name.text;if(this.shouldPreserveVariable(a,r.initializer,e)){if(r.initializer&&this.preservedVariables.set(a,r.initializer),r.initializer){const i=this.visitNode(r.initializer);i.modified&&n.isExpression(i.node)?(s=!0,t.push(d.updateVariableDeclaration(r,r.name,r.exclamationToken,r.type,i.node))):t.push(r)}else t.push(r);continue}r.initializer&&!c.has(r.initializer)&&c.set(r.initializer,a),s=!0}return t.length===0?this.createVisitResult(e.parent,!0):s?this.createVisitResult(d.updateVariableStatement(e,e.modifiers,d.createVariableDeclarationList(t,e.declarationList.flags)),!0):this.createVisitResult(e,!1)}handleGenericNode(e,t){let s=!1;if(n.isShorthandPropertyAssignment(e)){const a=this.visitNode(e.name);return a.modified&&n.isExpression(a.node)?this.createVisitResult(d.createPropertyAssignment(e.name,a.node),!0):this.createVisitResult(e,!1)}if(n.isPropertyAssignment(e)){const a=n.isComputedPropertyName(e.name)?this.visitNode(e.name.expression):{node:e.name,modified:!1},i=this.visitNode(e.initializer);if(a.modified||i.modified){s=!0;const o=n.isComputedPropertyName(e.name)?d.createComputedPropertyName(a.node):e.name;return this.createVisitResult(d.createPropertyAssignment(o,i.node),!0)}return this.createVisitResult(e,!1)}if(n.isArrayLiteralExpression(e)){const a=e.elements.map(i=>{if(n.isSpreadElement(i)){const u=this.visitNode(i.expression);return s=s||u.modified,d.createSpreadElement(u.node)}const o=this.visitNode(i);return s=s||o.modified,o.node});return s?this.createVisitResult(d.createArrayLiteralExpression(a),!0):this.createVisitResult(e,!1)}if(n.isObjectLiteralExpression(e)){const a=e.properties.map(i=>{if(n.isSpreadAssignment(i))return i;const o=this.visitNode(i);return s=s||o.modified,o.node});return s?this.createVisitResult(d.createObjectLiteralExpression(a),!0):this.createVisitResult(e,!1)}const r=n.visitEachChild(e,a=>{const i=this.visitNode(a,t+1);return s=s||i.modified,i.node},this.state.context);return this.createVisitResult(r,s)}getState(){return this.state}}return l=>e=>{const t=new f(l);let s=e,r=0;for(;r0&&console.error("Transformation errors:",i.errors),i.warnings.length>0&&console.warn("Transformation warnings:",i.warnings)}return s}},{default:n,isIdentifier:p,factory:d}=await import("typescript"),{default:S}=await import("../../Output/Visit/Get.js");var T=V;export{V as Fn,S as Get,T as default,d as factory,p as isIdentifier,n as ts}; diff --git a/Target/Function/Output/Visit.js b/Target/Function/Output/Visit.js index fb68bea4..0f3c44a6 100644 --- a/Target/Function/Output/Visit.js +++ b/Target/Function/Output/Visit.js @@ -1 +1 @@ -const l=(...[n,s])=>(...[e])=>{const f=new Set,c=`${t.SyntaxKind[e.kind]}-${e.pos}-${e.end}`;if(f.has(c)){console.warn("Warning: Circular reference detected",{TypeNode:t.SyntaxKind[e.kind],Position:e.pos,Text:e.getText?.()});return}if(f.add(c),t.forEachChild(e,l(n,s)),n.size>=54||s.size>=1e3){console.warn("Warning: Maximum map size reached",{UsageLength:n.size,InitializerLength:s.size});return}if(t.isVariableDeclaration(e)&&e.initializer){const i=e.name.getText();if((()=>{let o=!1;const p=r=>{t.isIdentifier(r)&&r.text===i&&!t.isTemplateExpression(r.parent)&&!t.isTemplateSpan(r.parent)&&!t.isPropertyAccessExpression(r.parent)&&(o=!0),t.forEachChild(r,p)};return p(e.initializer),o})()){console.info(`Info: Skipping self-referential initializer for: ${i}`,{TypeNode:t.SyntaxKind[e.kind],Position:e.pos,Text:e.getText?.()});return}!n.has(i)&&n.size<54&&n.set(i,0),s.size<1e3&&s.set(e.initializer,i)}else if(t.isIdentifier(e)){const i=e.getText();if(!t.isVariableDeclaration(e.parent)){const a=n.get(i)??0;a<54?n.set(i,a+1):console.warn(`Warning: Maximum usage count reached for identifier: ${i}`,{TypeNode:t.SyntaxKind[e.kind],Position:e.pos,Text:e.getText?.()})}}},{default:t}=await import("typescript");var I=l;export{l as Fn,I as default,t as ts}; +const l=(...[n,s])=>(...[e])=>{const f=new Set,c=`${t.SyntaxKind[e.kind]}-${e.pos}-${e.end}`;if(f.has(c)){console.warn("Warning: Circular reference detected",{TypeNode:t.SyntaxKind[e.kind],Position:e.pos,Text:e.getText?.()});return}if(f.add(c),t.forEachChild(e,l(n,s)),n.size>=1e3||s.size>=1e3){console.warn("Warning: Maximum map size reached",{UsageLength:n.size,InitializerLength:s.size});return}if(t.isVariableDeclaration(e)&&e.initializer){const i=e.name.getText();if((()=>{let o=!1;const p=r=>{t.isIdentifier(r)&&r.text===i&&!t.isTemplateExpression(r.parent)&&!t.isTemplateSpan(r.parent)&&!t.isPropertyAccessExpression(r.parent)&&(o=!0),t.forEachChild(r,p)};return p(e.initializer),o})()){console.info(`Info: Skipping self-referential initializer for: ${i}`,{TypeNode:t.SyntaxKind[e.kind],Position:e.pos,Text:e.getText?.()});return}!n.has(i)&&n.size<1e3&&n.set(i,0),s.size<1e3&&s.set(e.initializer,i)}else if(t.isIdentifier(e)){const i=e.getText();if(!t.isVariableDeclaration(e.parent)){const a=n.get(i)??0;a<1e3?n.set(i,a+1):console.warn(`Warning: Maximum usage count reached for identifier: ${i}`,{TypeNode:t.SyntaxKind[e.kind],Position:e.pos,Text:e.getText?.()})}}},{default:t}=await import("typescript");var I=l;export{l as Fn,I as default,t as ts};