diff --git a/firebase-vscode/package.json b/firebase-vscode/package.json index 6de4ca57c69..8321c6862d4 100644 --- a/firebase-vscode/package.json +++ b/firebase-vscode/package.json @@ -77,6 +77,11 @@ "default": true, "markdownDescription": "%ext.config.idx.viewMetricNotice%", "scope": "application" + }, + "firebase.debug": { + "type": "boolean", + "default": false, + "markdownDescription": "%ext.config.debug%" } } }, diff --git a/firebase-vscode/package.nls.json b/firebase-vscode/package.nls.json index 2fd89eb524d..6064872232b 100644 --- a/firebase-vscode/package.nls.json +++ b/firebase-vscode/package.nls.json @@ -4,6 +4,7 @@ "ext.config.firebasePath": "Path to the `Firebase` module, e.g. `./node_modules/firebase`", "ext.config.hosting.useFrameworks": "Enable web frameworks", "ext.config.npmPath": "Path to NPM executable in local environment", + "ext.config.debug": "When true, add the --debug flag to any commands run by the extension", "ext.config.title": "Prettier", "ext.config.idx.viewMetricNotice": "Show data collection notice on next startup (IDX Only)" } diff --git a/firebase-vscode/src/data-connect/terminal.ts b/firebase-vscode/src/data-connect/terminal.ts index d09c8ce73b0..d5383d28d01 100644 --- a/firebase-vscode/src/data-connect/terminal.ts +++ b/firebase-vscode/src/data-connect/terminal.ts @@ -17,6 +17,7 @@ export function setTerminalEnvVars(envVar: string, value: string) { } export function runCommand(command: string) { + const settings = getSettings(); const terminalOptions: TerminalOptions = { name: "Data Connect Terminal", env: environmentVariables, @@ -30,6 +31,9 @@ export function runCommand(command: string) { if (currentProjectId.value) { command = `${command} --project ${currentProjectId.value}`; } + if (settings.debug) { + command = `${command} --debug`; + } terminal.sendText(command); } @@ -38,6 +42,7 @@ export function runTerminalTask( command: string, presentationOptions: vscode.TaskPresentationOptions = { focus: true }, ): Promise { + const settings = getSettings(); const type = "firebase-" + Date.now(); return new Promise(async (resolve, reject) => { vscode.tasks.onDidEndTaskProcess(async (e) => { @@ -60,7 +65,7 @@ export function runTerminalTask( vscode.TaskScope.Workspace, taskName, "firebase", - new vscode.ShellExecution(command, executionOptions), + new vscode.ShellExecution(`${command} ${settings.debug ? "--debug" : ""}`, executionOptions), ); task.presentationOptions = presentationOptions; await vscode.tasks.executeTask(task); diff --git a/firebase-vscode/src/utils/settings.ts b/firebase-vscode/src/utils/settings.ts index a1ba94a1568..680fbdfe6b4 100644 --- a/firebase-vscode/src/utils/settings.ts +++ b/firebase-vscode/src/utils/settings.ts @@ -7,6 +7,7 @@ export interface Settings { readonly npmPath: string; readonly useFrameworks: boolean; readonly shouldShowIdxMetricNotice: boolean; + readonly debug: boolean; } // TODO: Temporary fallback for bashing, this should probably point to the global firebase binary on the system @@ -37,6 +38,7 @@ export function getSettings(): Settings { "idx.viewMetricNotice", true, ), + debug: config.get("debug", false), }; } diff --git a/src/firebaseConfigValidate.ts b/src/firebaseConfigValidate.ts index f662a6d6e66..d52b11fde31 100644 --- a/src/firebaseConfigValidate.ts +++ b/src/firebaseConfigValidate.ts @@ -31,14 +31,14 @@ export function getValidator(): ValidateFunction { export function getErrorMessage(e: ErrorObject) { if (e.keyword === "additionalProperties") { - return `Object "${e.instancePath}" in "firebase.json" has unknown property: ${JSON.stringify( + return `Object "${e.dataPath}" in "firebase.json" has unknown property: ${JSON.stringify( e.params, )}`; } else if (e.keyword === "required") { return `Object "${ - e.instancePath + e.dataPath }" in "firebase.json" is missing required property: ${JSON.stringify(e.params)}`; } else { - return `Field "${e.instancePath}" in "firebase.json" is possibly invalid: ${e.message}`; + return `Field "${e.dataPath}" in "firebase.json" is possibly invalid: ${e.message}`; } }