-
Notifications
You must be signed in to change notification settings - Fork 2.6k
feat: add scope indicators (Global/Project) to mode selector and editor #8241
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
Conversation
- Add visual badges showing 'Global' or 'Project' scope for custom modes - Display scope in mode selector dropdown items - Display scope in currently selected mode button - Display scope in modes editor view - Use existing translations from common.json Fixes #8238
- Update translation references from common:scope to common:customModes.scope - Ensures proper localization of Global/Project labels
| {selectedMode?.source && ( | ||
| <span className="text-[10px] px-1 py-0.5 rounded bg-vscode-badge-background text-vscode-badge-foreground"> | ||
| {selectedMode.source === "project" | ||
| ? t("common:customModes.scope.project") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent translation keys: the selected mode display uses t('common:customModes.scope.project/global') while the dropdown item uses t('common:scope.project/global'). Please unify these so the same key set is used throughout.
This comment was generated because it violated a code review rule: irule_C0ez7Rji6ANcGkkX.
| {getCurrentMode()?.source && ( | ||
| <span className="text-[10px] px-1 py-0.5 rounded bg-vscode-badge-background text-vscode-badge-foreground"> | ||
| {getCurrentMode()?.source === "project" | ||
| ? t("common:scope.project") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In ModesView the scope badge translation keys are inconsistent. For example, the current mode badge uses t('common:scope.project/global') (line 626) while later the custom mode header uses t('common:customModes.scope.project/global'). Consider using a single pair of keys for consistency.
This comment was generated because it violated a code review rule: irule_C0ez7Rji6ANcGkkX.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewing my own code is like proofreading my own emails - I always find the typos after hitting send.
| {isCustomMode && ( | ||
| <span className="text-[10px] px-1 py-0.5 rounded bg-vscode-badge-background text-vscode-badge-foreground"> | ||
| {mode.source === "project" | ||
| ? t("common:scope.project") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Critical Issue: These translation keys common:scope.project and common:scope.global don't exist in the translation files. The PR description mentions using common:customModes.scope but these are different keys. This will cause missing translation errors.
Suggested fix:
{mode.source === "project"
? t("common:customModes.scope.project")
: t("common:customModes.scope.global")}| )}> | ||
| <span className="truncate">{selectedMode?.name || ""}</span> | ||
| {selectedMode?.source && ( | ||
| <span className="text-[10px] px-1 py-0.5 rounded bg-vscode-badge-background text-vscode-badge-foreground"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: Consider extracting this repeated badge markup into a reusable component to reduce duplication across the 6 instances in this PR:
const ScopeBadge = ({ source }: { source?: string }) => {
if (!source) return null;
return (
<span className="text-[10px] px-1 py-0.5 rounded bg-vscode-badge-background text-vscode-badge-foreground">
{source === "project"
? t("common:customModes.scope.project")
: t("common:customModes.scope.global")}
</span>
);
};| )}> | ||
| <span className="truncate">{selectedMode?.name || ""}</span> | ||
| {selectedMode?.source && ( | ||
| <span className="text-[10px] px-1 py-0.5 rounded bg-vscode-badge-background text-vscode-badge-foreground"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Accessibility: Consider adding an aria-label or title attribute to help screen reader users understand what these scope indicators mean:
<span
className="text-[10px] px-1 py-0.5 rounded bg-vscode-badge-background text-vscode-badge-foreground"
aria-label={`Scope: ${selectedMode.source === "project" ? "Project-level mode" : "Global mode"}`}
>| <span className="truncate"> | ||
| {getCurrentMode()?.name || t("prompts:modes.selectMode")} | ||
| </span> | ||
| {getCurrentMode()?.source && ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Type Safety: The optional chaining here is good, but consider being more explicit about when the badge should show. Built-in modes don't have a source property, so this correctly hides the badge for them. However, a comment explaining this intentional behavior would help future maintainers.
Summary
This PR attempts to address Issue #8238 by adding visual scope indicators to help users distinguish between global and project-level custom modes.
Changes
common:customModes.scopefor localization supportVisual Changes
The implementation adds small, unobtrusive badges next to custom mode names showing:
.roomodes)These indicators appear in:
Testing
Notes
Fixes #8238
Feedback and guidance are welcome!
Important
Add scope indicators to custom modes in
ModeSelector.tsxandModesView.tsx, distinguishing between global and project-level modes.ModeSelector.tsxandModesView.tsx.common:customModes.scopefor localization..roomodesand "global" for modes in user settings.This description was created by
for 2e10c13. You can customize this summary. It will automatically update as commits are pushed.