Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
ab933fc
Add 'show next/previous alert' commands
asgerf Oct 5, 2022
2949fc3
Replace 'expanded' with a Set<number>
asgerf Oct 5, 2022
bb61b5e
Replace the expansion index with the result key
asgerf Oct 5, 2022
3c4682e
Ensure nodes are expanded
asgerf Oct 5, 2022
20dea5e
Also show selection in raw result view
asgerf Oct 5, 2022
125f638
Make raw result view respond to navigation events
asgerf Oct 5, 2022
88bfd19
Switch commands to up/down/left/right semantics
asgerf Oct 6, 2022
0f6100c
Bugfix in getPathNode
asgerf Oct 7, 2022
5a69465
Rename command IDs.
asgerf Oct 7, 2022
f759eed
Remove unsed parts of result-keys.ts
asgerf Oct 7, 2022
4871728
Added change note
asgerf Oct 10, 2022
d08e005
When stepping up or down, collapse the previous node
asgerf Oct 11, 2022
45b6288
Reveal panel on navigate, to prevent webview destruction
asgerf Oct 19, 2022
0e3679d
Scroll selected item into view
asgerf Oct 19, 2022
ecc07a5
Update extensions/ql-vscode/CHANGELOG.md
asgerf Oct 21, 2022
cbf15e6
Update extensions/ql-vscode/src/view/results/alert-table.tsx
asgerf Oct 21, 2022
53bb9d7
Title-case command names, like other commands
asgerf Oct 21, 2022
65777b5
Use null-aware accessors in getResult
asgerf Oct 21, 2022
d4a58a6
Consistently check for undefined rather than nullish
asgerf Oct 21, 2022
e1a56dd
Update a new more nullish checks
asgerf Oct 21, 2022
bdf7208
Mention keyboard navigation in README
asgerf Oct 21, 2022
9cb4b9d
Update extensions/ql-vscode/package.json
asgerf Oct 24, 2022
0acf9f7
Fix bad suggestion merge in package.json
asgerf Oct 24, 2022
ead1fb4
Merge branch 'main' into asgerf/navigate-alerts
asgerf Oct 24, 2022
b480f8f
Fix incorrect merge resolution in changelog
asgerf Oct 24, 2022
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
2 changes: 1 addition & 1 deletion extensions/ql-vscode/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## [UNRELEASED]

- Fix a bug where it was not possible to add a database folder if the folder name starts with `db-`. [#1565](https://github.com/github/vscode-codeql/pull/1565)
- Added commands for navigating up, down, left, or right in the result viewer. Previously there were only commands for moving up and down the currently-selected path. We suggest binding keyboard shortcuts to these commands, for navigating the result viewer using the keyboard.
- Add commands for navigating up, down, left, or right in the result viewer. Previously there were only commands for moving up and down the currently-selected path. We suggest binding keyboard shortcuts to these commands, for navigating the result viewer using the keyboard. [#1568](https://github.com/github/vscode-codeql/pull/1568)

## 1.7.0 - 20 September 2022

Expand Down
4 changes: 4 additions & 0 deletions extensions/ql-vscode/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ When the results are ready, they're displayed in the CodeQL Query Results view.

If there are any problems running a query, a notification is displayed in the bottom right corner of the application. In addition to the error message, the notification includes details of how to fix the problem.

### Keyboad navigation

If you wish to navigate the query results from your keyboard, you can bind shortcuts to the **CodeQL: Navigate Up/Down/Left/Right in Result Viewer** commands.

## What next?

For more information about the CodeQL extension, [see the documentation](https://codeql.github.com/docs/codeql-for-visual-studio-code/). Otherwise, you could:
Expand Down
8 changes: 4 additions & 4 deletions extensions/ql-vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -595,19 +595,19 @@
},
{
"command": "codeQLQueryResults.down",
"title": "CodeQL: Navigate down in result viewer"
"title": "CodeQL: Navigate Down in Result Viewer"
},
{
"command": "codeQLQueryResults.up",
"title": "CodeQL: Navigate up in result viewer"
"title": "CodeQL: Navigate Up in Result Viewer"
},
{
"command": "codeQLQueryResults.right",
"title": "CodeQL: Navigate right in result viewer"
"title": "CodeQL: Navigate Right in Result Viewer"
},
{
"command": "codeQLQueryResults.left",
"title": "CodeQL: Navigate left in result viewer"
"title": "CodeQL: Navigate Left in Result Viewer"
Comment thread
asgerf marked this conversation as resolved.
Outdated
},
{
"command": "codeQL.restartQueryServer",
Expand Down
5 changes: 1 addition & 4 deletions extensions/ql-vscode/src/pure/result-keys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,7 @@ export type ResultKey = Result | Path | PathNode;
* Looks up a specific result in a result set.
*/
export function getResult(sarif: sarif.Log, key: Result | Path | PathNode): sarif.Result | undefined {
Comment thread
aeisenberg marked this conversation as resolved.
if (sarif.runs.length === 0) return undefined;
if (sarif.runs[0].results === undefined) return undefined;
const results = sarif.runs[0].results;
return results[key.resultIndex];
return sarif.runs[0]?.results?.[key.resultIndex];
}

/**
Expand Down
16 changes: 8 additions & 8 deletions extensions/ql-vscode/src/view/results/alert-table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export class PathTable extends React.Component<PathTableProps, PathTableState> {
}

/**
* Given a list of `ids`, toggle the first, and if we 'open' the
* Given a list of `keys`, toggle the first, and if we 'open' the
* first item, open all the rest as well. This mimics vscode's file
* explorer tree view behavior.
*/
Expand Down Expand Up @@ -313,19 +313,19 @@ export class PathTable extends React.Component<PathTableProps, PathTableState> {

// Check if the selected node actually exists (bounds check) and get its location if relevant
let jumpLocation: Sarif.Location | undefined;
if (key.pathNodeIndex != null) {
if (key.pathNodeIndex !== undefined) {
jumpLocation = Keys.getPathNode(data, key);
if (jumpLocation == null) {
if (jumpLocation === undefined) {
return prevState; // Result does not exist
}
} else if (key.pathIndex != null) {
if (Keys.getPath(data, key) == null) {
} else if (key.pathIndex !== undefined) {
if (Keys.getPath(data, key) === undefined) {
return prevState; // Path does not exist
}
jumpLocation = undefined; // When selecting a 'path', don't jump anywhere.
} else {
jumpLocation = Keys.getResult(data, key)?.locations?.[0];
if (jumpLocation == null) {
if (jumpLocation === undefined) {
return prevState; // Path step does not exist.
}
}
Expand All @@ -340,15 +340,15 @@ export class PathTable extends React.Component<PathTableProps, PathTableState> {
if (event.direction === NavigationDirection.right) {
// When stepping right, expand to ensure the selected node is visible
expanded.add(Keys.keyToString({ resultIndex: key.resultIndex }));
if (key.pathIndex != null) {
if (key.pathIndex !== undefined) {
expanded.add(Keys.keyToString({ resultIndex: key.resultIndex, pathIndex: key.pathIndex }));
}
} else if (event.direction === NavigationDirection.left) {
// When stepping left, collapse immediately
expanded.delete(Keys.keyToString(key));
} else {
// When stepping up or down, collapse the previous node
if (prevState.selectedItem != null) {
if (prevState.selectedItem !== undefined) {
expanded.delete(Keys.keyToString(prevState.selectedItem));
}
}
Expand Down