mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-07-09 17:19:02 +00:00
fix(cli): drop /effort tier autocompletion for an argument-hint placeholder (#6179)
Bare /effort now reliably opens the picker dialog instead of letting Enter auto-select the first completed tier. The tiers are surfaced as a placeholder via argumentHint ([low|medium|high|xhigh|max]) rather than as submenu-like completion entries; typing /effort <tier> still sets one directly.
This commit is contained in:
parent
39f3108a20
commit
2e669c0697
2 changed files with 10 additions and 14 deletions
|
|
@ -106,15 +106,10 @@ describe('effortCommand', () => {
|
|||
expect(res).toMatchObject({ messageType: 'error' });
|
||||
});
|
||||
|
||||
it('completes tier prefixes', async () => {
|
||||
expect(await effortCommand.completion!(context, 'hi')).toEqual(['high']);
|
||||
expect(await effortCommand.completion!(context, 'x')).toEqual(['xhigh']);
|
||||
expect(await effortCommand.completion!(context, '')).toEqual([
|
||||
'low',
|
||||
'medium',
|
||||
'high',
|
||||
'xhigh',
|
||||
'max',
|
||||
]);
|
||||
it('does not offer tier autocompletion (tiers are hinted via argumentHint)', () => {
|
||||
// No completion so bare `/effort` opens the picker instead of auto-picking
|
||||
// the first tier; `/effort <tier>` still parses in the action above.
|
||||
expect(effortCommand.completion).toBeUndefined();
|
||||
expect(effortCommand.argumentHint).toBe('[low|medium|high|xhigh|max]');
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -28,13 +28,14 @@ export const effortCommand: SlashCommand = {
|
|||
{ tiers: TIER_LIST },
|
||||
);
|
||||
},
|
||||
// The tiers show up as a placeholder via argumentHint rather than as
|
||||
// autocompletion suggestions: bare `/effort` should open the picker dialog
|
||||
// (no tier auto-selected), while `/effort <tier>` still sets one directly. A
|
||||
// completion function would surface the tiers as submenu-like entries and let
|
||||
// Enter auto-pick the first one, which we don't want here.
|
||||
argumentHint: '[low|medium|high|xhigh|max]',
|
||||
kind: CommandKind.BUILT_IN,
|
||||
supportedModes: ['interactive', 'non_interactive', 'acp'] as const,
|
||||
completion: async (_context, partialArg) => {
|
||||
const prefix = partialArg.trim().toLowerCase();
|
||||
return REASONING_EFFORT_TIERS.filter((tier) => tier.startsWith(prefix));
|
||||
},
|
||||
action: async (
|
||||
context: CommandContext,
|
||||
actionArgs: string,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue