2019-03-26 19:01:25 +01:00
|
|
|
// tslint:disable no-any
|
|
|
|
|
2019-05-02 15:38:43 +02:00
|
|
|
import { ITerminalService } from "vs/workbench/contrib/terminal/common/terminal";
|
|
|
|
|
2019-02-27 22:36:39 +01:00
|
|
|
export interface EvalHelper { }
|
2019-02-26 19:12:42 +01:00
|
|
|
interface ActiveEvalEmitter {
|
|
|
|
removeAllListeners(event?: string): void;
|
|
|
|
emit(event: string, ...args: any[]): void;
|
|
|
|
on(event: string, cb: (...args: any[]) => void): void;
|
|
|
|
}
|
2019-02-27 16:03:44 +01:00
|
|
|
interface IDisposable {
|
2019-02-26 19:12:42 +01:00
|
|
|
dispose(): void;
|
|
|
|
}
|
2019-02-27 16:03:44 +01:00
|
|
|
interface Disposer extends IDisposable {
|
|
|
|
onDidDispose: (cb: () => void) => void;
|
|
|
|
}
|
|
|
|
interface Event<T> {
|
|
|
|
(listener: (e: T) => any, thisArgs?: any, disposables?: IDisposable[]): IDisposable;
|
|
|
|
}
|
|
|
|
interface IAction extends IDisposable {
|
|
|
|
id: string;
|
|
|
|
label: string;
|
|
|
|
tooltip: string;
|
|
|
|
class: string | undefined;
|
|
|
|
enabled: boolean;
|
|
|
|
checked: boolean;
|
|
|
|
radio: boolean;
|
|
|
|
run(event?: any): Promise<any>;
|
|
|
|
}
|
|
|
|
interface IStatusbarEntry {
|
|
|
|
readonly text: string;
|
|
|
|
readonly tooltip?: string;
|
|
|
|
readonly color?: string;
|
|
|
|
readonly command?: string;
|
|
|
|
readonly arguments?: any[];
|
|
|
|
readonly showBeak?: boolean;
|
|
|
|
}
|
|
|
|
interface IStatusbarService {
|
2019-02-27 22:36:39 +01:00
|
|
|
addEntry(entry: IStatusbarEntry, alignment: ide.StatusbarAlignment, priority?: number): IDisposable;
|
2019-02-27 16:03:44 +01:00
|
|
|
setStatusMessage(message: string, autoDisposeAfter?: number, delayBy?: number): IDisposable;
|
|
|
|
}
|
|
|
|
type NotificationMessage = string | Error;
|
|
|
|
interface INotificationProperties {
|
|
|
|
sticky?: boolean;
|
|
|
|
silent?: boolean;
|
|
|
|
}
|
|
|
|
interface INotification extends INotificationProperties {
|
2019-02-27 22:36:39 +01:00
|
|
|
severity: ide.Severity;
|
2019-02-27 16:03:44 +01:00
|
|
|
message: NotificationMessage;
|
|
|
|
source?: string;
|
|
|
|
actions?: INotificationActions;
|
|
|
|
}
|
|
|
|
interface INotificationActions {
|
|
|
|
primary?: IAction[];
|
|
|
|
secondary?: IAction[];
|
|
|
|
}
|
|
|
|
|
|
|
|
interface INotificationProgress {
|
|
|
|
infinite(): void;
|
|
|
|
total(value: number): void;
|
|
|
|
worked(value: number): void;
|
|
|
|
done(): void;
|
|
|
|
}
|
|
|
|
|
2019-02-27 22:36:39 +01:00
|
|
|
interface INotificationHandle {
|
2019-02-27 16:03:44 +01:00
|
|
|
readonly onDidClose: Event<void>;
|
|
|
|
readonly progress: INotificationProgress;
|
2019-02-27 22:36:39 +01:00
|
|
|
updateSeverity(severity: ide.Severity): void;
|
2019-02-27 16:03:44 +01:00
|
|
|
updateMessage(message: NotificationMessage): void;
|
|
|
|
updateActions(actions?: INotificationActions): void;
|
|
|
|
close(): void;
|
|
|
|
}
|
|
|
|
|
2019-02-27 22:36:39 +01:00
|
|
|
interface IPromptChoice {
|
2019-02-27 16:03:44 +01:00
|
|
|
label: string;
|
|
|
|
isSecondary?: boolean;
|
|
|
|
keepOpen?: boolean;
|
|
|
|
run: () => void;
|
|
|
|
}
|
|
|
|
|
2019-02-27 22:36:39 +01:00
|
|
|
interface IPromptOptions extends INotificationProperties {
|
2019-02-27 16:03:44 +01:00
|
|
|
onCancel?: () => void;
|
|
|
|
}
|
|
|
|
|
2019-02-27 22:36:39 +01:00
|
|
|
interface INotificationService {
|
2019-02-27 16:03:44 +01:00
|
|
|
notify(notification: INotification): INotificationHandle;
|
|
|
|
info(message: NotificationMessage | NotificationMessage[]): void;
|
|
|
|
warn(message: NotificationMessage | NotificationMessage[]): void;
|
|
|
|
error(message: NotificationMessage | NotificationMessage[]): void;
|
2019-02-27 22:36:39 +01:00
|
|
|
prompt(severity: ide.Severity, message: string, choices: IPromptChoice[], options?: IPromptOptions): INotificationHandle;
|
|
|
|
}
|
|
|
|
|
|
|
|
interface IBaseCommandAction {
|
|
|
|
id: string;
|
|
|
|
title: string;
|
|
|
|
category?: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
interface ICommandAction extends IBaseCommandAction {
|
|
|
|
// iconLocation?: { dark: URI; light?: URI; };
|
|
|
|
// precondition?: ContextKeyExpr;
|
|
|
|
// toggled?: ContextKeyExpr;
|
|
|
|
}
|
|
|
|
|
|
|
|
interface ISerializableCommandAction extends IBaseCommandAction {
|
|
|
|
// iconLocation?: { dark: UriComponents; light?: UriComponents; };
|
|
|
|
}
|
|
|
|
|
|
|
|
interface IMenuItem {
|
|
|
|
command: ICommandAction;
|
|
|
|
alt?: ICommandAction;
|
|
|
|
// when?: ContextKeyExpr;
|
2019-03-26 19:01:25 +01:00
|
|
|
group?: "navigation" | string;
|
2019-02-27 22:36:39 +01:00
|
|
|
order?: number;
|
|
|
|
}
|
|
|
|
|
|
|
|
interface IMenuRegistry {
|
|
|
|
appendMenuItem(menu: ide.MenuId, item: IMenuItem): IDisposable;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface ICommandHandler {
|
|
|
|
(accessor: any, ...args: any[]): void;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface ICommand {
|
|
|
|
id: string;
|
|
|
|
handler: ICommandHandler;
|
|
|
|
description?: ICommandHandlerDescription | null;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface ICommandHandlerDescription {
|
|
|
|
description: string;
|
|
|
|
args: { name: string; description?: string; }[];
|
|
|
|
returns?: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
interface ICommandRegistry {
|
|
|
|
registerCommand(command: ICommand): IDisposable;
|
2019-02-27 16:03:44 +01:00
|
|
|
}
|
|
|
|
|
2019-04-09 18:24:53 +02:00
|
|
|
interface IStorageService {
|
|
|
|
save(): Promise<void>;
|
|
|
|
}
|
|
|
|
|
2019-02-27 16:03:44 +01:00
|
|
|
declare namespace ide {
|
2019-03-26 19:01:25 +01:00
|
|
|
export const client: {};
|
2019-02-27 16:03:44 +01:00
|
|
|
|
|
|
|
export const workbench: {
|
|
|
|
readonly statusbarService: IStatusbarService;
|
|
|
|
readonly notificationService: INotificationService;
|
2019-04-09 18:24:53 +02:00
|
|
|
readonly storageService: IStorageService;
|
2019-02-27 22:36:39 +01:00
|
|
|
readonly menuRegistry: IMenuRegistry;
|
|
|
|
readonly commandRegistry: ICommandRegistry;
|
2019-05-02 15:38:43 +02:00
|
|
|
readonly terminalService: ITerminalService;
|
2019-03-12 22:43:53 +01:00
|
|
|
|
|
|
|
onFileCreate(cb: (path: string) => void): void;
|
|
|
|
onFileMove(cb: (path: string, target: string) => void): void;
|
|
|
|
onFileDelete(cb: (path: string) => void): void;
|
|
|
|
onFileSaved(cb: (path: string) => void): void;
|
|
|
|
onFileCopy(cb: (path: string, target: string) => void): void;
|
|
|
|
|
|
|
|
onModelAdded(cb: (path: string, languageId: string) => void): void;
|
|
|
|
onModelRemoved(cb: (path: string, languageId: string) => void): void;
|
|
|
|
onModelLanguageChange(cb: (path: string, languageId: string, oldLanguageId: string) => void): void;
|
|
|
|
|
|
|
|
onTerminalAdded(cb: () => void): void;
|
|
|
|
onTerminalRemoved(cb: () => void): void;
|
2019-02-26 19:12:42 +01:00
|
|
|
};
|
|
|
|
|
2019-02-27 16:03:44 +01:00
|
|
|
export enum Severity {
|
|
|
|
Ignore = 0,
|
|
|
|
Info = 1,
|
|
|
|
Warning = 2,
|
2019-03-26 19:01:25 +01:00
|
|
|
Error = 3,
|
|
|
|
}
|
2019-02-26 19:12:42 +01:00
|
|
|
|
2019-02-27 16:03:44 +01:00
|
|
|
export enum StatusbarAlignment {
|
|
|
|
LEFT = 0,
|
|
|
|
RIGHT = 1,
|
|
|
|
}
|
2019-02-27 22:36:39 +01:00
|
|
|
|
|
|
|
export enum MenuId {
|
|
|
|
CommandPalette,
|
|
|
|
DebugBreakpointsContext,
|
|
|
|
DebugCallStackContext,
|
|
|
|
DebugConsoleContext,
|
|
|
|
DebugVariablesContext,
|
|
|
|
DebugWatchContext,
|
|
|
|
EditorContext,
|
|
|
|
EditorTitle,
|
|
|
|
EditorTitleContext,
|
|
|
|
EmptyEditorGroupContext,
|
|
|
|
ExplorerContext,
|
|
|
|
MenubarAppearanceMenu,
|
|
|
|
MenubarDebugMenu,
|
|
|
|
MenubarEditMenu,
|
|
|
|
MenubarFileMenu,
|
|
|
|
MenubarGoMenu,
|
|
|
|
MenubarHelpMenu,
|
|
|
|
MenubarLayoutMenu,
|
|
|
|
MenubarNewBreakpointMenu,
|
|
|
|
MenubarPreferencesMenu,
|
|
|
|
MenubarRecentMenu,
|
|
|
|
MenubarSelectionMenu,
|
|
|
|
MenubarSwitchEditorMenu,
|
|
|
|
MenubarSwitchGroupMenu,
|
|
|
|
MenubarTerminalMenu,
|
|
|
|
MenubarViewMenu,
|
|
|
|
OpenEditorsContext,
|
|
|
|
ProblemsPanelContext,
|
|
|
|
SCMChangeContext,
|
|
|
|
SCMResourceContext,
|
|
|
|
SCMResourceGroupContext,
|
|
|
|
SCMSourceControl,
|
|
|
|
SCMTitle,
|
|
|
|
SearchContext,
|
|
|
|
TouchBarContext,
|
|
|
|
ViewItemContext,
|
|
|
|
ViewTitle,
|
|
|
|
}
|
2019-02-27 16:03:44 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
declare global {
|
|
|
|
interface Window {
|
|
|
|
ide?: typeof ide;
|
2019-03-26 19:01:25 +01:00
|
|
|
|
2019-02-27 16:38:45 +01:00
|
|
|
addEventListener(event: "ide-ready", callback: (ide: CustomEvent & { readonly ide: typeof ide }) => void): void;
|
2019-02-27 16:03:44 +01:00
|
|
|
}
|
|
|
|
}
|