The Wayback Machine - https://web.archive.org/web/20250523161257/https://github.com/github/vscode-codeql/pull/1155
Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Add remote query items to history view #1155

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 23, 2022
Merged

Conversation

aeisenberg
Copy link
Contributor

This is another incremental step on the way to saving history.

This commit adds remote items to the history view. It adds in progress
and completed icons. Users can explicitly remove items.

Here is what is not working:

  1. Any other query history commands like open results or open query.
  2. Seeing items after a restart.

To make further progress, there will need to be another bit of refactoring where we separate monitoring and opening remote queries from the remote-query manager. There needs to be a way for the query history manager to kick off the monitoring process for any in-progress history item.

Checklist

  • [n/a] CHANGELOG.md has been updated to incorporate all user visible changes made by this pull request.
  • Issues have been created for any UI or other user-facing changes made by this pull request.
  • [n/a] [Maintainers only] If this pull request makes user-facing changes that require documentation changes, open a corresponding docs pull request in the github/codeql repo and add the ready-for-doc-review label there.

@aeisenberg aeisenberg requested review from a team as code owners February 17, 2022 00:27
@aeisenberg aeisenberg force-pushed the aeisenberg/remote-query-save branch from fb9e2c0 to 02838db Compare February 17, 2022 00:58
This is another incremental step on the way to saving history.

This commit adds remote items to the history view. It adds in progress
and completed icons. Users can explicitly remove items.

Here is what is _not_ working:

1. Any other query history commands like open results or open query.
2. Seeing items after a restart.
@aeisenberg aeisenberg force-pushed the aeisenberg/remote-query-save branch from 02838db to 16df990 Compare February 17, 2022 02:43
return queryHistoryItem.initialInfo.queryText;
async getQueryText(item: QueryHistoryInfo): Promise<string> {
// TODO remote queries cannot have their text returned
return item.t === 'local' ? item.initialInfo.queryText : '';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI we store the queryText in the RemoteQuery entity.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me change the TODO text. The queryText is just not yet available.

@@ -61,6 +65,13 @@ export class RemoteQueriesManager {
query: RemoteQuery,
cancellationToken: CancellationToken
): Promise<void> {
const queryId = this.createQueryId(query.queryName);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It probably doesn't make a huge difference pragmatically at the moment, but to me it feels like the logical place for this code (generating query id, preparing storage and creating a history item) is runRemoteQuery rather than monitorRemoteQuery.

Also if we do that, monitorRemoteQuery can be called when we rehydrate query history after a VS Code restart.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes...the next PR will be about refactoring how we do monitoring and storing the query. I'd like to centralize the object that (de-)serializes query data, so this can happen outside of the initial running of the query.

await this.interfaceManager.showResults(query, queryResult);
}
// Ask if the user wants to open the results in the background.
void this.askToOpenResults(query, queryResult).then(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason we're not doing await with try/catch?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want this to happen async, in the background.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah good point. Should we remove await from the other branches too? Doesn't have to be in this PR, just curious.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. I think that makes sense.

@aeisenberg aeisenberg force-pushed the aeisenberg/remote-query-save branch from 380a203 to 90764ae Compare February 17, 2022 22:10
@aeisenberg aeisenberg force-pushed the aeisenberg/remote-query-save branch from 90764ae to 9c6ae22 Compare February 17, 2022 22:12
await this.interfaceManager.showResults(query, queryResult);
}
// Ask if the user wants to open the results in the background.
void this.askToOpenResults(query, queryResult).then(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah good point. Should we remove await from the other branches too? Doesn't have to be in this PR, just curious.

Base automatically changed from aeisenberg/refactor-query-history-info to main February 22, 2022 17:51
@aeisenberg
Copy link
Contributor Author

Going to hold off merging this PR until the next (not yet created PR) is approved and can be merged at the same time. This PR does what it says, but leaves the extension in a bit of an awkward state:

  1. Remote query history items are added to the history view, but they cannot be interacted with (except to remove).
  2. After a restart, the items no longer show up in the query history view, but they remain on disk and can only be removed by the query history purger.

The next PR (coming soon) will remove these two restrictions.

@aeisenberg aeisenberg merged commit cef1fcc into main Feb 23, 2022
@aeisenberg aeisenberg deleted the aeisenberg/remote-query-save branch February 23, 2022 19:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.