Skip to content

Commit

Permalink
sdk: add experimental vm.editor.selectFile
Browse files Browse the repository at this point in the history
  • Loading branch information
Florens Verschelde committed Apr 17, 2022
1 parent 08ff58a commit 3ef777a
Showing 1 changed file with 29 additions and 5 deletions.
34 changes: 29 additions & 5 deletions sdk/src/vm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<null> => {
return this._rdc.request({
Expand All @@ -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<null> => {
return this._rdc.request({
type: 'SDK_SELECT_FILE',
payload: { path },
});
},

/**
* Change the color theme
*
Expand All @@ -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
Expand All @@ -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
*/
Expand Down

0 comments on commit 3ef777a

Please sign in to comment.