Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions extensions/ql-vscode/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## [UNRELEASED]

- Display CodeQL CLI version being downloaded during an upgrade. [#862](https://github.com/github/vscode-codeql/pull/862)
- Display a helpful message and link to documentation when a query produces no results. [#866](https://github.com/github/vscode-codeql/pull/866)

## 1.4.8 - 05 May 2021

Expand Down
4 changes: 2 additions & 2 deletions extensions/ql-vscode/src/view/alert-table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as React from 'react';
import * as Sarif from 'sarif';
import * as Keys from '../pure/result-keys';
import * as octicons from './octicons';
import { className, renderLocation, ResultTableProps, zebraStripe, selectableZebraStripe, jumpToLocation, nextSortDirection } from './result-table-utils';
import { className, renderLocation, ResultTableProps, zebraStripe, selectableZebraStripe, jumpToLocation, nextSortDirection, emptyQueryResultsMessage } from './result-table-utils';
import { onNavigation, NavigationEvent } from './results';
import { PathTableResultSet } from '../pure/interface-types';
import {
Expand Down Expand Up @@ -79,7 +79,7 @@ export class PathTable extends React.Component<PathTableProps, PathTableState> {
if (this.props.nonemptyRawResults) {
return <span>No Alerts. See <a href='#' onClick={this.props.showRawResults}>raw results</a>.</span>;
} else {
return <span>No Alerts</span>;
return emptyQueryResultsMessage();
}
}

Expand Down
6 changes: 5 additions & 1 deletion extensions/ql-vscode/src/view/raw-results-table.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { ResultTableProps, className } from './result-table-utils';
import { ResultTableProps, className, emptyQueryResultsMessage } from './result-table-utils';
import { RAW_RESULTS_LIMIT, RawResultsSortState } from '../pure/interface-types';
import { RawTableResultSet } from '../pure/interface-types';
import RawTableHeader from './RawTableHeader';
Expand All @@ -21,6 +21,10 @@ export class RawTable extends React.Component<RawTableProps, {}> {
const { resultSet, databaseUri } = this.props;

let dataRows = resultSet.rows;
if (dataRows.length === 0) {
return emptyQueryResultsMessage();
}

let numTruncatedResults = 0;
if (dataRows.length > RAW_RESULTS_LIMIT) {
numTruncatedResults = dataRows.length - RAW_RESULTS_LIMIT;
Expand Down
6 changes: 6 additions & 0 deletions extensions/ql-vscode/src/view/result-table-utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -140,3 +140,9 @@ export function nextSortDirection(direction: SortDirection | undefined, includeU
return assertNever(direction);
}
}

export function emptyQueryResultsMessage(): JSX.Element {
return <span>
This query returned no results. If this isn&apos;t what you&apos;re expecting, and for effective query-writing tips, check out the <a href="https://un5kwke0ketx6vwhy3c87d8.julianrbryant.com/docs/codeql-language-guides/">CodeQL language guides</a>.
</span>;
}