split vscode.proposed.d.ts into a file per proposal, https://github.com/microsoft/vscode/issues/131165

This commit is contained in:
Johannes Rieken 2021-11-12 09:48:08 +01:00
parent 4e8450ad93
commit a4d426a1c2
No known key found for this signature in database
GPG key ID: 96634B5AF12F8798
70 changed files with 3027 additions and 2785 deletions

View file

@ -1064,7 +1064,7 @@
{
"files": [
"**/vscode.d.ts",
"**/vscode.proposed.d.ts"
"**/vscode.proposed.*.d.ts"
],
"rules": {
"vscode-dts-create-func": "warn",

View file

@ -6,6 +6,6 @@
"include": [
"src/**/*",
"../../../src/vscode-dts/vscode.d.ts",
"../../../src/vscode-dts/vscode.proposed.d.ts",
"../../../src/vscode-dts/vscode.proposed.*.d.ts",
]
}

View file

@ -10,6 +10,6 @@
"include": [
"src/**/*",
"../../src/vscode-dts/vscode.d.ts",
"../../src/vscode-dts/vscode.proposed.d.ts",
"../../src/vscode-dts/vscode.proposed.*.d.ts",
]
}

View file

@ -10,7 +10,7 @@
"include": [
"src/**/*",
"../../src/vscode-dts/vscode.d.ts",
"../../src/vscode-dts/vscode.proposed.d.ts",
"../../src/vscode-dts/vscode.proposed.*.d.ts",
"../types/lib.textEncoder.d.ts"
]
}

View file

@ -10,6 +10,6 @@
"include": [
"src/**/*",
"../../src/vscode-dts/vscode.d.ts",
"../../src/vscode-dts/vscode.proposed.d.ts"
"../../src/vscode-dts/vscode.proposed.*.d.ts"
]
}

View file

@ -10,6 +10,6 @@
"include": [
"src/**/*",
"../../src/vscode-dts/vscode.d.ts",
"../../src/vscode-dts/vscode.proposed.d.ts"
"../../src/vscode-dts/vscode.proposed.*.d.ts"
]
}

View file

@ -6,6 +6,6 @@
"include": [
"src/**/*",
"../../../src/vscode-dts/vscode.d.ts",
"../../../src/vscode-dts/vscode.proposed.d.ts"
"../../../src/vscode-dts/vscode.proposed.*.d.ts"
]
}

View file

@ -7,6 +7,6 @@
"include": [
"src/**/*",
"../../src/vscode-dts/vscode.d.ts",
"../../src/vscode-dts/vscode.proposed.d.ts"
"../../src/vscode-dts/vscode.proposed.*.d.ts"
]
}

View file

@ -9,6 +9,6 @@
"include": [
"src/**/*",
"../../src/vscode-dts/vscode.d.ts",
"../../src/vscode-dts/vscode.proposed.d.ts"
"../../src/vscode-dts/vscode.proposed.*.d.ts"
]
}

View file

@ -6,6 +6,6 @@
"include": [
"src/**/*",
"../../../src/vscode-dts/vscode.d.ts",
"../../../src/vscode-dts/vscode.proposed.d.ts"
"../../../src/vscode-dts/vscode.proposed.*.d.ts"
]
}

View file

@ -6,6 +6,6 @@
"include": [
"src/**/*",
"../../src/vscode-dts/vscode.d.ts",
"../../src/vscode-dts/vscode.proposed.d.ts"
"../../src/vscode-dts/vscode.proposed.*.d.ts"
]
}

View file

@ -19,6 +19,6 @@
"include": [
"src/**/*",
"../../src/vscode-dts/vscode.d.ts",
"../../src/vscode-dts/vscode.proposed.d.ts"
"../../src/vscode-dts/vscode.proposed.*.d.ts"
]
}

View file

@ -9,6 +9,6 @@
"include": [
"src/**/*",
"../../src/vscode-dts/vscode.d.ts",
"../../src/vscode-dts/vscode.proposed.d.ts"
"../../src/vscode-dts/vscode.proposed.*.d.ts"
]
}

View file

@ -9,6 +9,6 @@
"include": [
"src/**/*",
"../../src/vscode-dts/vscode.d.ts",
"../../src/vscode-dts/vscode.proposed.d.ts"
"../../src/vscode-dts/vscode.proposed.*.d.ts"
]
}

View file

@ -6,6 +6,6 @@
"include": [
"src/**/*",
"../../src/vscode-dts/vscode.d.ts",
"../../src/vscode-dts/vscode.proposed.d.ts"
"../../src/vscode-dts/vscode.proposed.*.d.ts"
]
}

View file

@ -7,6 +7,6 @@
"include": [
"src/**/*",
"../../src/vscode-dts/vscode.d.ts",
"../../src/vscode-dts/vscode.proposed.d.ts"
"../../src/vscode-dts/vscode.proposed.*.d.ts"
]
}

View file

@ -11,6 +11,6 @@
"src/**/*",
"../../src/vscode-dts/vscode.d.ts",
"../../src/vscode-dts/vscode.proposed.languageStatus.d.ts",
"../../src/vscode-dts/vscode.proposed.d.ts"
"../../src/vscode-dts/vscode.proposed.*.d.ts"
]
}

View file

@ -9,6 +9,6 @@
"include": [
"src/**/*",
"../../src/vscode-dts/vscode.d.ts",
"../../src/vscode-dts/vscode.proposed.d.ts"
"../../src/vscode-dts/vscode.proposed.*.d.ts"
]
}

View file

@ -9,6 +9,6 @@
"include": [
"src/**/*",
"../../src/vscode-dts/vscode.d.ts",
"../../src/vscode-dts/vscode.proposed.d.ts"
"../../src/vscode-dts/vscode.proposed.*.d.ts"
]
}

View file

@ -9,6 +9,6 @@
"include": [
"src/**/*",
"../../src/vscode-dts/vscode.d.ts",
"../../src/vscode-dts/vscode.proposed.d.ts"
"../../src/vscode-dts/vscode.proposed.*.d.ts"
]
}

View file

@ -9,6 +9,6 @@
"include": [
"src/**/*",
"../../src/vscode-dts/vscode.d.ts",
"../../src/vscode-dts/vscode.proposed.d.ts"
"../../src/vscode-dts/vscode.proposed.*.d.ts"
]
}

View file

@ -26,7 +26,6 @@
"./typings",
"./vs",
"vscode-dts/vscode.proposed.*.d.ts",
"vscode-dts/vscode.proposed.d.ts",
"vscode-dts/vscode.d.ts"
]
}

View file

@ -2,6 +2,6 @@
"extends": "./tsconfig.vscode-dts.json",
"include": [
"vscode-dts/vscode.d.ts",
"vscode-dts/vscode.proposed.d.ts",
"vscode-dts/vscode.proposed.*.d.ts",
]
}

View file

