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

fix: enable generate from context menu setting take effect immediately #1066

Merged
merged 1 commit into from
Apr 23, 2021
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 0 additions & 11 deletions apps/vscode/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,24 +231,13 @@ async function setWorkspace(workspaceJsonPath: string) {

const isNxWorkspace = existsSync(join(workspaceJsonPath, '..', 'nx.json'));
const isAngularWorkspace = workspaceJsonPath.endsWith('angular.json');
const enableGenerateFromContextMenuSetting = GlobalConfigurationStore.instance.get(
'enableGenerateFromContextMenu'
);
const isGenerateFromContextMenuEnabled =
enableGenerateFromContextMenuSetting &&
(isNxWorkspace || isAngularWorkspace);

commands.executeCommand(
'setContext',
'isAngularWorkspace',
isAngularWorkspace
);
commands.executeCommand('setContext', 'isNxWorkspace', isNxWorkspace);
commands.executeCommand(
'setContext',
'isGenerateFromContextMenuEnabled',
isGenerateFromContextMenuEnabled
);

registerWorkspaceFileWatcher(context, workspaceJsonPath);

Expand Down
2 changes: 1 addition & 1 deletion apps/vscode/src/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"menus": {
"explorer/context": [
{
"when": "isGenerateFromContextMenuEnabled",
"when": "isAngularWorkspace && config.nxConsole.enableGenerateFromContextMenu || isNxWorkspace && config.nxConsole.enableGenerateFromContextMenu",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doesn't support parens with the || and &&, so the condition is a bit long

"command": "nx.generate.ui.fileexplorer",
"group": "explorerContext"
}
Expand Down