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
2 changes: 1 addition & 1 deletion extensions/ql-vscode/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
## [UNRELEASED]

- Fix a bug where invoking _View AST_ from the file explorer would not view the selected file. Instead it would view the active editor. Also, prevent the _View AST_ from appearing if the current selection includes a directory or multiple files. [#1113](https://github.com/github/vscode-codeql/pull/1113)
- Add query history items as soon as a query is run, including new icons for each history item. [#1094](https://github.com/github/vscode-codeql/pull/1094)

## 1.5.10 - 25 January 2022

- Fix a bug where the results view moved column even when it was already visible. [#1070](https://github.com/github/vscode-codeql/pull/1070)
- Add packaging-related commands. _CodeQL: Download Packs_ downloads query packs from the package registry that can be run locally, and _CodeQL: Install Pack Dependencies_ installs dependencies for packs in your workspace. [#1076](https://github.com/github/vscode-codeql/pull/1076)
- Add query history items as soon as a query is run, including new icons for each history item. [#1094](https://github.com/github/vscode-codeql/pull/1094)

## 1.5.9 - 17 December 2021

Expand Down
53 changes: 45 additions & 8 deletions extensions/ql-vscode/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions extensions/ql-vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1021,6 +1021,7 @@
"glob-promise": "^3.4.0",
"js-yaml": "^3.14.0",
"minimist": "~1.2.5",
"nanoid": "^3.2.0",
"node-fetch": "~2.6.7",
"path-browserify": "^1.0.1",
"react": "^17.0.2",
Expand Down Expand Up @@ -1056,6 +1057,7 @@
"@types/js-yaml": "^3.12.5",
"@types/jszip": "~3.1.6",
"@types/mocha": "^9.0.0",
"@types/nanoid": "^3.0.0",
"@types/node": "^12.14.1",
"@types/node-fetch": "~2.5.2",
"@types/proxyquire": "~1.3.28",
Expand Down
1 change: 1 addition & 0 deletions extensions/ql-vscode/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,7 @@ async function activateWithInstalledDistribution(

const qhm = new QueryHistoryManager(
qs,
dbm,
ctx.extensionPath,
queryHistoryConfigurationListener,
showResults,
Expand Down
26 changes: 15 additions & 11 deletions extensions/ql-vscode/src/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ export class InterfaceManager extends DisposableObject {
// sortedResultsInfo doesn't have an entry for the current
// result set. Use this to determine whether or not we use
// the sorted bqrs file.
this._displayedQuery?.completedQuery.sortedResultsInfo.has(msg.selectedTable) || false
!!this._displayedQuery?.completedQuery.sortedResultsInfo[msg.selectedTable]
);
}
break;
Expand Down Expand Up @@ -372,8 +372,8 @@ export class InterfaceManager extends DisposableObject {
);

const sortedResultsMap: SortedResultsMap = {};
fullQuery.completedQuery.sortedResultsInfo.forEach(
(v, k) =>
Object.entries(fullQuery.completedQuery.sortedResultsInfo).forEach(
([k, v]) =>
(sortedResultsMap[k] = this.convertPathPropertiesToWebviewUris(v))
);

Expand Down Expand Up @@ -458,7 +458,7 @@ export class InterfaceManager extends DisposableObject {
shouldKeepOldResultsWhileRendering,
metadata: fullQuery.completedQuery.query.metadata,
queryName: fullQuery.label,
queryPath: fullQuery.completedQuery.query.program.queryPath
queryPath: fullQuery.initialInfo.queryPath
});
}

Expand Down Expand Up @@ -491,7 +491,7 @@ export class InterfaceManager extends DisposableObject {
pageSize: PAGE_SIZE.getValue(),
numPages: numInterpretedPages(this._interpretation),
queryName: this._displayedQuery.label,
queryPath: this._displayedQuery.completedQuery.query.program.queryPath
queryPath: this._displayedQuery.initialInfo.queryPath
});
}

Expand Down Expand Up @@ -523,8 +523,8 @@ export class InterfaceManager extends DisposableObject {
}

const sortedResultsMap: SortedResultsMap = {};
results.completedQuery.sortedResultsInfo.forEach(
(v, k) =>
Object.entries(results.completedQuery.sortedResultsInfo).forEach(
([k, v]) =>
(sortedResultsMap[k] = this.convertPathPropertiesToWebviewUris(v))
);

Expand Down Expand Up @@ -576,7 +576,7 @@ export class InterfaceManager extends DisposableObject {
shouldKeepOldResultsWhileRendering: false,
metadata: results.completedQuery.query.metadata,
queryName: results.label,
queryPath: results.completedQuery.query.program.queryPath
queryPath: results.initialInfo.queryPath
});
}

Expand Down Expand Up @@ -649,14 +649,18 @@ export class InterfaceManager extends DisposableObject {
sortState: InterpretedResultsSortState | undefined
): Promise<Interpretation | undefined> {
if (
(await query.canHaveInterpretedResults()) &&
query.canHaveInterpretedResults() &&
query.quickEvalPosition === undefined // never do results interpretation if quickEval
) {
try {
const sourceLocationPrefix = await query.dbItem.getSourceLocationPrefix(
const dbItem = this.databaseManager.findDatabaseItem(Uri.file(query.dbItemPath));
if (!dbItem) {
throw new Error(`Could not find database item for ${query.dbItemPath}`);
}
const sourceLocationPrefix = await dbItem.getSourceLocationPrefix(
this.cliServer
);
const sourceArchiveUri = query.dbItem.sourceArchive;
const sourceArchiveUri = dbItem.sourceArchive;
const sourceInfo =
sourceArchiveUri === undefined
? undefined
Expand Down
10 changes: 5 additions & 5 deletions extensions/ql-vscode/src/query-history.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import { DisposableObject } from './pure/disposable-object';
import { commandRunner } from './commandRunner';
import { assertNever } from './pure/helpers-pure';
import { FullCompletedQueryInfo, FullQueryInfo, QueryStatus } from './query-results';
import { DatabaseManager } from './databases';

/**
* query-history.ts
Expand Down Expand Up @@ -246,6 +247,7 @@ export class QueryHistoryManager extends DisposableObject {

constructor(
private qs: QueryServerClient,
private dbm: DatabaseManager,
extensionPath: string,
queryHistoryConfigListener: QueryHistoryConfig,
private selectedCallback: (item: FullCompletedQueryInfo) => Promise<void>,
Expand Down Expand Up @@ -599,14 +601,12 @@ export class QueryHistoryManager extends DisposableObject {
throw new Error(NO_QUERY_SELECTED);
}

const rawQueryName = singleItem.getQueryName();
const queryName = rawQueryName.endsWith('.ql') ? rawQueryName : rawQueryName + '.ql';
const params = new URLSearchParams({
isQuickEval: String(!!singleItem.initialInfo.quickEvalPosition),
queryText: encodeURIComponent(await this.getQueryText(singleItem)),
});
const uri = Uri.parse(
`codeql:${singleItem.initialInfo.id}-${queryName}?${params.toString()}`, true
`codeql:${singleItem.initialInfo.id}?${params.toString()}`, true
);
const doc = await workspace.openTextDocument(uri);
await window.showTextDocument(doc, { preview: false });
Expand All @@ -620,7 +620,7 @@ export class QueryHistoryManager extends DisposableObject {
return;
}
const query = singleItem.completedQuery.query;
const hasInterpretedResults = await query.canHaveInterpretedResults();
const hasInterpretedResults = query.canHaveInterpretedResults();
if (hasInterpretedResults) {
await this.tryOpenExternalFile(
query.resultsPaths.interpretedResultsPath
Expand Down Expand Up @@ -664,7 +664,7 @@ export class QueryHistoryManager extends DisposableObject {
}

await this.tryOpenExternalFile(
await singleItem.completedQuery.query.ensureCsvProduced(this.qs)
await singleItem.completedQuery.query.ensureCsvProduced(this.qs, this.dbm)
);
}

Expand Down
Loading