@ -218,7 +218,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
informOnce();
}
if (typeof filter.exclusive === 'boolean') {
checkProposedApiEnabled(extension);
checkProposedApiEnabled(extension, 'documentFiltersExclusive');
}
}
return selector;
@ -271,7 +271,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
}, undefined, undefined, extension);
},
registerDiffInformationCommand: (id: string, callback: (diff: vscode.LineChange[], ...args: any[]) => any, thisArg?: any): vscode.Disposable => {
checkProposedApiEnabled(extension);
checkProposedApiEnabled(extension, 'diffCommand');
return extHostCommands.registerCommand(true, id, async (...args: any[]): Promise<any> => {
const activeTextEditor = extHostDocumentsAndEditors.activeEditor(true);
if (!activeTextEditor) {
@ -339,7 +339,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
return getRemoteName(initData.remote.authority);
},
get remoteAuthority() {
checkProposedApiEnabled(extension);
checkProposedApiEnabled(extension, 'resolvers');
return initData.remote.authority;
},
get uiKind() {
@ -360,19 +360,19 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
return extHostTesting.createTestController(provider, label);
},
createTestObserver() {
checkProposedApiEnabled(extension);
checkProposedApiEnabled(extension, 'testObserver');
return extHostTesting.createTestObserver();
},
runTests(provider) {
checkProposedApiEnabled(extension);
checkProposedApiEnabled(extension, 'testObserver');
return extHostTesting.runTests(provider);
},
get onDidChangeTestResults() {
checkProposedApiEnabled(extension);
checkProposedApiEnabled(extension, 'testObserver');
return extHostTesting.onResultsChanged;
},
get testResults() {
checkProposedApiEnabled(extension);
checkProposedApiEnabled(extension, 'testObserver');
return extHostTesting.results;
},
};
@ -484,7 +484,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
return extHostLanguageFeatures.registerCompletionItemProvider(extension, checkSelector(selector), provider, triggerCharacters);
},
registerInlineCompletionItemProvider(selector: vscode.DocumentSelector, provider: vscode.InlineCompletionItemProvider): vscode.Disposable {
checkProposedApiEnabled(extension);
checkProposedApiEnabled(extension, 'inlineCompletions');
return extHostLanguageFeatures.registerInlineCompletionsProvider(extension, checkSelector(selector), provider);
},
registerDocumentLinkProvider(selector: vscode.DocumentSelector, provider: vscode.DocumentLinkProvider): vscode.Disposable {
@ -509,11 +509,11 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
return extHostLanguageFeatures.setLanguageConfiguration(extension, language, configuration);
},
getTokenInformationAtPosition(doc: vscode.TextDocument, pos: vscode.Position) {
checkProposedApiEnabled(extension);
checkProposedApiEnabled(extension, 'tokenInformation');
return extHostLanguages.tokenAtPosition(doc, pos);
},
registerInlayHintsProvider(selector: vscode.DocumentSelector, provider: vscode.InlayHintsProvider): vscode.Disposable {
checkProposedApiEnabled(extension);
checkProposedApiEnabled(extension, 'inlayHints');
return extHostLanguageFeatures.registerInlayHintsProvider(extension, selector, provider);
},
createLanguageStatusItem(id: string, selector: vscode.DocumentSelector): vscode.LanguageStatusItem {
@ -574,14 +574,14 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
return extHostTerminalService.onDidChangeActiveTerminal(listener, thisArg, disposables);
},
onDidChangeTerminalDimensions(listener, thisArg?, disposables?) {
checkProposedApiEnabled(extension);
checkProposedApiEnabled(extension, 'terminalDimensions');
return extHostTerminalService.onDidChangeTerminalDimensions(listener, thisArg, disposables);
},
onDidChangeTerminalState(listener, thisArg?, disposables?) {
return extHostTerminalService.onDidChangeTerminalState(listener, thisArg, disposables);
},
onDidWriteTerminalData(listener, thisArg?, disposables?) {
checkProposedApiEnabled(extension);
checkProposedApiEnabled(extension, 'terminalDataWriteEvent');
return extHostTerminalService.onDidWriteTerminalData(listener, thisArg, disposables);
},
get state() {
@ -655,7 +655,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
createTerminal(nameOrOptions?: vscode.TerminalOptions | vscode.ExtensionTerminalOptions | string, shellPath?: string, shellArgs?: string[] | string): vscode.Terminal {
if (typeof nameOrOptions === 'object') {
if ('location' in nameOrOptions) {
checkProposedApiEnabled(extension);
checkProposedApiEnabled(extension, 'terminalLocation');
}
if ('pty' in nameOrOptions) {
return extHostTerminalService.createExtensionTerminal(nameOrOptions);
@ -708,55 +708,55 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
return extHostWebviewViews.registerWebviewViewProvider(extension, viewId, provider, options?.webviewOptions);
},
get activeNotebookEditor(): vscode.NotebookEditor | undefined {
checkProposedApiEnabled(extension);
checkProposedApiEnabled(extension, 'notebookEditor');
return extHostNotebook.activeNotebookEditor;
},
onDidChangeActiveNotebookEditor(listener, thisArgs?, disposables?) {
checkProposedApiEnabled(extension);
checkProposedApiEnabled(extension, 'notebookEditor');
return extHostNotebook.onDidChangeActiveNotebookEditor(listener, thisArgs, disposables);
},
get visibleNotebookEditors() {
checkProposedApiEnabled(extension);
checkProposedApiEnabled(extension, 'notebookEditor');
return extHostNotebook.visibleNotebookEditors;
},
get onDidChangeVisibleNotebookEditors() {
checkProposedApiEnabled(extension);
checkProposedApiEnabled(extension, 'notebookEditor');
return extHostNotebook.onDidChangeVisibleNotebookEditors;
},
onDidChangeNotebookEditorSelection(listener, thisArgs?, disposables?) {
checkProposedApiEnabled(extension);
checkProposedApiEnabled(extension, 'notebookEditor');
return extHostNotebookEditors.onDidChangeNotebookEditorSelection(listener, thisArgs, disposables);
},
onDidChangeNotebookEditorVisibleRanges(listener, thisArgs?, disposables?) {
checkProposedApiEnabled(extension);
checkProposedApiEnabled(extension, 'notebookEditor');
return extHostNotebookEditors.onDidChangeNotebookEditorVisibleRanges(listener, thisArgs, disposables);
},
showNotebookDocument(uriOrDocument, options?) {
checkProposedApiEnabled(extension);
checkProposedApiEnabled(extension, 'notebookEditor');
return extHostNotebook.showNotebookDocument(uriOrDocument, options);
},
registerExternalUriOpener(id: string, opener: vscode.ExternalUriOpener, metadata: vscode.ExternalUriOpenerMetadata) {
checkProposedApiEnabled(extension);
checkProposedApiEnabled(extension, 'externalUriOpener');
return extHostUriOpeners.registerExternalUriOpener(extension.identifier, id, opener, metadata);
},
get tabs() {
checkProposedApiEnabled(extension);
checkProposedApiEnabled(extension, 'tabs');
return extHostEditorTabs.tabs;
},
get activeTab() {
checkProposedApiEnabled(extension);
checkProposedApiEnabled(extension, 'tabs');
return extHostEditorTabs.activeTab;
},
get onDidChangeTabs() {
checkProposedApiEnabled(extension);
checkProposedApiEnabled(extension, 'tabs');
return extHostEditorTabs.onDidChangeTabs;
},
get onDidChangeActiveTab() {
checkProposedApiEnabled(extension);
checkProposedApiEnabled(extension, 'tabs');
return extHostEditorTabs.onDidChangeActiveTab;
},
getInlineCompletionItemController<T extends vscode.InlineCompletionItem>(provider: vscode.InlineCompletionItemProvider<T>): vscode.InlineCompletionController<T> {
checkProposedApiEnabled(extension);
checkProposedApiEnabled(extension, 'inlineCompletions');
return InlineCompletionController.get(provider);
}
};
@ -805,6 +805,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
return extHostWorkspace.findFiles(typeConverters.GlobPattern.from(include), typeConverters.GlobPattern.from(exclude), maxResults, extension.identifier, token);
},
findTextInFiles: (query: vscode.TextSearchQuery, optionsOrCallback: vscode.FindTextInFilesOptions | ((result: vscode.TextSearchResult) => void), callbackOrToken?: vscode.CancellationToken | ((result: vscode.TextSearchResult) => void), token?: vscode.CancellationToken) => {
checkProposedApiEnabled(extension, 'findTextInFiles');
let options: vscode.FindTextInFilesOptions;
let callback: (result: vscode.TextSearchResult) => void;
@ -891,11 +892,11 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
return extHostNotebook.onDidCloseNotebookDocument;
},
registerNotebookSerializer(viewType: string, serializer: vscode.NotebookSerializer, options?: vscode.NotebookDocumentContentOptions, registration?: vscode.NotebookRegistrationData) {
return extHostNotebook.registerNotebookSerializer(extension, viewType, serializer, options, isProposedApiEnabled(extension) ? registration : undefined);
return extHostNotebook.registerNotebookSerializer(extension, viewType, serializer, options, isProposedApiEnabled(extension, 'notebookLiveShare') ? registration : undefined);
},
registerNotebookContentProvider: (viewType: string, provider: vscode.NotebookContentProvider, options?: vscode.NotebookDocumentContentOptions, registration?: vscode.NotebookRegistrationData) => {
checkProposedApiEnabled(extension);
return extHostNotebook.registerNotebookContentProvider(extension, viewType, provider, options, isProposedApiEnabled(extension) ? registration : undefined);
checkProposedApiEnabled(extension, 'notebookContentProvider');
return extHostNotebook.registerNotebookContentProvider(extension, viewType, provider, options, isProposedApiEnabled(extension, 'notebookLiveShare') ? registration : undefined);
},
onDidChangeConfiguration: (listener: (_: any) => any, thisArgs?: any, disposables?: extHostTypes.Disposable[]) => {
return configProvider.onDidChangeConfiguration(listener, thisArgs, disposables);
@ -920,19 +921,19 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
return extHostConsumerFileSystem.value;
},
registerFileSearchProvider: (scheme: string, provider: vscode.FileSearchProvider) => {
checkProposedApiEnabled(extension);
checkProposedApiEnabled(extension, 'fileSearchProvider');
return extHostSearch.registerFileSearchProvider(scheme, provider);
},
registerTextSearchProvider: (scheme: string, provider: vscode.TextSearchProvider) => {
checkProposedApiEnabled(extension);
checkProposedApiEnabled(extension, 'textSearchProvider');
return extHostSearch.registerTextSearchProvider(scheme, provider);
},
registerRemoteAuthorityResolver: (authorityPrefix: string, resolver: vscode.RemoteAuthorityResolver) => {
checkProposedApiEnabled(extension);
checkProposedApiEnabled(extension, 'resolvers');
return extensionService.registerRemoteAuthorityResolver(authorityPrefix, resolver);
},
registerResourceLabelFormatter: (formatter: vscode.ResourceLabelFormatter) => {
checkProposedApiEnabled(extension);
checkProposedApiEnabled(extension, 'resolvers');
return extHostLabelService.$registerResourceLabelFormatter(formatter);
},
onDidCreateFiles: (listener, thisArg, disposables) => {
@ -954,7 +955,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
return extHostFileSystemEvent.getOnWillRenameFileEvent(extension)(listener, thisArg, disposables);
},
openTunnel: (forward: vscode.TunnelOptions) => {
checkProposedApiEnabled(extension);
checkProposedApiEnabled(extension, 'resolvers');
return extHostTunnelService.openTunnel(extension, forward).then(value => {
if (!value) {
throw new Error('cannot open tunnel');
@ -963,26 +964,26 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
});
},
get tunnels() {
checkProposedApiEnabled(extension);
checkProposedApiEnabled(extension, 'resolvers');
return extHostTunnelService.getTunnels();
},
onDidChangeTunnels: (listener, thisArg?, disposables?) => {
checkProposedApiEnabled(extension);
checkProposedApiEnabled(extension, 'resolvers');
return extHostTunnelService.onDidChangeTunnels(listener, thisArg, disposables);
},
registerPortAttributesProvider: (portSelector: { pid?: number, portRange?: [number, number], commandMatcher?: RegExp }, provider: vscode.PortAttributesProvider) => {
checkProposedApiEnabled(extension);
checkProposedApiEnabled(extension, 'portsAttributes');
return extHostTunnelService.registerPortsAttributesProvider(portSelector, provider);
},
registerTimelineProvider: (scheme: string | string[], provider: vscode.TimelineProvider) => {
checkProposedApiEnabled(extension);
checkProposedApiEnabled(extension, 'timeline');
return extHostTimeline.registerTimelineProvider(scheme, provider, extension.identifier, extHostCommands.converter);
},
get isTrusted() {
return extHostWorkspace.trusted;
},
requestWorkspaceTrust: (options?: vscode.WorkspaceTrustRequestOptions) => {
checkProposedApiEnabled(extension);
checkProposedApiEnabled(extension, 'workspaceTrust');
return extHostWorkspace.requestWorkspaceTrust(options);
},
onDidGrantWorkspaceTrust: (listener, thisArgs?, disposables?) => {
@ -1095,7 +1096,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
// namespace: notebook
const notebooks: typeof vscode.notebooks = {
createNotebookController(id: string, notebookType: string, label: string, handler?, rendererScripts?: vscode.NotebookRendererScript[]) {
return extHostNotebookKernels.createNotebookController(extension, id, notebookType, label, handler, isProposedApiEnabled(extension) ? rendererScripts : undefined);
return extHostNotebookKernels.createNotebookController(extension, id, notebookType, label, handler, isProposedApiEnabled(extension, 'notebookMessaging') ? rendererScripts : undefined);
},
registerNotebookCellStatusBarItemProvider: (notebookType: string, provider: vscode.NotebookCellStatusBarItemProvider) => {
return extHostNotebook.registerNotebookCellStatusBarItemProvider(extension, notebookType, provider);
@ -1105,7 +1106,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
return extHostNotebookDocuments.onDidSaveNotebookDocument;
},
createNotebookEditorDecorationType(options: vscode.NotebookDecorationRenderOptions): vscode.NotebookEditorDecorationType {
checkProposedApiEnabled(extension);
checkProposedApiEnabled(extension, 'notebookEditorDecorationType');
return extHostNotebookEditors.createNotebookEditorDecorationType(options);
},
createRendererMessaging(rendererId) {
@ -1120,7 +1121,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
return extHostNotebook.onDidChangeNotebookCells(listener, thisArgs, disposables);
},
onDidChangeNotebookCellExecutionState(listener, thisArgs?, disposables?) {
checkProposedApiEnabled(extension);
checkProposedApiEnabled(extension, 'notebookCellExecutionState');
return extHostNotebook.onDidChangeNotebookCellExecutionState(listener, thisArgs, disposables);
},
onDidChangeCellOutputs(listener, thisArgs?, disposables?) {
@ -1132,7 +1133,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
return extHostNotebook.onDidChangeCellMetadata(listener, thisArgs, disposables);
},
createConcatTextDocument(notebook, selector) {
checkProposedApiEnabled(extension);
checkProposedApiEnabled(extension, 'notebookConcatTextDocument');
return new ExtHostNotebookConcatDocument(extHostNotebook, extHostDocuments, notebook, selector);
},
};

View file

@ -447,7 +447,7 @@ export abstract class AbstractExtHostExtensionService extends Disposable impleme
return extension;
},
get extensionRuntime() {
checkProposedApiEnabled(extensionDescription);
checkProposedApiEnabled(extensionDescription, 'extensionRuntime');
return that.extensionRuntime;
},
get environmentVariableCollection() { return that._extHostTerminalService.getEnvironmentVariableCollection(extensionDescription); }

View file

@ -234,11 +234,11 @@ export class ExtHostNotebookKernels implements ExtHostNotebookKernelsShape {
// --- ipc
onDidReceiveMessage: onDidReceiveMessage.event,
postMessage(message, editor) {
checkProposedApiEnabled(extension);
checkProposedApiEnabled(extension, 'notebookMessaging');
return that._proxy.$postMessage(handle, editor && that._extHostNotebook.getIdByEditor(editor), message);
},
asWebviewUri(uri: URI) {
checkProposedApiEnabled(extension);
checkProposedApiEnabled(extension, 'notebookMessaging');
return asWebviewUri(uri, that._initData.remote);
},
};

View file

@ -230,13 +230,13 @@ export class ExtHostSCMInputBox implements vscode.SourceControlInputBox {
private _validateInput: IValidateInput | undefined;
get validateInput(): IValidateInput | undefined {
checkProposedApiEnabled(this._extension);
checkProposedApiEnabled(this._extension, 'scmValidation');
return this._validateInput;
}
set validateInput(fn: IValidateInput | undefined) {
checkProposedApiEnabled(this._extension);
checkProposedApiEnabled(this._extension, 'scmValidation');
if (fn && typeof fn !== 'function') {
throw new Error(`[${this._extension.identifier.value}]: Invalid SCM input box validation function`);
@ -268,7 +268,7 @@ export class ExtHostSCMInputBox implements vscode.SourceControlInputBox {
}
showValidationMessage(message: string | vscode.MarkdownString, type: vscode.SourceControlInputBoxValidationType) {
checkProposedApiEnabled(this._extension);
checkProposedApiEnabled(this._extension, 'scmValidation');
this._proxy.$showValidationMessage(this._sourceControlHandle, message, type as any);
}
@ -506,7 +506,7 @@ class ExtHostSourceControl implements vscode.SourceControl {
return this._actionButton;
}
set actionButton(actionButton: vscode.Command | undefined) {
checkProposedApiEnabled(this._extension);
checkProposedApiEnabled(this._extension, 'scmActionButton');
this._actionButtonDisposables.value = new DisposableStore();
this._actionButton = actionButton;

View file

@ -6,8 +6,49 @@
// THIS IS A GENERATED FILE. DO NOT EDIT DIRECTLY.
export const allApiProposals = Object.freeze({
customEditorMove: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.customEditorMove.d.ts',
diffCommand: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.diffCommand.d.ts',
documentFiltersExclusive: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.documentFiltersExclusive.d.ts',
editorInsets: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.editorInsets.d.ts',
extensionRuntime: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.extensionRuntime.d.ts',
externalUriOpener: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.externalUriOpener.d.ts',
fileSearchProvider: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.fileSearchProvider.d.ts',
findTextInFiles: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.findTextInFiles.d.ts',
fsChunks: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.fsChunks.d.ts',
languageStatus: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.languageStatus.d.ts'
inlayHints: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.inlayHints.d.ts',
inlineCompletions: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.inlineCompletions.d.ts',
languageStatus: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.languageStatus.d.ts',
notebookCellExecutionState: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookCellExecutionState.d.ts',
notebookConcatTextDocument: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookConcatTextDocument.d.ts',
notebookContentProvider: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookContentProvider.d.ts',
notebookDebugOptions: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookDebugOptions.d.ts',
notebookDeprecated: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookDeprecated.d.ts',
notebookEditor: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookEditor.d.ts',
notebookEditorDecorationType: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookEditorDecorationType.d.ts',
notebookEditorEdit: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookEditorEdit.d.ts',
notebookLiveShare: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookLiveShare.d.ts',
notebookMessaging: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookMessaging.d.ts',
notebookMime: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookMime.d.ts',
portsAttributes: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.portsAttributes.d.ts',
quickPickSortByLabel: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.quickPickSortByLabel.d.ts',
resolvers: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.resolvers.d.ts',
scmActionButton: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.scmActionButton.d.ts',
scmSelectedProvider: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.scmSelectedProvider.d.ts',
scmValidation: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.scmValidation.d.ts',
tabs: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.tabs.d.ts',
taskPresentationGroup: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.taskPresentationGroup.d.ts',
terminalDataWriteEvent: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.terminalDataWriteEvent.d.ts',
terminalDimensions: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.terminalDimensions.d.ts',
terminalLocation: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.terminalLocation.d.ts',
terminalNameChangeEvent: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.terminalNameChangeEvent.d.ts',
testCoverage: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.testCoverage.d.ts',
testObserver: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.testObserver.d.ts',
textDocumentNotebook: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.textDocumentNotebook.d.ts',
textSearchProvider: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.textSearchProvider.d.ts',
timeline: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.timeline.d.ts',
tokenInformation: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.tokenInformation.d.ts',
treeViewDragAndDrop: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.treeViewDragAndDrop.d.ts',
treeViewReveal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.treeViewReveal.d.ts',
workspaceTrust: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.workspaceTrust.d.ts'
});
export type ApiProposalName = keyof typeof allApiProposals;

View file

@ -0,0 +1,29 @@
/*---------------------------------------------------------------------------------------------
* 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 vscode-dts-provider-naming
moveCustomTextEditor?(newDocument: TextDocument, existingWebviewPanel: WebviewPanel, token: CancellationToken): Thenable<void>;
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,38 @@
/*---------------------------------------------------------------------------------------------
* 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;
}
}

View file

@ -0,0 +1,13 @@
/*---------------------------------------------------------------------------------------------
* 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;
}
}

View file

@ -0,0 +1,24 @@
/*---------------------------------------------------------------------------------------------
* 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;
}
}

View file

@ -0,0 +1,163 @@
/*---------------------------------------------------------------------------------------------
* 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<ExternalUriOpenerPriority>;
/**
* 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> | 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<boolean>;
}
}

View file

@ -0,0 +1,67 @@
/*---------------------------------------------------------------------------------------------
* 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.
*/
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<Uri[]>;
}
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;
}
}

View file

@ -0,0 +1,98 @@
/*---------------------------------------------------------------------------------------------
* 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 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<TextSearchComplete>;
/**
* 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<TextSearchComplete>;
}
}

View file

@ -0,0 +1,89 @@
/*---------------------------------------------------------------------------------------------
* 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/16221
// todo@API Split between Inlay- and OverlayHints (InlayHint are for a position, OverlayHints for a non-empty range)
// todo@API add "mini-markdown" for links and styles
// (done) remove description
// (done) rename to InlayHint
// (done) add InlayHintKind with type, argument, etc
export namespace languages {
/**
* 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.
* @return A {@link Disposable} that unregisters this provider when being disposed.
*/
export function registerInlayHintsProvider(selector: DocumentSelector, provider: InlayHintsProvider): Disposable;
}
export enum InlayHintKind {
Other = 0,
Type = 1,
Parameter = 2,
}
/**
* Inlay hint information.
*/
export class InlayHint {
/**
* The text of the hint.
*/
// todo@API label?
text: string;
/**
* The position of this hint.
*/
position: Position;
/**
* The kind of this hint.
*/
kind?: InlayHintKind;
/**
* Whitespace before the hint.
*/
whitespaceBefore?: boolean;
/**
* Whitespace after the hint.
*/
whitespaceAfter?: boolean;
// todo@API make range first argument
constructor(text: string, position: Position, 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 have changed.
* @see {@link EventEmitter}
*/
//todo@API needs proper doc (like others)
onDidChangeInlayHints?: Event<void>;
/**
*
* @param model The document in which the command was invoked.
* @param range The range for which inlay hints should be computed.
* @param token A cancellation token.
* @return A list of inlay hints or a thenable that resolves to such.
*/
provideInlayHints(model: TextDocument, range: Range, token: CancellationToken): ProviderResult<InlayHint[]>;
}
}

View file

@ -0,0 +1,127 @@
/*---------------------------------------------------------------------------------------------
* 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 @alexdima
export namespace languages {
/**
* Registers an inline completion provider.
*/
export function registerInlineCompletionItemProvider(selector: DocumentSelector, provider: InlineCompletionItemProvider): Disposable;
}
export interface InlineCompletionItemProvider<T extends InlineCompletionItem = InlineCompletionItem> {
/**
* 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 asks for the next or previous inline completion.
* Use `context.triggerKind` to distinguish between these scenarios.
*/
provideInlineCompletionItems(document: TextDocument, position: Position, context: InlineCompletionContext, token: CancellationToken): ProviderResult<InlineCompletionList<T> | T[]>;
}
export interface InlineCompletionContext {
/**
* How the 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.
*
* The user must configure `"editor.suggest.preview": true` for this feature.
*/
readonly selectedCompletionInfo: SelectedCompletionInfo | undefined;
}
export interface SelectedCompletionInfo {
range: Range;
text: string;
}
/**
* How an {@link InlineCompletionItemProvider 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 class InlineCompletionList<T extends InlineCompletionItem = InlineCompletionItem> {
items: T[];
constructor(items: T[]);
}
export class InlineCompletionItem {
/**
* The text to replace the range with.
*
* The text the range refers to should be a prefix of this value and must be a subword (`AB` and `BEF` are subwords of `ABCDEF`, but `Ab` is not).
*/
text: string;
/**
* The range to replace.
* Must begin and end on the same line.
*
* Prefer replacements over insertions to avoid cache invalidation:
* Instead of reporting a completion that inserts an extension at the end of a word,
* the whole word should be replaced with the extended word.
*/
range?: Range;
/**
* An optional {@link Command} that is executed *after* inserting this completion.
*/
command?: Command;
constructor(text: string, range?: Range, command?: Command);
}
/**
* Be aware that this API will not ever be finalized.
*/
export namespace window {
export function getInlineCompletionItemController<T extends InlineCompletionItem>(provider: InlineCompletionItemProvider<T>): InlineCompletionController<T>;
}
/**
* Be aware that this API will not ever be finalized.
*/
export interface InlineCompletionController<T extends InlineCompletionItem> {
/**
* Is fired when an inline completion item is shown to the user.
*/
// eslint-disable-next-line vscode-dts-event-naming
readonly onDidShowCompletionItem: Event<InlineCompletionItemDidShowEvent<T>>;
}
/**
* Be aware that this API will not ever be finalized.
*/
export interface InlineCompletionItemDidShowEvent<T extends InlineCompletionItem> {
completionItem: T;
}
}

View file

@ -0,0 +1,52 @@
/*---------------------------------------------------------------------------------------------
* 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<NotebookCellExecutionStateChangeEvent>;
}
}

View file

@ -0,0 +1,40 @@
/*---------------------------------------------------------------------------------------------
* 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 namespace notebooks {
/**
* Create a document that is the concatenation of all notebook cells. By default all code-cells are included
* but a selector can be provided to narrow to down the set of cells.
*
* @param notebook
* @param selector
*/
// todo@API really needed? we didn't find a user here
export function createConcatTextDocument(notebook: NotebookDocument, selector?: DocumentSelector): NotebookConcatTextDocument;
}
export interface NotebookConcatTextDocument {
readonly uri: Uri;
readonly isClosed: boolean;
dispose(): void;
readonly onDidChange: Event<void>;
readonly version: number;
getText(): string;
getText(range: Range): string;
offsetAt(position: Position): number;
positionAt(offset: number): Position;
validateRange(range: Range): Range;
validatePosition(position: Position): Position;
locationAt(positionOrRange: Position | Range): Location;
positionAt(location: Location): Position;
contains(uri: Uri): boolean;
}
}

View file

@ -0,0 +1,65 @@
/*---------------------------------------------------------------------------------------------
* 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
interface NotebookDocumentBackup {
/**
* Unique identifier for the backup.
*
* This id is passed back to your extension in `openNotebook` when opening a notebook 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;
}
interface NotebookDocumentBackupContext {
readonly destination: Uri;
}
interface NotebookDocumentOpenContext {
readonly backupId?: string;
readonly untitledDocumentData?: Uint8Array;
}
// todo@API use openNotebookDOCUMENT to align with openCustomDocument etc?
// todo@API rename to NotebookDocumentContentProvider
export interface NotebookContentProvider {
readonly options?: NotebookDocumentContentOptions;
readonly onDidChangeNotebookContentOptions?: Event<NotebookDocumentContentOptions>;
/**
* Content providers should always use {@link FileSystemProvider file system providers} to
* resolve the raw content for `uri` as the resouce is not necessarily a file on disk.
*/
openNotebook(uri: Uri, openContext: NotebookDocumentOpenContext, token: CancellationToken): NotebookData | Thenable<NotebookData>;
// todo@API use NotebookData instead
saveNotebook(document: NotebookDocument, token: CancellationToken): Thenable<void>;
// todo@API use NotebookData instead
saveNotebookAs(targetResource: Uri, document: NotebookDocument, token: CancellationToken): Thenable<void>;
// todo@API use NotebookData instead
backupNotebook(document: NotebookDocument, context: NotebookDocumentBackupContext, token: CancellationToken): Thenable<NotebookDocumentBackup>;
}
export namespace workspace {
// TODO@api use NotebookDocumentFilter instead of just notebookType:string?
// TODO@API options duplicates the more powerful variant on NotebookContentProvider
export function registerNotebookContentProvider(notebookType: string, provider: NotebookContentProvider, options?: NotebookDocumentContentOptions): Disposable;
}
}

View file

@ -0,0 +1,28 @@
/*---------------------------------------------------------------------------------------------
* 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' {
// eslint-disable-next-line vscode-dts-region-comments
// @roblourens: new debug session option for simple UI 'managedByParent' (see https://github.com/microsoft/vscode/issues/128588)
/**
* Options for {@link debug.startDebugging starting a debug session}.
*/
export interface DebugSessionOptions {
debugUI?: {
/**
* When true, the debug toolbar will not be shown for this session, the window statusbar color will not be changed, and the debug viewlet will not be automatically revealed.
*/
simple?: 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;
}
}

View file

@ -0,0 +1,13 @@
/*---------------------------------------------------------------------------------------------
* 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 {
id: string;
}
}

View file

@ -0,0 +1,170 @@
/*---------------------------------------------------------------------------------------------
* 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
/**
* 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}.
*/
export interface NotebookEditor {
/**
* The document associated with this notebook editor.
*/
//todo@api rename to notebook?
readonly document: NotebookDocument;
/**
* The selections on 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: NotebookRange[];
/**
* The current visible ranges in the editor (vertically).
*/
readonly visibleRanges: NotebookRange[];
/**
* 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;
/**
* The column in which this editor shows.
*/
readonly viewColumn?: ViewColumn;
}
export interface NotebookDocumentMetadataChangeEvent {
/**
* The {@link NotebookDocument notebook document} for which the document metadata have changed.
*/
//todo@API rename to notebook?
readonly document: NotebookDocument;
}
export interface NotebookCellsChangeData {
readonly start: number;
// todo@API end? Use NotebookCellRange instead?
readonly deletedCount: number;
// todo@API removedCells, deletedCells?
readonly deletedItems: NotebookCell[];
// todo@API addedCells, insertedCells, newCells?
readonly items: NotebookCell[];
}
export interface NotebookCellsChangeEvent {
/**
* The {@link NotebookDocument notebook document} for which the cells have changed.
*/
//todo@API rename to notebook?
readonly document: NotebookDocument;
readonly changes: ReadonlyArray<NotebookCellsChangeData>;
}
export interface NotebookCellOutputsChangeEvent {
/**
* The {@link NotebookDocument notebook document} for which the cell outputs have changed.
*/
//todo@API remove? use cell.notebook instead?
readonly document: NotebookDocument;
// NotebookCellOutputsChangeEvent.cells vs NotebookCellMetadataChangeEvent.cell
readonly cells: NotebookCell[];
}
export interface NotebookCellMetadataChangeEvent {
/**
* The {@link NotebookDocument notebook document} for which the cell metadata have changed.
*/
//todo@API remove? use cell.notebook instead?
readonly document: NotebookDocument;
// NotebookCellOutputsChangeEvent.cells vs NotebookCellMetadataChangeEvent.cell
readonly cell: NotebookCell;
}
export interface NotebookEditorSelectionChangeEvent {
/**
* The {@link NotebookEditor notebook editor} for which the selections have changed.
*/
readonly notebookEditor: NotebookEditor;
readonly selections: ReadonlyArray<NotebookRange>
}
export interface NotebookEditorVisibleRangesChangeEvent {
/**
* The {@link NotebookEditor notebook editor} for which the visible ranges have changed.
*/
readonly notebookEditor: NotebookEditor;
readonly visibleRanges: ReadonlyArray<NotebookRange>;
}
export interface NotebookDocumentShowOptions {
viewColumn?: ViewColumn;
preserveFocus?: boolean;
preview?: boolean;
selections?: NotebookRange[];
}
export namespace notebooks {
export const onDidSaveNotebookDocument: Event<NotebookDocument>;
export const onDidChangeNotebookDocumentMetadata: Event<NotebookDocumentMetadataChangeEvent>;
export const onDidChangeNotebookCells: Event<NotebookCellsChangeEvent>;
// todo@API add onDidChangeNotebookCellOutputs
export const onDidChangeCellOutputs: Event<NotebookCellOutputsChangeEvent>;
// todo@API add onDidChangeNotebookCellMetadata
export const onDidChangeCellMetadata: Event<NotebookCellMetadataChangeEvent>;
}
export namespace window {
export const visibleNotebookEditors: NotebookEditor[];
export const onDidChangeVisibleNotebookEditors: Event<NotebookEditor[]>;
export const activeNotebookEditor: NotebookEditor | undefined;
export const onDidChangeActiveNotebookEditor: Event<NotebookEditor | undefined>;
export const onDidChangeNotebookEditorSelection: Event<NotebookEditorSelectionChangeEvent>;
export const onDidChangeNotebookEditorVisibleRanges: Event<NotebookEditorVisibleRangesChangeEvent>;
export function showNotebookDocument(uri: Uri, options?: NotebookDocumentShowOptions): Thenable<NotebookEditor>;
export function showNotebookDocument(document: NotebookDocument, options?: NotebookDocumentShowOptions): Thenable<NotebookEditor>;
}
}

