Browse Source

Changes `options` to always exist for mutability

main
Eric Amodio 1 year ago
parent
commit
b81c9b6e02
4 changed files with 15 additions and 6 deletions
  1. +2
    -2
      src/plus/webviews/graph/graphWebview.ts
  2. +1
    -1
      src/plus/webviews/timeline/timelineWebview.ts
  3. +1
    -1
      src/webviews/home/homeWebview.ts
  4. +11
    -2
      src/webviews/webviewController.ts

+ 2
- 2
src/plus/webviews/graph/graphWebview.ts View File

@ -241,13 +241,13 @@ export class GraphWebviewProvider implements WebviewProvider {
async canShowWebviewPanel(
firstTime: boolean,
options?: { column?: ViewColumn; preserveFocus?: boolean },
options: { column?: ViewColumn; preserveFocus?: boolean },
...args: unknown[]
): Promise<boolean> {
this._firstSelection = true;
if (!(await ensurePlusFeaturesEnabled())) return false;
if (options?.column != null) {
if (options.column == null) {
options.column = ViewColumn.Active;
}

+ 1
- 1
src/plus/webviews/timeline/timelineWebview.ts View File

@ -83,7 +83,7 @@ export class TimelineWebviewProvider implements WebviewProvider {
async canShowWebviewPanel(
firstTime: boolean,
_options?: { column?: ViewColumn; preserveFocus?: boolean },
_options: { column?: ViewColumn; preserveFocus?: boolean },
...args: unknown[]
): Promise<boolean> {
if (!(await ensurePlusFeaturesEnabled())) return false;

+ 1
- 1
src/webviews/home/homeWebview.ts View File

@ -60,7 +60,7 @@ export class HomeWebviewProvider implements WebviewProvider {
async canShowWebviewPanel(
_firstTime: boolean,
_options?: { column?: ViewColumn; preserveFocus?: boolean },
_options: { column?: ViewColumn; preserveFocus?: boolean },
..._args: unknown[]
): Promise<boolean> {
if (!(await ensurePlusFeaturesEnabled())) return false;

+ 11
- 2
src/webviews/webviewController.ts View File

@ -36,14 +36,19 @@ function nextIpcId() {
export interface WebviewProvider<State, SerializedState = State> extends Disposable {
canShowWebviewPanel?(
firstTime: boolean,
options?: { column?: ViewColumn; preserveFocus?: boolean },
options: { column?: ViewColumn; preserveFocus?: boolean },
...args: unknown[]
): boolean | Promise<boolean>;
onShowWebviewPanel?(
firstTime: boolean,
options?: { column?: ViewColumn; preserveFocus?: boolean },
options: { column?: ViewColumn; preserveFocus?: boolean },
...args: unknown[]
): void | Promise<void>;
canShowWebviewView?(
firstTime: boolean,
options: { column?: ViewColumn; preserveFocus?: boolean },
...args: unknown[]
): boolean | Promise<boolean>;
registerCommands?(): Disposable[];
includeBootstrap?(): SerializedState | Promise<SerializedState>;
@ -212,6 +217,10 @@ export class WebviewController implements Dispos
}
async show(firstTime: boolean, options?: { column?: ViewColumn; preserveFocus?: boolean }, ...args: unknown[]) {
if (options == null) {
options = {};
}
if (this.isType('tab')) {
const result = await this.provider.canShowWebviewPanel?.(firstTime, options, ...args);
if (result === false) return;

Loading…
Cancel
Save