Skip to content

Commit 7baf2d0

Browse files
committed
Small formatting changes for graphes
1 parent 328289e commit 7baf2d0

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

extensions/ql-vscode/src/cli.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -741,7 +741,9 @@ export class CodeQLCliServer implements Disposable {
741741
}
742742

743743
async interpretBqrsGraph(metadata: QueryMetadata, resultsPath: string, interpretedResultsPath: string, sourceInfo?: SourceInfo): Promise<string[]> {
744-
const additionalArgs = sourceInfo ? ['--dot-location-url-format', 'file://' + sourceInfo.sourceLocationPrefix + '{path}:{start:line}:{start:column}:{end:line}:{end:column}'] : [];
744+
const additionalArgs = sourceInfo
745+
? ['--dot-location-url-format', 'file://' + sourceInfo.sourceLocationPrefix + '{path}:{start:line}:{start:column}:{end:line}:{end:column}']
746+
: [];
745747

746748
await this.runInterpretCommand('dot', additionalArgs, metadata, resultsPath, interpretedResultsPath, sourceInfo);
747749

extensions/ql-vscode/src/interface.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,24 +90,27 @@ function sortInterpretedResults(
9090
}
9191

9292
function interpretedPageSize(interpretation: Interpretation | undefined): number {
93-
if (interpretation && interpretation.data.t == 'GraphInterpretationData')
93+
if (interpretation?.data.t == 'GraphInterpretationData') {
94+
// Graph views always have one result per page.
9495
return 1;
96+
}
9597
return PAGE_SIZE.getValue<number>();
9698
}
9799

98100
function numPagesOfResultSet(resultSet: RawResultSet, interpretation?: Interpretation): number {
99101
const pageSize = interpretedPageSize(interpretation);
100102

101-
const n = interpretation && interpretation.data.t == 'GraphInterpretationData'
103+
const n = interpretation?.data.t == 'GraphInterpretationData'
102104
? interpretation.data.dot.length
103105
: resultSet.schema.rows;
104106

105107
return Math.ceil(n / pageSize);
106108
}
107109

108110
function numInterpretedPages(interpretation: Interpretation | undefined): number {
109-
if (!interpretation)
111+
if (!interpretation) {
110112
return 0;
113+
}
111114

112115
const pageSize = interpretedPageSize(interpretation);
113116

0 commit comments

Comments
 (0)