Skip to content

Commit 73368d4

Browse files
committed
Add link to language guides for empty query results
1 parent c4b1225 commit 73368d4

1 file changed

Lines changed: 13 additions & 8 deletions

File tree

extensions/ql-vscode/src/view/raw-results-table.tsx

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,19 @@ export class RawTable extends React.Component<RawTableProps, {}> {
2727
dataRows = dataRows.slice(0, RAW_RESULTS_LIMIT);
2828
}
2929

30-
const tableRows = dataRows.map((row: ResultRow, rowIndex: number) =>
31-
<RawTableRow
32-
key={rowIndex}
33-
rowIndex={rowIndex + this.props.offset}
34-
row={row}
35-
databaseUri={databaseUri}
36-
/>
37-
);
30+
const emptyTableRow = <tr key={0}><td key={-1}>
31+
This query returned no results. If this isn't what you're expecting, and for tips writing effective queries, check out the <a href="https://codeql.github.com/docs/codeql-language-guides/">CodeQL language guides</a>
32+
</td></tr>
33+
34+
const tableRows = dataRows.length > 0 ?
35+
dataRows.map((row: ResultRow, rowIndex: number) =>
36+
<RawTableRow
37+
key={rowIndex}
38+
rowIndex={rowIndex + this.props.offset}
39+
row={row}
40+
databaseUri={databaseUri}
41+
/>
42+
) : [emptyTableRow];
3843

3944
if (numTruncatedResults > 0) {
4045
const colSpan = dataRows[0].length + 1; // one row for each data column, plus index column

0 commit comments

Comments
 (0)