Show /ide enable & /ide disable commands based on connection status (#6248)
Co-authored-by: matt korwel <matt.korwel@gmail.com>
This commit is contained in:
parent
db347eeee8
commit
a84f749310
|
@ -69,6 +69,9 @@ describe('ideCommand', () => {
|
||||||
vi.mocked(mockConfig.getIdeClient).mockReturnValue({
|
vi.mocked(mockConfig.getIdeClient).mockReturnValue({
|
||||||
getCurrentIde: () => DetectedIde.VSCode,
|
getCurrentIde: () => DetectedIde.VSCode,
|
||||||
getDetectedIdeDisplayName: () => 'VS Code',
|
getDetectedIdeDisplayName: () => 'VS Code',
|
||||||
|
getConnectionStatus: () => ({
|
||||||
|
status: core.IDEConnectionStatus.Connected,
|
||||||
|
}),
|
||||||
} as ReturnType<Config['getIdeClient']>);
|
} as ReturnType<Config['getIdeClient']>);
|
||||||
const command = ideCommand(mockConfig);
|
const command = ideCommand(mockConfig);
|
||||||
expect(command).not.toBeNull();
|
expect(command).not.toBeNull();
|
||||||
|
@ -161,7 +164,9 @@ describe('ideCommand', () => {
|
||||||
vi.mocked(mockConfig.getIdeMode).mockReturnValue(true);
|
vi.mocked(mockConfig.getIdeMode).mockReturnValue(true);
|
||||||
vi.mocked(mockConfig.getIdeClient).mockReturnValue({
|
vi.mocked(mockConfig.getIdeClient).mockReturnValue({
|
||||||
getCurrentIde: () => DetectedIde.VSCode,
|
getCurrentIde: () => DetectedIde.VSCode,
|
||||||
getConnectionStatus: vi.fn(),
|
getConnectionStatus: () => ({
|
||||||
|
status: core.IDEConnectionStatus.Disconnected,
|
||||||
|
}),
|
||||||
getDetectedIdeDisplayName: () => 'VS Code',
|
getDetectedIdeDisplayName: () => 'VS Code',
|
||||||
} as unknown as ReturnType<Config['getIdeClient']>);
|
} as unknown as ReturnType<Config['getIdeClient']>);
|
||||||
vi.mocked(core.getIdeInstaller).mockReturnValue({
|
vi.mocked(core.getIdeInstaller).mockReturnValue({
|
||||||
|
|
|
@ -237,8 +237,8 @@ export const ideCommand = (config: Config | null): SlashCommand | null => {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const ideModeEnabled = config.getIdeMode();
|
const connectionStatus = ideClient.getConnectionStatus().status;
|
||||||
if (ideModeEnabled) {
|
if (connectionStatus === IDEConnectionStatus.Connected) {
|
||||||
ideSlashCommand.subCommands = [
|
ideSlashCommand.subCommands = [
|
||||||
disableCommand,
|
disableCommand,
|
||||||
statusCommand,
|
statusCommand,
|
||||||
|
|
Loading…
Reference in New Issue