Skip to content

Commit

Permalink
Merge pull request #3125 from github/aeisenberg/no-multi-token
Browse files Browse the repository at this point in the history
Avoid creating a multitoken when finding definitions
  • Loading branch information
aeisenberg authored Dec 13, 2023
2 parents 9594a5e + 8516940 commit e15f153
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 34 deletions.
4 changes: 3 additions & 1 deletion extensions/ql-vscode/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## [UNRELEASED]

- Avoid showing a popup when hovering over source elements in database source files. [#3125](https://github.com/github/vscode-codeql/pull/3125)

## 1.11.0 - 13 December 2023

- Add a new method modeling panel to classify methods as sources/sinks/summaries while in the context of the source code. [#3128](https://github.com/github/vscode-codeql/pull/3128)
Expand All @@ -19,7 +21,7 @@
- Add new CodeQL views for managing databases and queries:
1. A queries panel that shows all queries in your workspace. It allows you to view, create, and run queries in one place.
2. A language selector, which allows you to quickly filter databases and queries by language.

For more information, see the [documentation](https://codeql.github.com/docs/codeql-for-visual-studio-code/analyzing-your-projects/#filtering-databases-and-queries-by-language).
- When adding a CodeQL database, we no longer add the database source folder to the workspace by default (since this caused bugs in single-folder workspaces). [#3047](https://github.com/github/vscode-codeql/pull/3047)
- You can manually add individual database source folders to the workspace with the "Add Database Source to Workspace" right-click command in the databases view.
Expand Down
32 changes: 18 additions & 14 deletions extensions/ql-vscode/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1086,23 +1086,27 @@ async function activateWithInstalledDistribution(
// Jump-to-definition and find-references
void extLogger.log("Registering jump-to-definition handlers.");

languages.registerDefinitionProvider(
{ scheme: zipArchiveScheme },
new TemplateQueryDefinitionProvider(
cliServer,
qs,
dbm,
contextualQueryStorageDir,
ctx.subscriptions.push(
languages.registerDefinitionProvider(
{ scheme: zipArchiveScheme },
new TemplateQueryDefinitionProvider(
cliServer,
qs,
dbm,
contextualQueryStorageDir,
),
),
);

languages.registerReferenceProvider(
{ scheme: zipArchiveScheme },
new TemplateQueryReferenceProvider(
cliServer,
qs,
dbm,
contextualQueryStorageDir,
ctx.subscriptions.push(
languages.registerReferenceProvider(
{ scheme: zipArchiveScheme },
new TemplateQueryReferenceProvider(
cliServer,
qs,
dbm,
contextualQueryStorageDir,
),
),
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,25 +88,18 @@ export class TemplateQueryDefinitionProvider implements DefinitionProvider {
uriString: string,
token: CancellationToken,
): Promise<LocationLink[]> {
return withProgress(
async (progress, tokenInner) => {
const multiToken = new MultiCancellationToken(token, tokenInner);
return getLocationsForUriString(
this.cli,
this.qs,
this.dbm,
uriString,
KeyType.DefinitionQuery,
this.queryStorageDir,
progress,
multiToken,
(src, _dest) => src === uriString,
);
},
{
cancellable: true,
title: "Finding definitions",
},
// Do not create a multitoken here. There will be no popup and users cannot click on anything to cancel this operation.
// This is because finding definitions can be triggered by a hover, which should not have a popup.
return getLocationsForUriString(
this.cli,
this.qs,
this.dbm,
uriString,
KeyType.DefinitionQuery,
this.queryStorageDir,
() => {}, // noop
token,
(src, _dest) => src === uriString,
);
}
}
Expand Down Expand Up @@ -161,6 +154,7 @@ export class TemplateQueryReferenceProvider implements ReferenceProvider {
uriString: string,
token: CancellationToken,
): Promise<FullLocationLink[]> {
// Create a multitoken here. There will be a popup and users can click on it to cancel this operation.
return withProgress(
async (progress, tokenInner) => {
const multiToken = new MultiCancellationToken(token, tokenInner);
Expand Down

0 comments on commit e15f153

Please sign in to comment.