Bläddra i källkod

Changes `options` to always exist for mutability

main
Eric Amodio 1 år sedan
förälder
incheckning
b81c9b6e02
4 ändrade filer med 15 tillägg och 6 borttagningar
  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 Visa fil

@ -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 Visa fil

@ -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 Visa fil

@ -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 Visa fil

@ -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;

Laddar…
Avbryt
Spara