55 WorkspaceFolder ,
66} from "vscode" ;
77import { getOnDiskWorkspaceFolders , showAndLogErrorMessage } from "../helpers" ;
8+ import { LocalQueries } from "../local-queries" ;
89
910interface QLDebugArgs {
1011 query : string ;
@@ -26,6 +27,8 @@ export type QLResolvedDebugConfiguration = DebugConfiguration &
2627export class QLDebugConfigurationProvider
2728 implements DebugConfigurationProvider
2829{
30+ public constructor ( private readonly localQueries : LocalQueries ) { }
31+
2932 public resolveDebugConfiguration (
3033 _folder : WorkspaceFolder | undefined ,
3134 debugConfiguration : DebugConfiguration ,
@@ -62,25 +65,30 @@ export class QLDebugConfigurationProvider
6265 return null ;
6366 }
6467
68+ // Fill in defaults here, instead of in `resolveDebugConfiguration`, to avoid the highly
69+ // unusual case where one of the computed default values looks like a variable substitution.
70+ const additionalPacks =
71+ qlConfiguration . additionalPacks === undefined
72+ ? getOnDiskWorkspaceFolders ( )
73+ : typeof qlConfiguration . additionalPacks === "string"
74+ ? [ qlConfiguration . additionalPacks ]
75+ : qlConfiguration . additionalPacks ;
76+
77+ // Default to computing the extension packs based on the extension configuration and the search
78+ // path.
79+ const extensionPacks =
80+ qlConfiguration . extensionPacks === undefined
81+ ? await this . localQueries . getDefaultExtensionPacks ( additionalPacks )
82+ : typeof qlConfiguration . extensionPacks === "string"
83+ ? [ qlConfiguration . extensionPacks ]
84+ : qlConfiguration . extensionPacks ;
85+
6586 const resultConfiguration : QLResolvedDebugConfiguration = {
6687 ...qlConfiguration ,
6788 query : qlConfiguration . query ,
6889 database : qlConfiguration . database ,
69- additionalPacks :
70- // Fill in defaults here, instead of in `resolveDebugConfiguration`, to avoid the highly
71- // unusual case where one of the workspace folder paths contains something that looks like a
72- // variable substitution.
73- qlConfiguration . additionalPacks === undefined
74- ? getOnDiskWorkspaceFolders ( )
75- : typeof qlConfiguration . additionalPacks === "string"
76- ? [ qlConfiguration . additionalPacks ]
77- : qlConfiguration . additionalPacks ,
78- extensionPacks :
79- qlConfiguration . extensionPacks === undefined
80- ? [ ]
81- : typeof qlConfiguration . extensionPacks === "string"
82- ? [ qlConfiguration . extensionPacks ]
83- : qlConfiguration . extensionPacks ,
90+ additionalPacks,
91+ extensionPacks,
8492 } ;
8593
8694 return resultConfiguration ;
0 commit comments