Fix crash in codeql.debugQuery when run from command palette
This commit is contained in:
@@ -150,7 +150,7 @@ export type LocalQueryCommands = {
|
||||
|
||||
// Debugger commands
|
||||
export type DebuggerCommands = {
|
||||
"codeQL.debugQuery": (uri: Uri) => Promise<void>;
|
||||
"codeQL.debugQuery": (uri: Uri | undefined) => Promise<void>;
|
||||
"codeQL.debugQueryContextEditor": (uri: Uri) => Promise<void>;
|
||||
"codeQL.startDebuggingSelection": () => Promise<void>;
|
||||
"codeQL.startDebuggingSelectionContextEditor": () => Promise<void>;
|
||||
|
||||
@@ -185,8 +185,11 @@ export class DebuggerUI
|
||||
this.sessions.delete(session.id);
|
||||
}
|
||||
|
||||
private async debugQuery(uri: Uri): Promise<void> {
|
||||
const queryPath = validateQueryUri(uri, false);
|
||||
private async debugQuery(uri: Uri | undefined): Promise<void> {
|
||||
const queryPath =
|
||||
uri !== undefined
|
||||
? validateQueryUri(uri, false)
|
||||
: await this.localQueries.getCurrentQuery(false);
|
||||
|
||||
// Start debugging with a default configuration that just specifies the query path.
|
||||
await debug.startDebugging(undefined, {
|
||||
|
||||
@@ -412,7 +412,7 @@ export class LocalQueries extends DisposableObject {
|
||||
* For now, the "active query" is just whatever query is in the active text editor. Once we have a
|
||||
* propery "queries" panel, we can provide a way to select the current query there.
|
||||
*/
|
||||
private async getCurrentQuery(allowLibraryFiles: boolean): Promise<string> {
|
||||
public async getCurrentQuery(allowLibraryFiles: boolean): Promise<string> {
|
||||
const editor = window.activeTextEditor;
|
||||
if (editor === undefined) {
|
||||
throw new Error(
|
||||
|
||||
Reference in New Issue
Block a user