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