diff --git a/client/src/ui/ClientNotificationManager.ts b/client/src/ui/ClientNotificationManager.ts index eefccf18..b135ab73 100644 --- a/client/src/ui/ClientNotificationManager.ts +++ b/client/src/ui/ClientNotificationManager.ts @@ -17,29 +17,29 @@ export class ClientNotificationManager { buildHandlers (): Disposable[] { const handlers = [ - this.buildBitBakeNotFoundHandler() + this.bitBakeSettingsErrorHandler() ] return handlers } - private buildBitBakeNotFoundHandler (): Disposable { - const isNeverShowAgain = this.checkIsNeverShowAgain('custom/bitBakeNotFound') + private bitBakeSettingsErrorHandler (): Disposable { + const isNeverShowAgain = this.checkIsNeverShowAgain('custom/bitbakeSettingsError') if (isNeverShowAgain) { return { dispose: () => {} } } - return this._client.onNotification('custom/bitBakeNotFound', () => { + return this._client.onNotification('custom/bitbakeSettingsError', (message?: string) => { void window.showErrorMessage( - 'BitBake folder could not be found. Please set its path in the settings. Optionally, also set an environment script.', + 'BitBake could not be configured and started. To enable advanced Bitbake features, please configure the Bitbake extension.\n\n' + message, 'Open Settings', 'Close', 'Never Show Again' ) .then((item) => { if (item === 'Open Settings') { - void commands.executeCommand('workbench.action.openSettings', 'bitbake') + void commands.executeCommand('workbench.action.openWorkspaceSettings', '@ext:savoirfairelinux.bitbake') } else if (item === 'Never Show Again') { - void this.neverShowAgain('custom/bitBakeNotFound') + void this.neverShowAgain('custom/bitbakeSettingsError') } }) }) diff --git a/server/src/ServerNotificationManager.ts b/server/src/ServerNotificationManager.ts index 74bab7fc..0e981485 100644 --- a/server/src/ServerNotificationManager.ts +++ b/server/src/ServerNotificationManager.ts @@ -15,7 +15,7 @@ export function setNotificationManagerConnection (connection: Connection): void } export type NotificationType = - 'custom/bitBakeNotFound' + 'custom/bitbakeSettingsError' class ServerNotificationManager { send (type: NotificationType, message?: string): void { @@ -27,8 +27,8 @@ class ServerNotificationManager { void _connection.sendNotification(type, message) } - sendBitBakeNotFound (): void { - this.send('custom/bitBakeNotFound') + sendBitBakeSettingsError (message?: string): void { + this.send('custom/bitbakeSettingsError', message) } } diff --git a/server/src/server.ts b/server/src/server.ts index 993de33e..a587bd10 100644 --- a/server/src/server.ts +++ b/server/src/server.ts @@ -67,21 +67,30 @@ function setSymbolScanner (newSymbolScanner: SymbolScanner | null): void { contextHandler.symbolScanner = newSymbolScanner } -function checkBitbakePresence (): void { +function checkBitbakeSettingsSanity (): boolean { const bitbakeFolder = bitBakeProjectScanner.bitbakeDriver.bitbakeSettings.pathToBitbakeFolder const bitbakeBinPath = bitbakeFolder + '/bin/bitbake' if (!fs.existsSync(bitbakeBinPath)) { - serverNotificationManager.sendBitBakeNotFound() + serverNotificationManager.sendBitBakeSettingsError("Bitbake binary doesn't exist: " + bitbakeBinPath) + return false } + + const pathToEnvScript = bitBakeProjectScanner.bitbakeDriver.bitbakeSettings.pathToEnvScript + if (!fs.existsSync(pathToEnvScript)) { + serverNotificationManager.sendBitBakeSettingsError("Bitbake environment script doesn't exist: " + pathToEnvScript) + return false + } + + return true } connection.onDidChangeConfiguration((change) => { logger.level = change.settings.bitbake.loggingLevel bitBakeProjectScanner.loadSettings(change.settings.bitbake, workspaceRoot) + checkBitbakeSettingsSanity() bitBakeDocScanner.parseVariablesFile(bitBakeProjectScanner.bitbakeDriver.bitbakeSettings.pathToBitbakeFolder) bitBakeDocScanner.parseVariableFlagFile(bitBakeProjectScanner.bitbakeDriver.bitbakeSettings.pathToBitbakeFolder) - checkBitbakePresence() bitBakeProjectScanner.rescanProject() })