2019-07-17 23:57:26 +07:00
|
|
|
import * as vscode from "vscode";
|
|
|
|
|
2019-09-04 05:55:58 +07:00
|
|
|
// Only export the subset of VS Code we have implemented.
|
|
|
|
export interface VSCodeApi {
|
|
|
|
EventEmitter: typeof vscode.EventEmitter;
|
|
|
|
FileSystemError: typeof vscode.FileSystemError;
|
|
|
|
FileType: typeof vscode.FileType;
|
|
|
|
StatusBarAlignment: typeof vscode.StatusBarAlignment;
|
|
|
|
ThemeColor: typeof vscode.ThemeColor;
|
|
|
|
TreeItemCollapsibleState: typeof vscode.TreeItemCollapsibleState;
|
|
|
|
Uri: typeof vscode.Uri;
|
|
|
|
commands: {
|
|
|
|
executeCommand: typeof vscode.commands.executeCommand;
|
|
|
|
registerCommand: typeof vscode.commands.registerCommand;
|
|
|
|
};
|
|
|
|
window: {
|
|
|
|
createStatusBarItem: typeof vscode.window.createStatusBarItem;
|
|
|
|
registerTreeDataProvider: typeof vscode.window.registerTreeDataProvider;
|
|
|
|
showErrorMessage: typeof vscode.window.showErrorMessage;
|
|
|
|
};
|
|
|
|
workspace: {
|
|
|
|
registerFileSystemProvider: typeof vscode.workspace.registerFileSystemProvider;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface CoderApi {
|
|
|
|
registerView: (viewId: string, viewName: string, containerId: string, containerName: string, icon: string) => void;
|
|
|
|
}
|
2019-07-17 23:57:26 +07:00
|
|
|
|
|
|
|
export interface IdeReadyEvent extends CustomEvent<void> {
|
2019-09-04 05:55:58 +07:00
|
|
|
readonly vscode: VSCodeApi;
|
|
|
|
readonly ide: CoderApi;
|
2019-07-17 23:57:26 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
declare global {
|
|
|
|
interface Window {
|
|
|
|
/**
|
|
|
|
* Full VS Code extension API.
|
|
|
|
*/
|
2019-09-04 05:55:58 +07:00
|
|
|
vscode?: VSCodeApi;
|
2019-07-17 23:57:26 +07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Coder API.
|
|
|
|
*/
|
2019-09-04 05:55:58 +07:00
|
|
|
ide?: CoderApi;
|
2019-07-17 23:57:26 +07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Listen for when the IDE API has been set and is ready to use.
|
|
|
|
*/
|
|
|
|
addEventListener(event: "ide-ready", callback: (event: IdeReadyEvent) => void): void;
|
|
|
|
}
|
|
|
|
}
|