View file

@ -0,0 +1,28 @@
/*---------------------------------------------------------------------------------------------
* 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 NotebookEditor {
setDecorations(decorationType: NotebookEditorDecorationType, range: NotebookRange): void;
}
export interface NotebookDecorationRenderOptions {
backgroundColor?: string | ThemeColor;
borderColor?: string | ThemeColor;
top?: ThemableDecorationAttachmentRenderOptions;
}
export interface NotebookEditorDecorationType {
readonly key: string;
dispose(): void;
}
export namespace notebooks {
export function createNotebookEditorDecorationType(options: NotebookDecorationRenderOptions): NotebookEditorDecorationType;
}
}

View file

@ -0,0 +1,53 @@
/*---------------------------------------------------------------------------------------------
* 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
// todo@API add NotebookEdit-type which handles all these cases?
// export class NotebookEdit {
// range: NotebookRange;
// newCells: NotebookCellData[];
// newMetadata?: NotebookDocumentMetadata;
// constructor(range: NotebookRange, newCells: NotebookCellData)
// }
// export class NotebookCellEdit {
// newMetadata?: NotebookCellMetadata;
// }
// export interface WorkspaceEdit {
// set(uri: Uri, edits: TextEdit[] | NotebookEdit[]): void
// }
export interface WorkspaceEdit {
// todo@API add NotebookEdit-type which handles all these cases?
replaceNotebookMetadata(uri: Uri, value: { [key: string]: any }): void;
replaceNotebookCells(uri: Uri, range: NotebookRange, cells: NotebookCellData[], metadata?: WorkspaceEditEntryMetadata): void;
replaceNotebookCellMetadata(uri: Uri, index: number, cellMetadata: { [key: string]: any }, metadata?: WorkspaceEditEntryMetadata): void;
}
export interface NotebookEditorEdit {
replaceMetadata(value: { [key: string]: any }): void;
replaceCells(start: number, end: number, cells: NotebookCellData[]): void;
replaceCellMetadata(index: number, metadata: { [key: string]: any }): void;
}
export interface NotebookEditor {
/**
* Perform an edit on the notebook associated with this notebook editor.
*
* The given callback-function is invoked with an {@link NotebookEditorEdit 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 NotebookEditorEdit edit-builder}.
* @return A promise that resolves with a value indicating if the edits could be applied.
*/
// @jrieken REMOVE maybe
edit(callback: (editBuilder: NotebookEditorEdit) => void): Thenable<boolean>;
}
}

