Allow for slash commands to opt-out of autocompletion and /help discovery. (#7847)

This commit is contained in:
DeWitt Clinton
2025-09-06 14:16:58 -07:00
committed by GitHub
parent c031f538df
commit 6b4c12eb04
8 changed files with 103 additions and 59 deletions

View File

@@ -349,36 +349,4 @@ describe('CommandService', () => {
expect(deployExtension).toBeDefined();
expect(deployExtension?.description).toBe('[gcp] Deploy to Google Cloud');
});
it('should filter out hidden commands', async () => {
const visibleCommand = createMockCommand('visible', CommandKind.BUILT_IN);
const hiddenCommand = {
...createMockCommand('hidden', CommandKind.BUILT_IN),
hidden: true,
};
const initiallyVisibleCommand = createMockCommand(
'initially-visible',
CommandKind.BUILT_IN,
);
const hiddenOverrideCommand = {
...createMockCommand('initially-visible', CommandKind.FILE),
hidden: true,
};
const mockLoader = new MockCommandLoader([
visibleCommand,
hiddenCommand,
initiallyVisibleCommand,
hiddenOverrideCommand,
]);
const service = await CommandService.create(
[mockLoader],
new AbortController().signal,
);
const commands = service.getCommands();
expect(commands).toHaveLength(1);
expect(commands[0].name).toBe('visible');
});
});

View File

@@ -85,9 +85,7 @@ export class CommandService {
});
}
const finalCommands = Object.freeze(
Array.from(commandMap.values()).filter((cmd) => !cmd.hidden),
);
const finalCommands = Object.freeze(Array.from(commandMap.values()));
return new CommandService(finalCommands);
}