window.proto 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. syntax = "proto3";
  2. package host;
  3. option go_package = "github.com/cline/grpc-go/host";
  4. option java_multiple_files = true;
  5. option java_package = "bot.cline.host.proto";
  6. // Provides methods for working with IDE windows and editors.
  7. service WindowService {
  8. // Opens a text document in the IDE editor and returns editor information.
  9. rpc showTextDocument(ShowTextDocumentRequest) returns (TextEditorInfo);
  10. // Shows the open file dialogue / file picker.
  11. rpc showOpenDialogue(ShowOpenDialogueRequest) returns (SelectedResources);
  12. // Shows a notification.
  13. rpc showMessage(ShowMessageRequest) returns (SelectedResponse);
  14. // Prompts the user for input and returns the response.
  15. rpc showInputBox(ShowInputBoxRequest) returns (ShowInputBoxResponse);
  16. // Shows the file save dialogue / file picker.
  17. rpc showSaveDialog(ShowSaveDialogRequest) returns (ShowSaveDialogResponse);
  18. // Opens a file in the IDE.
  19. rpc openFile(OpenFileRequest) returns (OpenFileResponse);
  20. // Opens the host settings UI, optionally focusing a specific query/section.
  21. rpc openSettings(OpenSettingsRequest) returns (OpenSettingsResponse);
  22. // Returns the open tabs.
  23. rpc getOpenTabs(GetOpenTabsRequest) returns (GetOpenTabsResponse);
  24. // Returns the visible tabs.
  25. rpc getVisibleTabs(GetVisibleTabsRequest) returns (GetVisibleTabsResponse);
  26. // Returns information about the current editor
  27. rpc getActiveEditor(GetActiveEditorRequest) returns (GetActiveEditorResponse);
  28. }
  29. message ShowTextDocumentRequest {
  30. string path = 2;
  31. optional ShowTextDocumentOptions options = 3;
  32. }
  33. // See https://code.visualstudio.com/api/references/vscode-api#TextDocumentShowOptions
  34. message ShowTextDocumentOptions {
  35. optional bool preview = 1;
  36. optional bool preserve_focus = 2;
  37. optional int32 view_column = 3;
  38. }
  39. message TextEditorInfo {
  40. string document_path = 1;
  41. optional int32 view_column = 2;
  42. bool is_active = 3;
  43. }
  44. message ShowOpenDialogueRequest {
  45. optional bool can_select_many = 2;
  46. optional string open_label = 3;
  47. optional ShowOpenDialogueFilterOption filters = 4;
  48. }
  49. message ShowOpenDialogueFilterOption {
  50. repeated string files = 1;
  51. }
  52. message SelectedResources {
  53. repeated string paths = 1;
  54. }
  55. enum ShowMessageType {
  56. ERROR = 0;
  57. INFORMATION = 1;
  58. WARNING = 2;
  59. }
  60. message ShowMessageRequest {
  61. ShowMessageType type = 1;
  62. string message = 2;
  63. optional ShowMessageRequestOptions options = 3;
  64. }
  65. message ShowMessageRequestOptions {
  66. repeated string items = 1;
  67. optional bool modal = 2;
  68. optional string detail = 3;
  69. }
  70. message SelectedResponse {
  71. optional string selected_option = 1;
  72. }
  73. message ShowSaveDialogRequest {
  74. optional ShowSaveDialogOptions options = 1;
  75. }
  76. message ShowSaveDialogOptions {
  77. optional string default_path = 1;
  78. // A map of file types to extensions, e.g
  79. // "Text Files": { "extensions": ["txt", "md"] }
  80. map<string, FileExtensionList> filters = 2;
  81. }
  82. message FileExtensionList {
  83. // A list of file extension (without the dot).
  84. repeated string extensions = 1;
  85. }
  86. message ShowSaveDialogResponse {
  87. // If the user cancelled the dialog, this will be empty.
  88. optional string selected_path = 1;
  89. }
  90. message ShowInputBoxRequest {
  91. string title = 1;
  92. optional string prompt = 2;
  93. optional string value = 3;
  94. }
  95. message ShowInputBoxResponse {
  96. optional string response = 1;
  97. }
  98. message OpenFileRequest {
  99. string file_path = 1;
  100. }
  101. message OpenFileResponse {}
  102. message OpenSettingsRequest {
  103. // Optional query to focus a particular settings section/key.
  104. // This value is host-specific. In VS Code, it is passed directly as the
  105. // Settings search query to the "workbench.action.openSettings" command.
  106. // Examples (VS Code, see - https://code.visualstudio.com/docs/getstarted/settings#settings-editor-filters.):
  107. // - "telemetry.telemetryLevel" → focuses the Telemetry Level setting
  108. // - "@id:telemetry.telemetryLevel" → navigates by exact setting id
  109. // - "@modified", "@ext:publisher.extension"
  110. // - Plain keywords/categories
  111. // If not provided the host opens the settings UI without specific focus.
  112. optional string query = 1;
  113. }
  114. message OpenSettingsResponse {}
  115. message GetOpenTabsRequest {}
  116. message GetOpenTabsResponse {
  117. repeated string paths = 1;
  118. }
  119. message GetVisibleTabsRequest {}
  120. message GetVisibleTabsResponse {
  121. repeated string paths = 1;
  122. }
  123. message GetActiveEditorRequest {}
  124. message GetActiveEditorResponse {
  125. optional string file_path = 1;
  126. }