View file

@ -0,0 +1,22 @@
/*---------------------------------------------------------------------------------------------
* 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 {
displayName: string;
filenamePattern: (GlobPattern | { include: GlobPattern; exclude: GlobPattern; })[];
exclusive?: boolean;
}
export namespace workspace {
// SPECIAL overload with NotebookRegistrationData
export function registerNotebookContentProvider(notebookType: string, provider: NotebookContentProvider, options?: NotebookDocumentContentOptions, registrationData?: NotebookRegistrationData): Disposable;
// SPECIAL overload with NotebookRegistrationData
export function registerNotebookSerializer(notebookType: string, serializer: NotebookSerializer, options?: NotebookDocumentContentOptions, registration?: NotebookRegistrationData): Disposable;
}
}

View file

@ -0,0 +1,72 @@
/*---------------------------------------------------------------------------------------------
* 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: 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 | string[]);
}
export interface NotebookController {
/**
* The human-readable label used to categorise controllers.
*/
kind?: string;
// 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<{ editor: NotebookEditor, 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<boolean>;
//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<void>, rendererScripts?: NotebookRendererScript[]): NotebookController;
}
}

View file

@ -0,0 +1,33 @@
/*---------------------------------------------------------------------------------------------
* 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;
}
}

View file

@ -0,0 +1,62 @@
/*---------------------------------------------------------------------------------------------
* 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
export enum PortAutoForwardAction {
Notify = 1,
OpenBrowser = 2,
OpenPreview = 3,
Silent = 4,
Ignore = 5,
OpenBrowserOnce = 6
}
export class PortAttributes {
/**
* The port number associated with this this set of attributes.
*/
port: number;
/**
* 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(port: number, autoForwardAction: PortAutoForwardAction);
}
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.
*/
providePortAttributes(port: number, pid: number | undefined, commandLine: string | undefined, token: CancellationToken): ProviderResult<PortAttributes>;
}
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.
*
* @param portSelector If registerPortAttributesProvider is called after you start your process then you may already
* know the range of ports or the pid of your process. All properties of a the portSelector must be true for your
* provider to get called.
* The `portRange` is start inclusive and end exclusive.
* @param provider The PortAttributesProvider
*/
export function registerPortAttributesProvider(portSelector: { pid?: number, portRange?: [number, number], commandMatcher?: RegExp }, provider: PortAttributesProvider): Disposable;
}
}

View file

