Skip to content

Commit

Permalink
Update vscode.proposed.d.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
renkun-ken committed Oct 12, 2020
1 parent 64ede10 commit 36d21fe
Showing 1 changed file with 94 additions and 80 deletions.
174 changes: 94 additions & 80 deletions vscode.proposed.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,30 +16,6 @@

declare module 'vscode' {

//#region https://github.com/microsoft/vscode/issues/106410

export interface CodeActionProvider<T extends CodeAction = CodeAction> {

/**
* Given a code action fill in its [`edit`](#CodeAction.edit)-property, changes to
* all other properties, like title, are ignored. A code action that has an edit
* will not be resolved.
*
* *Note* that a code action provider that returns commands, not code actions, cannot successfully
* implement this function. Returning commands is deprecated and instead code actions should be
* returned.
*
* @param codeAction A code action.
* @param token A cancellation token.
* @return The resolved code action or a thenable that resolve to such. It is OK to return the given
* `item`. When no result is returned, the given `item` will be used.
*/
resolveCodeAction?(codeAction: T, token: CancellationToken): ProviderResult<T>;
}

//#endregion


// #region auth provider: https://github.com/microsoft/vscode/issues/88309

/**
Expand Down Expand Up @@ -167,6 +143,31 @@ declare module 'vscode' {
* provider
*/
export function logout(providerId: string, sessionId: string): Thenable<void>;

/**
* Retrieve a password that was stored with key. Returns undefined if there
* is no password matching that key.
* @param key The key the password was stored under.
*/
export function getPassword(key: string): Thenable<string | undefined>;

/**
* Store a password under a given key.
* @param key The key to store the password under
* @param value The password
*/
export function setPassword(key: string, value: string): Thenable<void>;

/**
* Remove a password from storage.
* @param key The key the password was stored under.
*/
export function deletePassword(key: string): Thenable<void>;

/**
* Fires when a password is set or deleted.
*/
export const onDidChangePassword: Event<void>;
}

//#endregion
Expand Down Expand Up @@ -741,74 +742,65 @@ declare module 'vscode' {

//#region file-decorations: https://github.com/microsoft/vscode/issues/54938

// TODO@jrieken FileDecoration, FileDecorationProvider etc.
// TODO@jrieken Add selector notion to limit decorations to a view.
// TODO@jrieken Rename `Decoration.letter` to `short` so that it could be used for coverage et al.

export class Decoration {
export class FileDecoration {

/**
* A letter that represents this decoration.
* A very short string that represents this decoration.
*/
letter?: string;
badge?: string;

/**
* The human-readable title for this decoration.
* A human-readable tooltip for this decoration.
*/
title?: string;
tooltip?: string;

/**
* The color of this decoration.
*/
color?: ThemeColor;

/**
* The priority of this decoration.
*/
priority?: number;

/**
* A flag expressing that this decoration should be
* propagted to its parents.
* propagated to its parents.
*/
bubble?: boolean;
propagate?: boolean;

/**
* Creates a new decoration.
*
* @param letter A letter that represents the decoration.
* @param title The title of the decoration.
* @param badge A letter that represents the decoration.
* @param tooltip The tooltip of the decoration.
* @param color The color of the decoration.
*/
constructor(letter?: string, title?: string, color?: ThemeColor);
constructor(badge?: string, tooltip?: string, color?: ThemeColor);
}

/**
* The decoration provider interfaces defines the contract between extensions and
* file decorations.
*/
export interface DecorationProvider {
export interface FileDecorationProvider {

/**
* An event to signal decorations for one or many files have changed.
*
* @see [EventEmitter](#EventEmitter
*/
onDidChangeDecorations: Event<undefined | Uri | Uri[]>;
onDidChange: Event<undefined | Uri | Uri[]>;

/**
* Provide decorations for a given uri.
*
*
* @param uri The uri of the file to provide a decoration for.
* @param token A cancellation token.
* @returns A decoration or a thenable that resolves to such.
*/
provideDecoration(uri: Uri, token: CancellationToken): ProviderResult<Decoration>;
provideFileDecoration(uri: Uri, token: CancellationToken): ProviderResult<FileDecoration>;
}

export namespace window {
export function registerDecorationProvider(provider: DecorationProvider): Disposable;
export function registerDecorationProvider(provider: FileDecorationProvider): Disposable;
}

//#endregion
Expand Down Expand Up @@ -1259,6 +1251,27 @@ declare module 'vscode' {

export type CellOutput = CellStreamOutput | CellErrorOutput | CellDisplayOutput;

export class NotebookCellOutputItem {

readonly mime: string;
readonly value: unknown;
readonly metadata?: Record<string, string | number | boolean>;

constructor(mime: string, value: unknown, metadata?: Record<string, string | number | boolean>);
}

//TODO@jrieken add id?
export class NotebookCellOutput {

readonly outputs: NotebookCellOutputItem[];
readonly metadata?: Record<string, string | number | boolean>;

constructor(outputs: NotebookCellOutputItem[], metadata?: Record<string, string | number | boolean>);

//TODO@jrieken HACK to workaround dependency issues...
toJSON(): any;
}

export enum NotebookCellRunState {
Running = 1,
Idle = 2,
Expand Down Expand Up @@ -1440,14 +1453,14 @@ declare module 'vscode' {
export interface WorkspaceEdit {
replaceNotebookMetadata(uri: Uri, value: NotebookDocumentMetadata): void;
replaceNotebookCells(uri: Uri, start: number, end: number, cells: NotebookCellData[], metadata?: WorkspaceEditEntryMetadata): void;
replaceNotebookCellOutput(uri: Uri, index: number, outputs: CellOutput[], metadata?: WorkspaceEditEntryMetadata): void;
replaceNotebookCellOutput(uri: Uri, index: number, outputs: (NotebookCellOutput | CellOutput)[], metadata?: WorkspaceEditEntryMetadata): void;
replaceNotebookCellMetadata(uri: Uri, index: number, cellMetadata: NotebookCellMetadata, metadata?: WorkspaceEditEntryMetadata): void;
}

export interface NotebookEditorEdit {
replaceMetadata(value: NotebookDocumentMetadata): void;
replaceCells(start: number, end: number, cells: NotebookCellData[]): void;
replaceCellOutput(index: number, outputs: CellOutput[]): void;
replaceCellOutput(index: number, outputs: (NotebookCellOutput | CellOutput)[]): void;
replaceCellMetadata(index: number, metadata: NotebookCellMetadata): void;
}

Expand Down Expand Up @@ -1497,16 +1510,6 @@ declare module 'vscode' {
*/
readonly viewColumn?: ViewColumn;

/**
* Whether the panel is active (focused by the user).
*/
readonly active: boolean;

/**
* Whether the panel is visible.
*/
readonly visible: boolean;

/**
* Fired when the panel is disposed.
*/
Expand Down Expand Up @@ -1685,7 +1688,7 @@ declare module 'vscode' {
/**
* Unique identifier for the backup.
*
* This id is passed back to your extension in `openCustomDocument` when opening a notebook editor from a backup.
* This id is passed back to your extension in `openNotebook` when opening a notebook editor from a backup.
*/
readonly id: string;

Expand Down Expand Up @@ -1739,6 +1742,10 @@ declare module 'vscode' {
}

export interface NotebookContentProvider {
readonly options?: NotebookDocumentContentOptions;
readonly onDidChangeNotebookContentOptions?: Event<NotebookDocumentContentOptions>;
readonly onDidChangeNotebook: Event<NotebookDocumentContentChangeEvent | NotebookDocumentEditEvent>;

/**
* Content providers should always use [file system providers](#FileSystemProvider) to
* resolve the raw content for `uri` as the resouce is not necessarily a file on disk.
Expand All @@ -1747,7 +1754,6 @@ declare module 'vscode' {
resolveNotebook(document: NotebookDocument, webview: NotebookCommunication): Promise<void>;
saveNotebook(document: NotebookDocument, cancellation: CancellationToken): Promise<void>;
saveNotebookAs(targetResource: Uri, document: NotebookDocument, cancellation: CancellationToken): Promise<void>;
readonly onDidChangeNotebook: Event<NotebookDocumentContentChangeEvent | NotebookDocumentEditEvent>;
backupNotebook(document: NotebookDocument, context: NotebookDocumentBackupContext, cancellation: CancellationToken): Promise<NotebookDocumentBackup>;
}

Expand Down Expand Up @@ -1840,6 +1846,7 @@ declare module 'vscode' {
): Disposable;

export function createNotebookEditorDecorationType(options: NotebookDecorationRenderOptions): NotebookEditorDecorationType;
export function openNotebookDocument(uri: Uri, viewType?: string): Promise<NotebookDocument>;
export const onDidOpenNotebookDocument: Event<NotebookDocument>;
export const onDidCloseNotebookDocument: Event<NotebookDocument>;
export const onDidSaveNotebookDocument: Event<NotebookDocument>;
Expand All @@ -1848,14 +1855,6 @@ declare module 'vscode' {
* All currently known notebook documents.
*/
export const notebookDocuments: ReadonlyArray<NotebookDocument>;

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 const onDidChangeNotebookDocumentMetadata: Event<NotebookDocumentMetadataChangeEvent>;
export const onDidChangeNotebookCells: Event<NotebookCellsChangeEvent>;
export const onDidChangeCellOutputs: Event<NotebookCellOutputsChangeEvent>;
Expand Down Expand Up @@ -1884,6 +1883,15 @@ declare module 'vscode' {
export function createCellStatusBarItem(cell: NotebookCell, alignment?: NotebookCellStatusBarAlignment, priority?: number): NotebookCellStatusBarItem;
}

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>;
}

//#endregion

//#region https://github.com/microsoft/vscode/issues/39441
Expand Down Expand Up @@ -2129,7 +2137,7 @@ declare module 'vscode' {
}
//#endregion

//#region
//#region https://github.com/microsoft/vscode/issues/91697

export interface FileSystem {
/**
Expand All @@ -2151,24 +2159,30 @@ declare module 'vscode' {

//#endregion

//#region https://github.com/microsoft/vscode/issues/105667
//#region https://github.com/microsoft/vscode/issues/103120 @alexr00
export class ThemeIcon2 extends ThemeIcon {

/**
* The id of the icon. The available icons are listed in https://microsoft.github.io/vscode-codicons/dist/codicon.html.
*/
public readonly id: string;

export interface TreeView<T> {
/**
* An optional human-readable description that will be rendered in the title of the view.
* Setting the title description to null, undefined, or empty string will remove the title description from the view.
* Creates a reference to a theme icon.
* @param id id of the icon. The available icons are listed in https://microsoft.github.io/vscode-codicons/dist/codicon.html.
* @param color optional `ThemeColor` for the icon.
*/
description?: string | undefined;
constructor(id: string, color?: ThemeColor);
}
//#endregion

//#region https://github.com/microsoft/vscode/issues/103120 @alexr00
export class ThemeIcon2 extends ThemeIcon {
//#region https://github.com/microsoft/vscode/issues/102665 Comment API @rebornix
export interface CommentThread {
/**
* Returns a new `ThemeIcon` that will use the specified `ThemeColor`
* @param color The `ThemeColor` to use for the icon.
* Whether the thread supports reply.
* Defaults to true.
*/
with(color: ThemeColor): ThemeIcon2;
canReply: boolean;
}
//#endregion
}

0 comments on commit 36d21fe

Please sign in to comment.