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

Theme suggestion dialog should not offer workspace option when no workspace is open #117

Closed
gjsjohnmurray opened this issue Jan 19, 2021 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@gjsjohnmurray
Copy link
Collaborator

Start a new VS Code window that doesn't use an InterSystems theme. Open a file (not a folder or a workspace). Set the file's language mode to ObjectScript. Dialog proposing the InterSystems theme includes "Only This Workspace" option. That's not applicable in this situation.

Code pointer:

// Suggest an InterSystems default theme depending on the current active theme type
if (window.activeColorTheme.kind === ColorThemeKind.Light) {
const answer = await window.showInformationMessage(
`For the best user experience, InterSystems recommends that you activate the default light theme included with the [InterSystems Language Server extension](https://marketplace.visualstudio.com/items?itemName=intersystems.language-server). Activate now?`,
"Globally",
"Only This Workspace",
"Don't Ask Again"
);
if (answer === "Globally") {
workspace.getConfiguration("workbench").update("colorTheme","InterSystems Default Light",true);
}
else if (answer === "Only This Workspace") {
workspace.getConfiguration("workbench").update("colorTheme","InterSystems Default Light",false);
}
else if (answer === "Don't Ask Again") {

@isc-bsaviano isc-bsaviano added the bug Something isn't working label Jan 19, 2021
@isc-bsaviano isc-bsaviano self-assigned this Jan 19, 2021
@isc-bsaviano
Copy link
Contributor

@gjsjohnmurray What's the best way to test if a workspace is open? workspace.name !== undefined?

@gjsjohnmurray
Copy link
Collaborator Author

Indeed, the spec at https://code.visualstudio.com/api/references/vscode-api#workspace says of workspace.name

The name of the workspace. undefined when no folder has been opened.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants