Skip to content

Commit

Permalink
fix new project feature flagging (#2611)
Browse files Browse the repository at this point in the history
* fix feature flagging of New Project feature

The feature flag was only disabling the menu item in File > New Project,
New > New Project, and via the Command Palette, but not in
customFolderMenu > New Project. It may be confusing to users why the
option is greyed out, so I've tried to remove the New Project option
from the relevant menus except when in a development context. The exception
is the File > New Project action, which I can only disable (greyed out)
and haven't figured out how to remove the option entirely.

* describe where the New Project action is being disabled

This also includes disabling the New Project action in the app action
bar within the File menu.

* simplify conditional rendering of New Project custom folder menu item
  • Loading branch information
sharon-wang authored Apr 3, 2024
1 parent f943fb9 commit af3037f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
8 changes: 6 additions & 2 deletions src/vs/workbench/browser/actions/positronActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,16 @@ export class PositronNewProjectAction extends Action2 {
},
category: workspacesCategory,
f1: true,
// TODO: remove feature flag IsDevelopmentContext when the feature is ready
precondition: ContextKeyExpr.and(EnterMultiRootWorkspaceSupportContext, IsDevelopmentContext),
// TODO: [New Project] Remove feature flag when New Project action is ready for release
// This disables (greys out) the action in the New menu, the application bar File menu, and the command palette when not in a development context
precondition: ContextKeyExpr.and(EnterMultiRootWorkspaceSupportContext, IsDevelopmentContext.isEqualTo(true)),
menu: {
id: MenuId.MenubarFileMenu,
group: '1_newfolder',
order: 3,
// TODO: [New Project] Remove feature flag when New Project action is ready for release
// This removes the action from the application bar File menu when not in a development context
when: IsDevelopmentContext.isEqualTo(true)
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { IAction, Separator } from 'vs/base/common/actions';
import { ActionBarMenuButton } from 'vs/platform/positronActionBar/browser/components/actionBarMenuButton';
import { usePositronActionBarContext } from 'vs/platform/positronActionBar/browser/positronActionBarContext';
import { PositronNewFolderAction, PositronNewFolderFromGitAction, PositronNewProjectAction } from 'vs/workbench/browser/actions/positronActions';
import { IsDevelopmentContext } from 'vs/platform/contextkey/common/contextkeys';

/**
* Localized strings.
Expand All @@ -33,9 +34,13 @@ export const TopActionBarNewMenu = () => {
label: positronNewFile
});
actions.push(new Separator());
positronActionBarContext.appendCommandAction(actions, {
id: PositronNewProjectAction.ID
});
// TODO: [New Project] Remove feature flag when New Project action is ready for release
// This removes the action from the New menu in the action bar when not in a development context
if (IsDevelopmentContext.getValue(positronActionBarContext.contextKeyService) === true) {
positronActionBarContext.appendCommandAction(actions, {
id: PositronNewProjectAction.ID
});
}
positronActionBarContext.appendCommandAction(actions, {
id: PositronNewFolderAction.ID
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { CustomFolderMenuItem } from 'vs/workbench/browser/parts/positronTopActi
import { CustomFolderMenuSeparator } from 'vs/workbench/browser/parts/positronTopActionBar/customFolderModalPopup/customFolderMenuSeparator';
import { CustomFolderRecentlyUsedMenuItem } from 'vs/workbench/browser/parts/positronTopActionBar/customFolderModalPopup/customFolderRecentlyUsedMenuItem';
import { PositronNewFolderAction, PositronNewFolderFromGitAction, PositronNewProjectAction, PositronOpenFolderInNewWindowAction } from 'vs/workbench/browser/actions/positronActions';
import { IsDevelopmentContext } from 'vs/platform/contextkey/common/contextkeys';

/**
* Constants.
Expand Down Expand Up @@ -142,10 +143,14 @@ export const CustomFolderMenuItems = (props: CustomFolderMenuItemsProps) => {
);
};

const isDevContext = IsDevelopmentContext.getValue(props.contextKeyService) === true;

// Render.
return (
<div className='custom-folder-menu-items'>
<CommandActionCustomFolderMenuItem id={PositronNewProjectAction.ID} />
{/* TODO: [New Project] Remove feature flag when New Project action is ready for release */}
{/* This removes the action from the custom folder menu in the action bar when when not in a development context */}
{isDevContext && <CommandActionCustomFolderMenuItem id={PositronNewProjectAction.ID} />}
<CommandActionCustomFolderMenuItem id={PositronNewFolderAction.ID} />
<CommandActionCustomFolderMenuItem id={PositronNewFolderFromGitAction.ID} />
<CustomFolderMenuSeparator />
Expand Down

0 comments on commit af3037f

Please sign in to comment.