From 3ef777a14c47f4219797640643118ca761c61631 Mon Sep 17 00:00:00 2001 From: Florens Verschelde Date: Sun, 17 Apr 2022 15:11:52 +0200 Subject: [PATCH] sdk: add experimental vm.editor.selectFile --- sdk/src/vm.ts | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/sdk/src/vm.ts b/sdk/src/vm.ts index 6d3f612b..8ce9f2f0 100644 --- a/sdk/src/vm.ts +++ b/sdk/src/vm.ts @@ -68,7 +68,9 @@ export class VM { public editor = { /** - * Open one of several files in tabs and/or split panes + * Open one of several files in tabs and/or split panes. + * + * @since 1.7.0 Added support for opening multiple files */ openFile: (path: OpenFileOption): Promise => { return this._rdc.request({ @@ -77,6 +79,26 @@ export class VM { }); }, + /** + * Set a project file as the currently selected file. + * + * This may update: + * - the highlighted file in the file explorer + * - the currently open and/or focused editor tab + * + * This will not open a new editor tab if the provided path does not match + * a currently open tab. See `vm.editor.openFile` to open files. + * + * @since 1.7.0 + * @experimental + */ + selectFile: (path: string): Promise => { + return this._rdc.request({ + type: 'SDK_SELECT_FILE', + payload: { path }, + }); + }, + /** * Change the color theme * @@ -90,7 +112,8 @@ export class VM { }, /** - * Change the display mode of the project + * Change the display mode of the project: + * * - `default`: show the editor and preview pane * - `editor`: show the editor pane only * - `preview`: show the preview pane only @@ -105,9 +128,10 @@ export class VM { }, /** - * Change the display mode of the sidebar - * - true: show the sidebar - * - false: hide the sidebar + * Change the display mode of the sidebar: + * + * - `true`: show the sidebar + * - `false`: hide the sidebar * * @since 1.7.0 */