Small formatting changes for graphes

This commit is contained in:
Andrew Eisenberg
2022-03-01 11:50:55 -08:00
parent 328289eb1c
commit 7baf2d0a2a
2 changed files with 9 additions and 4 deletions

View File

@@ -741,7 +741,9 @@ export class CodeQLCliServer implements Disposable {
}
async interpretBqrsGraph(metadata: QueryMetadata, resultsPath: string, interpretedResultsPath: string, sourceInfo?: SourceInfo): Promise<string[]> {
const additionalArgs = sourceInfo ? ['--dot-location-url-format', 'file://' + sourceInfo.sourceLocationPrefix + '{path}:{start:line}:{start:column}:{end:line}:{end:column}'] : [];
const additionalArgs = sourceInfo
? ['--dot-location-url-format', 'file://' + sourceInfo.sourceLocationPrefix + '{path}:{start:line}:{start:column}:{end:line}:{end:column}']
: [];
await this.runInterpretCommand('dot', additionalArgs, metadata, resultsPath, interpretedResultsPath, sourceInfo);

View File

@@ -90,15 +90,17 @@ function sortInterpretedResults(
}
function interpretedPageSize(interpretation: Interpretation | undefined): number {
if (interpretation && interpretation.data.t == 'GraphInterpretationData')
if (interpretation?.data.t == 'GraphInterpretationData') {
// Graph views always have one result per page.
return 1;
}
return PAGE_SIZE.getValue<number>();
}
function numPagesOfResultSet(resultSet: RawResultSet, interpretation?: Interpretation): number {
const pageSize = interpretedPageSize(interpretation);
const n = interpretation && interpretation.data.t == 'GraphInterpretationData'
const n = interpretation?.data.t == 'GraphInterpretationData'
? interpretation.data.dot.length
: resultSet.schema.rows;
@@ -106,8 +108,9 @@ function numPagesOfResultSet(resultSet: RawResultSet, interpretation?: Interpret
}
function numInterpretedPages(interpretation: Interpretation | undefined): number {
if (!interpretation)
if (!interpretation) {
return 0;
}
const pageSize = interpretedPageSize(interpretation);