@ -0,0 +1,16 @@
/*---------------------------------------------------------------------------------------------
* 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<T extends QuickPickItem> extends QuickInput {
/**
* An optional flag to sort the final results by index of first query match in label. Defaults to true.
*/
sortByLabel: boolean;
}
}

View file

@ -0,0 +1,256 @@
/*---------------------------------------------------------------------------------------------
* 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;
}
export class ResolvedAuthority {
readonly host: string;
readonly port: number;
readonly connectionToken: string | undefined;
constructor(host: string, port: number, connectionToken?: string);
}
export interface ResolvedOptions {
extensionHostEnv?: { [key: string]: string | null; };
isTrusted?: boolean;
}
export interface TunnelPrivacy {
themeIcon: string;
id: string;
label: string;
}
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<void>;
dispose(): void | Thenable<void>;
}
/**
* 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[];
}
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
}
export type ResolverResult = ResolvedAuthority & ResolvedOptions & TunnelInformation;
export class RemoteAuthorityResolverError extends Error {
static NotAvailable(message?: string, handled?: boolean): RemoteAuthorityResolverError;
static TemporarilyNotAvailable(message?: string): RemoteAuthorityResolverError;
constructor(message?: 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<ResolverResult>;
/**
* 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<Uri>;
/**
* 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<Tunnel> | undefined;
/**p
* Provides filtering for candidate ports.
*/
showCandidatePort?: (host: string, port: number, detail: string) => Thenable<boolean>;
/**
* Lets the resolver declare which tunnel factory features it supports.
* UNDER DISCUSSION! MAY CHANGE SOON.
*/
tunnelFeatures?: {
elevation: boolean;
/**
* @deprecated Use privacy instead
*/
public: boolean;
/**
* One of the the options must have the ID "private".
*/
privacyOptions: TunnelPrivacy[];
};
candidatePortSource?: CandidatePortSource;
}
/**
* More options to be used when getting an {@link AuthenticationSession} from an {@link AuthenticationProvider}.
*/
export interface AuthenticationGetSessionOptions {
/**
* 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.
*
* Defaults to false.
*/
forceNewSession?: boolean | { detail: string };
}
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 & { forceNewSession: true | { detail: string } }): Thenable<AuthenticationSession>;
export function hasSession(providerId: string, scopes: readonly string[]): Thenable<boolean>;
}
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<Tunnel>;
/**
* 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<TunnelDescription[]>;
/**
* Fired when the list of tunnels has changed.
*/
export const onDidChangeTunnels: Event<void>;
}
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 vscode-dts-literal-or-types
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 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;
}
}

View file

@ -0,0 +1,12 @@
/*---------------------------------------------------------------------------------------------
* 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 SourceControl {
actionButton?: Command;
}
}

View file

@ -0,0 +1,22 @@
/*---------------------------------------------------------------------------------------------
* 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<boolean>;
}
}

View file

@ -0,0 +1,60 @@
/*---------------------------------------------------------------------------------------------
* 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<SourceControlInputBoxValidation>;
}
}

100
src/vscode-dts/vscode.proposed.tabs.d.ts vendored Normal file
View file

@ -0,0 +1,100 @@
/*---------------------------------------------------------------------------------------------
* 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/15178
/**
* Represents a tab within the window
*/
export interface Tab {
/**
* The text displayed on the tab
*/
readonly label: string;
/**
* The index of the tab within the column
*/
readonly index: number;
/**
* The column which the tab belongs to
*/
readonly viewColumn: ViewColumn;
/**
* The resource represented by the tab if available.
* Note: Not all tabs have a resource associated with them.
*/
readonly resource: Uri | undefined;
/**
* The identifier of the view contained in the tab
* This is equivalent to `viewType` for custom editors and `notebookType` for notebooks.
* The built-in text editor has an id of 'default' for all configurations.
*/
readonly viewId: string | undefined;
/**
* All the resources and viewIds represented by a tab
* {@link Tab.resource resource} and {@link Tab.viewId viewId} will
* always be at index 0.
*/
readonly additionalResourcesAndViewIds: readonly {
readonly resource: Uri | undefined,
readonly viewId: string | undefined
}[];
/**
* Whether or not the tab is currently active
* Dictated by being the selected tab in the active group
*/
readonly isActive: boolean;
/**
* Moves a tab to the given index within the column.
* If the index is out of range, the tab will be moved to the end of the column.
* If the column is out of range, a new one will be created after the last existing column.
* @param index The index to move the tab to
* @param viewColumn The column to move the tab into
*/
move(index: number, viewColumn: ViewColumn): Thenable<void>;
/**
* Closes the tab. This makes the tab object invalid and the tab
* should no longer be used for further actions.
*/
close(): Thenable<void>;
}
export namespace window {
/**
* A list of all opened tabs
* Ordered from left to right
*/
export const tabs: readonly Tab[];
/**
* The currently active tab
* Undefined if no tabs are currently opened
*/
export const activeTab: Tab | undefined;
/**
* An {@link Event} which fires when the array of {@link window.tabs tabs}
* has changed.
*/
export const onDidChangeTabs: Event<readonly Tab[]>;
/**
* An {@link Event} which fires when the {@link window.activeTab activeTab}
* has changed.
*/
export const onDidChangeActiveTab: Event<Tab | undefined>;
}
}

View file

@ -0,0 +1,21 @@
/*---------------------------------------------------------------------------------------------
* 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;
/**
* Controls whether the terminal is closed after executing the task.
*/
close?: boolean;
}
}

View file

