| 1 | --- |
| 2 | name: New protocol message |
| 3 | description: Create a new protocol message from core/gui/ide to core/gui/ide |
| 4 | --- |
| 5 | |
| 6 | Create a new protocol message by taking the following steps: |
| 7 | |
| 8 | ## 1. Define the message type |
| 9 | |
| 10 | Add your new message type definition to the appropriate file in the `protocol/` directory with correct TypeScript typing. |
| 11 | |
| 12 | ## 2. Check for duplicates |
| 13 | |
| 14 | Verify that no existing message type already provides the same functionality. |
| 15 | |
| 16 | ## 3. Add to passThrough (if webview ↔ core) |
| 17 | |
| 18 | If your message is between webview and core, add it to `core/protocol/passThrough.ts`. |
| 19 | |
| 20 | ## 4. Add to IntelliJ constants (if webview ↔ core) |
| 21 | |
| 22 | If your message is between webview and core, add it to `extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/constants/MessageTypes.kt`. |
| 23 | |
| 24 | ## 5. Implement the message handler |
| 25 | |
| 26 | Implement the message in the appropriate location: |
| 27 | |
| 28 | - **Messages to core**: `core/core.ts` |
| 29 | - **Messages to GUI**: `useWebviewListener` hook |
| 30 | - **Messages to VS Code IDE**: `VsCodeMessenger.ts` |
| 31 | - **Messages to JetBrains IDE**: `IdeProtocolClient.kt` |
| 32 | |
| 33 | ## 6. Test the implementation |
| 34 | |
| 35 | Verify that your message works correctly in both VS Code and JetBrains IDEs if applicable. |