Skip to content

Commit ecc5fa1

Browse files
committed
Extract MRVA view title generation to method
We had duplicated logic for generating the variant analysis view title. This extracts it to a single method so the title are always in sync.
1 parent 7ec4b4b commit ecc5fa1

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

extensions/ql-vscode/src/remote-queries/variant-analysis-view.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export class VariantAnalysisView
5252
});
5353

5454
const panel = await this.getPanel();
55-
panel.title = `${variantAnalysis.query.name} - CodeQL Query Results`;
55+
panel.title = this.getTitle(variantAnalysis);
5656
}
5757

5858
public async updateRepoState(
@@ -88,9 +88,7 @@ export class VariantAnalysisView
8888

8989
return {
9090
viewId: VariantAnalysisView.viewType,
91-
title: variantAnalysis
92-
? `${variantAnalysis.query.name} - CodeQL Query Results`
93-
: `Variant analysis ${this.variantAnalysisId} - CodeQL Query Results`,
91+
title: this.getTitle(variantAnalysis),
9492
viewColumn: ViewColumn.Active,
9593
preserveFocus: true,
9694
view: "variant-analysis",
@@ -189,4 +187,10 @@ export class VariantAnalysisView
189187
repoStates,
190188
});
191189
}
190+
191+
private getTitle(variantAnalysis: VariantAnalysis | undefined): string {
192+
return variantAnalysis
193+
? `${variantAnalysis.query.name} - CodeQL Query Results`
194+
: `Variant analysis ${this.variantAnalysisId} - CodeQL Query Results`;
195+
}
192196
}

0 commit comments

Comments
 (0)