Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Settings error ux #26

Merged
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
3 changes: 2 additions & 1 deletion client/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,9 @@ export async function activate (context: vscode.ExtensionContext): Promise<void>
context.subscriptions.push(bitbakeStatusBar.statusBarItem)

// Handle settings change for bitbake driver
context.subscriptions.push(vscode.workspace.onDidChangeConfiguration((event) => {
context.subscriptions.push(vscode.workspace.onDidChangeConfiguration(async (event) => {
if (event.affectsConfiguration('bitbake')) {
await clientNotificationManager.resetNeverShowAgain('custom/bitbakeSettingsError')
bitbakeDriver.loadSettings(vscode.workspace.getConfiguration('bitbake'), vscode.workspace.workspaceFolders?.[0].uri.fsPath)
logger.debug('Bitbake settings changed')
void vscode.commands.executeCommand('bitbake.rescan-project')
Expand Down
17 changes: 12 additions & 5 deletions client/src/ui/ClientNotificationManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@ export class ClientNotificationManager {
}

showBitbakeError (message?: string): void {
if (this.checkIsNeverShowAgain('custom/bitbakeSettingsError')) {
if (!this.checkIsNeverShowAgain('custom/bitbakeSettingsError')) {
void window.showErrorMessage(
'BitBake could not be configured and started. To enable advanced Bitbake features, please configure the Bitbake extension.\n\n' + message,
'BitBake could not be configured and started. To enable advanced Bitbake features, please configure the Bitbake extension.',
{ detail: message, modal: true },
'Open Settings',
'Close',
'Never Show Again'
'Don\'t show again'
)
.then((item) => {
if (item === 'Open Settings') {
void commands.executeCommand('workbench.action.openWorkspaceSettings', '@ext:yocto-project.yocto-bitbake')
} else if (item === 'Never Show Again') {
} else if (item === 'Don\'t show again') {
void this.neverShowAgain('custom/bitbakeSettingsError')
}
})
Expand All @@ -43,6 +43,13 @@ export class ClientNotificationManager {
}
return this._memento.get(`neverShowAgain/${method}`, false)
}

async resetNeverShowAgain (method: string): Promise<void> {
if (this._memento === undefined) {
throw new Error('ClientNotificationManager Memento not set')
}
await this._memento.update(`neverShowAgain/${method}`, false)
}
}

export const clientNotificationManager: ClientNotificationManager = new ClientNotificationManager()
Loading