@ -0,0 +1,29 @@
/*---------------------------------------------------------------------------------------------
* 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
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<TerminalDataWriteEvent>;
}
}

View file

@ -0,0 +1,39 @@
/*---------------------------------------------------------------------------------------------
* 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<TerminalDimensionsChangeEvent>;
}
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;
}
}

View file

@ -0,0 +1,45 @@
/*---------------------------------------------------------------------------------------------
* 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/45407
export interface TerminalOptions {
location?: TerminalLocation | TerminalEditorLocationOptions | TerminalSplitLocationOptions;
}
export interface ExtensionTerminalOptions {
location?: TerminalLocation | TerminalEditorLocationOptions | TerminalSplitLocationOptions;
}
export enum TerminalLocation {
Panel = 1,
Editor = 2,
}
export interface TerminalEditorLocationOptions {
/**
* A view column in which the {@link Terminal terminal} should be shown in the editor area.
* Use {@link ViewColumn.Active active} to open in the active editor group, other values are
* adjusted to be `Min(column, columnCount + 1)`, the
* {@link ViewColumn.Active active}-column is not adjusted. 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;
}
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;
}
}

View file

@ -0,0 +1,30 @@
/*---------------------------------------------------------------------------------------------
* 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@API,@jrieken is this needed? This is also in vscode.d.ts...
// https://github.com/microsoft/vscode/issues/114898
export interface Pseudoterminal {
/**
* An event that when fired allows changing the name of the terminal.
*
* **Example:** Change the terminal name to "My new terminal".
* ```typescript
* const writeEmitter = new vscode.EventEmitter<string>();
* const changeNameEmitter = new vscode.EventEmitter<string>();
* 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<string>;
}
}

View file

@ -0,0 +1,198 @@
/*---------------------------------------------------------------------------------------------
* 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/123713
export interface TestRun {
/**
* Test coverage provider for this result. An extension can defer setting
* this until after a run is complete and coverage is available.
*/
coverageProvider?: TestCoverageProvider
// ...
}
/**
* Provides information about test coverage for a test result.
* Methods on the provider will not be called until the test run is complete
*/
export interface TestCoverageProvider<T extends FileCoverage = FileCoverage> {
/**
* Returns coverage information for all files involved in the test run.
* @param token A cancellation token.
* @return Coverage metadata for all files involved in the test.
*/
provideFileCoverage(token: CancellationToken): ProviderResult<T[]>;
/**
* Give a FileCoverage to fill in more data, namely {@link FileCoverage.detailedCoverage}.
* The editor will only resolve a FileCoverage once, and onyl if detailedCoverage
* is undefined.
*
* @param coverage A coverage object obtained from {@link provideFileCoverage}
* @param token A cancellation token.
* @return The resolved file coverage, or a thenable that resolves to one. It
* is OK to return the given `coverage`. When no result is returned, the
* given `coverage` will be used.
*/
resolveFileCoverage?(coverage: T, token: CancellationToken): ProviderResult<T>;
}
/**
* A class that contains information about a covered resource. A count can
* be give for lines, branches, and functions in a file.
*/
export class CoveredCount {
/**
* Number of items covered in the file.
*/
covered: number;
/**
* Total number of covered items in the file.
*/
total: number;
/**
* @param covered Value for {@link CovereredCount.covered}
* @param total Value for {@link CovereredCount.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: CoveredCount;
/**
* Branch coverage information.
*/
branchCoverage?: CoveredCount;
/**
* Function coverage information.
*/
functionCoverage?: CoveredCount;
/**
* Detailed, per-statement coverage. If this is undefined, the editor will
* call {@link TestCoverageProvider.resolveFileCoverage} when necessary.
*/
detailedCoverage?: DetailedCoverage[];
/**
* 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 DetailedCoverage[]): 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 functionCoverage Function coverage information
*/
constructor(
uri: Uri,
statementCoverage: CoveredCount,
branchCoverage?: CoveredCount,
functionCoverage?: CoveredCount,
);
}
/**
* Contains coverage information for a single statement or line.
*/
export class StatementCoverage {
/**
* The number of times this statement was executed. If zero, the
* statement will be marked as un-covered.
*/
executionCount: number;
/**
* 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 executionCount The number of times this statement was
* executed. If zero, 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(executionCount: number, 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. If zero, the
* branch will be marked as un-covered.
*/
executionCount: number;
/**
* Branch location.
*/
location?: Position | Range;
/**
* @param executionCount The number of times this branch was executed.
* @param location The branch position.
*/
constructor(executionCount: number, location?: Position | Range);
}
/**
* Contains coverage information for a function or method.
*/
export class FunctionCoverage {
/**
* The number of times this function was executed. If zero, the
* function will be marked as un-covered.
*/
executionCount: number;
/**
* Function location.
*/
location: Position | Range;
/**
* @param executionCount The number of times this function was executed.
* @param location The function position.
*/
constructor(executionCount: number, location: Position | Range);
}
export type DetailedCoverage = StatementCoverage | FunctionCoverage;
}

View file

@ -0,0 +1,202 @@
/*---------------------------------------------------------------------------------------------
* 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<void>;
/**
* 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<TestRunResult>;
/**
* Event that fires when the {@link testResults} array is updated.
*/
export const onDidChangeTestResults: Event<void>;
}
export interface TestObserver {
/**
* List of tests returned by test provider for files in the workspace.
*/
readonly tests: ReadonlyArray<TestItem>;
/**
* 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<TestsChangeEvent>;
/**
* 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<TestItem>;
/**
* List of existing tests that have updated.
*/
readonly updated: ReadonlyArray<TestItem>;
/**
* List of existing tests that have been removed.
*/
readonly removed: ReadonlyArray<TestItem>;
}
/**
* A test item is an item shown in the "test explorer" view. It encompasses
* both a suite and a test, since they have almost or identical capabilities.
*/
export interface TestItem {
/**
* Marks the test as outdated. This can happen as a result of file changes,
* for example. In "auto run" mode, tests that are outdated will be
* automatically rerun after a short delay. Invoking this on a
* test with children will mark the entire subtree as outdated.
*
* Extensions should generally not override this method.
*/
// todo@api still unsure about this
invalidateResults(): void;
}
/**
* 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<Readonly<TestResultSnapshot>>;
}
/**
* 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<TestSnapshotTaskState>;
/**
* Optional list of nested tests for this item.
*/
readonly children: Readonly<TestResultSnapshot>[];
}
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<TestMessage>;
}
/**
* 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
}
}

View file

@ -0,0 +1,18 @@
/*---------------------------------------------------------------------------------------------
* 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/102091
export interface TextDocument {
/**
* The {@link NotebookDocument notebook} that contains this document as a notebook cell or `undefined` when
* the document is not contained by a notebook (this should be the more frequent case).
*/
notebook: NotebookDocument | undefined;
}
}

View file

@ -0,0 +1,275 @@
/*---------------------------------------------------------------------------------------------
* 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;
}
/**
* 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 severiry 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<TextSearchResult>, token: CancellationToken): ProviderResult<TextSearchComplete>;
}
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;
}
}

View file

@ -0,0 +1,163 @@
/*---------------------------------------------------------------------------------------------
* 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.
*/
detail?: string;
/**
* 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<TimelineChangeEvent | undefined>;
/**
* 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<Timeline>;
}
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;
}
}

View file

@ -0,0 +1,26 @@
/*---------------------------------------------------------------------------------------------
* 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 = 4
}
export interface TokenInformation {
type: StandardTokenType;
range: Range;
}
export namespace languages {
/** @deprecated */
export function getTokenInformationAtPosition(document: TextDocument, position: Position): Thenable<TokenInformation>;
}
}

View file

@ -0,0 +1,71 @@
/*---------------------------------------------------------------------------------------------
* 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/32592
/**
* A data provider that provides tree data
*/
export interface TreeDataProvider<T> {
/**
* 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`.
*/
onDidChangeTreeData2?: Event<T | T[] | undefined | null | void>;
}
export interface TreeViewOptions<T> {
/**
* An optional interface to implement drag and drop in the tree view.
*/
dragAndDropController?: DragAndDropController<T>;
}
export interface TreeDataTransferItem {
asString(): Thenable<string>;
}
export interface TreeDataTransfer {
/**
* A map containing a mapping of the mime type of the corresponding data.
* The type for tree elements is text/treeitem.
* For example, you can reconstruct the your tree elements:
* ```ts
* JSON.parse(await (items.get('text/treeitem')!.asString()))
* ```
*/
items: { get: (mimeType: string) => TreeDataTransferItem | undefined };
}
export interface DragAndDropController<T> extends Disposable {
readonly supportedTypes: string[];
/**
* todo@API maybe
*
* When the user drops an item from this DragAndDropController on **another tree item** in **the same tree**,
* `onWillDrop` will be called with the dropped tree item. This is the DragAndDropController's opportunity to
* package the data from the dropped tree item into whatever format they want the target tree item to receive.
*
* The returned `TreeDataTransfer` will be merged with the original`TreeDataTransfer` for the operation.
*
* Note for implementation later: This means that the `text/treeItem` mime type will go away.
*
* @param source
*/
// onWillDrop?(source: T): Thenable<TreeDataTransfer>;
/**
* Extensions should fire `TreeDataProvider.onDidChangeTreeData` for any elements that need to be refreshed.
*
* @param source
* @param target
*/
onDrop(source: TreeDataTransfer, target: T): Thenable<void>;
}
}

View file

@ -0,0 +1,13 @@
/*---------------------------------------------------------------------------------------------
* 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<T> extends Disposable {
reveal(element: T | undefined, options?: { select?: boolean, focus?: boolean, expand?: boolean | number; }): Thenable<void>;
}
}

View file

@ -0,0 +1,30 @@
/*---------------------------------------------------------------------------------------------
* 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<boolean | undefined>;
}
}