(ideClient: IdeClient)
| 81 | } |
| 82 | |
| 83 | async function getIdeStatusMessageWithFiles(ideClient: IdeClient): Promise<{ |
| 84 | messageType: 'info' | 'error'; |
| 85 | content: string; |
| 86 | }> { |
| 87 | const connection = ideClient.getConnectionStatus(); |
| 88 | switch (connection.status) { |
| 89 | case IDEConnectionStatus.Connected: { |
| 90 | let content = `🟢 Connected to ${ideClient.getDetectedIdeDisplayName()}`; |
| 91 | const context = ideContext.getIdeContext(); |
| 92 | const openFiles = context?.workspaceState?.openFiles; |
| 93 | if (openFiles && openFiles.length > 0) { |
| 94 | content += formatFileList(openFiles); |
| 95 | } |
| 96 | return { |
| 97 | messageType: 'info', |
| 98 | content, |
| 99 | }; |
| 100 | } |
| 101 | case IDEConnectionStatus.Connecting: |
| 102 | return { |
| 103 | messageType: 'info', |
| 104 | content: `🟡 Connecting...`, |
| 105 | }; |
| 106 | default: { |
| 107 | let content = `🔴 Disconnected`; |
| 108 | if (connection?.details) { |
| 109 | content += `: ${connection.details}`; |
| 110 | } |
| 111 | return { |
| 112 | messageType: 'error', |
| 113 | content, |
| 114 | }; |
| 115 | } |
| 116 | } |
| 117 | } |
| 118 | |
| 119 | export const ideCommand = (config: Config | null): SlashCommand | null => { |
| 120 | if (!config) { |
no test coverage detected