1syntax = "proto3";
2package zed.messages;
3
4import "core.proto";
5import "worktree.proto";
6import "buffer.proto";
7
8message GetDefinition {
9 uint64 project_id = 1;
10 uint64 buffer_id = 2;
11 Anchor position = 3;
12 repeated VectorClockEntry version = 4;
13}
14
15message GetDefinitionResponse {
16 repeated LocationLink links = 1;
17}
18
19message GetDeclaration {
20 uint64 project_id = 1;
21 uint64 buffer_id = 2;
22 Anchor position = 3;
23 repeated VectorClockEntry version = 4;
24}
25
26message GetDeclarationResponse {
27 repeated LocationLink links = 1;
28}
29
30message GetTypeDefinition {
31 uint64 project_id = 1;
32 uint64 buffer_id = 2;
33 Anchor position = 3;
34 repeated VectorClockEntry version = 4;
35 }
36
37message GetTypeDefinitionResponse {
38 repeated LocationLink links = 1;
39}
40message GetImplementation {
41 uint64 project_id = 1;
42 uint64 buffer_id = 2;
43 Anchor position = 3;
44 repeated VectorClockEntry version = 4;
45 }
46
47message GetImplementationResponse {
48 repeated LocationLink links = 1;
49}
50
51message GetReferences {
52 uint64 project_id = 1;
53 uint64 buffer_id = 2;
54 Anchor position = 3;
55 repeated VectorClockEntry version = 4;
56 }
57
58message GetReferencesResponse {
59 repeated Location locations = 1;
60}
61
62message GetDocumentHighlights {
63 uint64 project_id = 1;
64 uint64 buffer_id = 2;
65 Anchor position = 3;
66 repeated VectorClockEntry version = 4;
67 }
68
69message GetDocumentHighlightsResponse {
70 repeated DocumentHighlight highlights = 1;
71}
72
73message LocationLink {
74 optional Location origin = 1;
75 Location target = 2;
76}
77
78message DocumentHighlight {
79 Kind kind = 1;
80 Anchor start = 2;
81 Anchor end = 3;
82
83 enum Kind {
84 Text = 0;
85 Read = 1;
86 Write = 2;
87 }
88}
89
90message GetProjectSymbols {
91 uint64 project_id = 1;
92 string query = 2;
93}
94
95message GetProjectSymbolsResponse {
96 repeated Symbol symbols = 4;
97}
98
99message Symbol {
100 uint64 source_worktree_id = 1;
101 uint64 worktree_id = 2;
102 string language_server_name = 3;
103 string name = 4;
104 int32 kind = 5;
105 string path = 6;
106 // Cannot use generate anchors for unopened files,
107 // so we are forced to use point coords instead
108 PointUtf16 start = 7;
109 PointUtf16 end = 8;
110 bytes signature = 9;
111 uint64 language_server_id = 10;
112}
113
114message GetDocumentSymbols {
115 uint64 project_id = 1;
116 uint64 buffer_id = 2;
117 repeated VectorClockEntry version = 3;
118}
119
120message GetDocumentSymbolsResponse {
121 repeated DocumentSymbol symbols = 1;
122}
123
124message DocumentSymbol {
125 string name = 1;
126 int32 kind = 2;
127 // Cannot use generate anchors for unopened files,
128 // so we are forced to use point coords instead
129 PointUtf16 start = 3;
130 PointUtf16 end = 4;
131 PointUtf16 selection_start = 5;
132 PointUtf16 selection_end = 6;
133 repeated DocumentSymbol children = 7;
134}
135
136message InlayHints {
137 uint64 project_id = 1;
138 uint64 buffer_id = 2;
139 Anchor start = 3;
140 Anchor end = 4;
141 repeated VectorClockEntry version = 5;
142}
143
144message InlayHintsResponse {
145 repeated InlayHint hints = 1;
146 repeated VectorClockEntry version = 2;
147}
148
149message PointUtf16 {
150 uint32 row = 1;
151 uint32 column = 2;
152}
153
154message LspExtExpandMacro {
155 uint64 project_id = 1;
156 uint64 buffer_id = 2;
157 Anchor position = 3;
158}
159
160message LspExtExpandMacroResponse {
161 string name = 1;
162 string expansion = 2;
163}
164
165message LspExtOpenDocs {
166 uint64 project_id = 1;
167 uint64 buffer_id = 2;
168 Anchor position = 3;
169}
170
171message LspExtOpenDocsResponse {
172 optional string web = 1;
173 optional string local = 2;
174}
175
176message LspExtSwitchSourceHeader {
177 uint64 project_id = 1;
178 uint64 buffer_id = 2;
179}
180
181message LspExtSwitchSourceHeaderResponse {
182 string target_file = 1;
183}
184
185message LspExtGoToParentModule {
186 uint64 project_id = 1;
187 uint64 buffer_id = 2;
188 Anchor position = 3;
189}
190
191message LspExtGoToParentModuleResponse {
192 repeated LocationLink links = 1;
193}
194
195message GetCompletionsResponse {
196 repeated Completion completions = 1;
197 repeated VectorClockEntry version = 2;
198 // `!is_complete`, inverted for a default of `is_complete = true`
199 bool can_reuse = 3;
200}
201
202message ApplyCompletionAdditionalEdits {
203 uint64 project_id = 1;
204 uint64 buffer_id = 2;
205 Completion completion = 3;
206}
207
208message ApplyCompletionAdditionalEditsResponse {
209 Transaction transaction = 1;
210}
211
212message Completion {
213 Anchor old_replace_start = 1;
214 Anchor old_replace_end = 2;
215 string new_text = 3;
216 uint64 server_id = 4;
217 bytes lsp_completion = 5;
218 bool resolved = 6;
219 Source source = 7;
220 optional bytes lsp_defaults = 8;
221 optional Anchor buffer_word_start = 9;
222 optional Anchor buffer_word_end = 10;
223 Anchor old_insert_start = 11;
224 Anchor old_insert_end = 12;
225 optional string sort_text = 13;
226
227 enum Source {
228 Lsp = 0;
229 Custom = 1;
230 BufferWord = 2;
231 Dap = 3;
232 }
233}
234
235message GetCodeActions {
236 uint64 project_id = 1;
237 uint64 buffer_id = 2;
238 Anchor start = 3;
239 Anchor end = 4;
240 repeated VectorClockEntry version = 5;
241}
242
243message GetCodeActionsResponse {
244 repeated CodeAction actions = 1;
245 repeated VectorClockEntry version = 2;
246}
247
248message GetSignatureHelp {
249 uint64 project_id = 1;
250 uint64 buffer_id = 2;
251 Anchor position = 3;
252 repeated VectorClockEntry version = 4;
253}
254
255message GetSignatureHelpResponse {
256 optional SignatureHelp signature_help = 1;
257}
258
259message SignatureHelp {
260 repeated SignatureInformation signatures = 1;
261 optional uint32 active_signature = 2;
262 optional uint32 active_parameter = 3;
263}
264
265message SignatureInformation {
266 string label = 1;
267 optional Documentation documentation = 2;
268 repeated ParameterInformation parameters = 3;
269 optional uint32 active_parameter = 4;
270}
271
272message Documentation {
273 oneof content {
274 string value = 1;
275 MarkupContent markup_content = 2;
276 }
277}
278
279enum MarkupKind {
280 PlainText = 0;
281 Markdown = 1;
282}
283
284message ParameterInformation {
285 oneof label {
286 string simple = 1;
287 LabelOffsets label_offsets = 2;
288 }
289 optional Documentation documentation = 3;
290}
291
292message LabelOffsets {
293 uint32 start = 1;
294 uint32 end = 2;
295}
296
297message GetHover {
298 uint64 project_id = 1;
299 uint64 buffer_id = 2;
300 Anchor position = 3;
301 repeated VectorClockEntry version = 5;
302}
303
304message GetHoverResponse {
305 optional Anchor start = 1;
306 optional Anchor end = 2;
307 repeated HoverBlock contents = 3;
308}
309
310message HoverBlock {
311 string text = 1;
312 optional string language = 2;
313 bool is_markdown = 3;
314}
315
316message ApplyCodeAction {
317 uint64 project_id = 1;
318 uint64 buffer_id = 2;
319 CodeAction action = 3;
320}
321
322message ApplyCodeActionResponse {
323 ProjectTransaction transaction = 1;
324}
325
326message PrepareRename {
327 uint64 project_id = 1;
328 uint64 buffer_id = 2;
329 Anchor position = 3;
330 repeated VectorClockEntry version = 4;
331}
332
333message PrepareRenameResponse {
334 bool can_rename = 1;
335 Anchor start = 2;
336 Anchor end = 3;
337 repeated VectorClockEntry version = 4;
338 bool only_unprepared_rename_supported = 5;
339}
340
341message PerformRename {
342 uint64 project_id = 1;
343 uint64 buffer_id = 2;
344 Anchor position = 3;
345 string new_name = 4;
346 repeated VectorClockEntry version = 5;
347}
348
349message OnTypeFormatting {
350 uint64 project_id = 1;
351 uint64 buffer_id = 2;
352 Anchor position = 3;
353 string trigger = 4;
354 repeated VectorClockEntry version = 5;
355}
356
357message OnTypeFormattingResponse {
358 Transaction transaction = 1;
359}
360
361
362message LinkedEditingRange {
363 uint64 project_id = 1;
364 uint64 buffer_id = 2;
365 Anchor position = 3;
366 repeated VectorClockEntry version = 4;
367}
368
369message LinkedEditingRangeResponse {
370 repeated AnchorRange items = 1;
371 repeated VectorClockEntry version = 4;
372}
373
374message InlayHint {
375 Anchor position = 1;
376 InlayHintLabel label = 2;
377 optional string kind = 3;
378 bool padding_left = 4;
379 bool padding_right = 5;
380 InlayHintTooltip tooltip = 6;
381 ResolveState resolve_state = 7;
382}
383
384message InlayHintLabel {
385 oneof label {
386 string value = 1;
387 InlayHintLabelParts label_parts = 2;
388 }
389}
390
391message InlayHintLabelParts {
392 repeated InlayHintLabelPart parts = 1;
393}
394
395message InlayHintLabelPart {
396 string value = 1;
397 InlayHintLabelPartTooltip tooltip = 2;
398 optional string location_url = 3;
399 PointUtf16 location_range_start = 4;
400 PointUtf16 location_range_end = 5;
401 optional uint64 language_server_id = 6;
402}
403
404message InlayHintTooltip {
405 oneof content {
406 string value = 1;
407 MarkupContent markup_content = 2;
408 }
409}
410
411message InlayHintLabelPartTooltip {
412 oneof content {
413 string value = 1;
414 MarkupContent markup_content = 2;
415 }
416}
417
418message ResolveState {
419 State state = 1;
420 LspResolveState lsp_resolve_state = 2;
421
422 enum State {
423 Resolved = 0;
424 CanResolve = 1;
425 Resolving = 2;
426 }
427
428 message LspResolveState {
429 optional string value = 1;
430 uint64 server_id = 2;
431 }
432}
433
434// This type is used to resolve more than just
435// the documentation, but for backwards-compatibility
436// reasons we can't rename the type.
437message ResolveCompletionDocumentation {
438 uint64 project_id = 1;
439 uint64 language_server_id = 2;
440 bytes lsp_completion = 3;
441 uint64 buffer_id = 4;
442}
443
444message ResolveCompletionDocumentationResponse {
445 string documentation = 1;
446 bool documentation_is_markdown = 2;
447 Anchor old_replace_start = 3;
448 Anchor old_replace_end = 4;
449 string new_text = 5;
450 bytes lsp_completion = 6;
451 Anchor old_insert_start = 7;
452 Anchor old_insert_end = 8;
453}
454
455message ResolveInlayHint {
456 uint64 project_id = 1;
457 uint64 buffer_id = 2;
458 uint64 language_server_id = 3;
459 InlayHint hint = 4;
460}
461
462message ResolveInlayHintResponse {
463 InlayHint hint = 1;
464}
465
466message RefreshInlayHints {
467 uint64 project_id = 1;
468}
469
470message CodeLens {
471 bytes lsp_lens = 1;
472}
473
474message GetCodeLens {
475 uint64 project_id = 1;
476 uint64 buffer_id = 2;
477 repeated VectorClockEntry version = 3;
478}
479
480message GetCodeLensResponse {
481 repeated CodeAction lens_actions = 1;
482 repeated VectorClockEntry version = 2;
483}
484
485message RefreshCodeLens {
486 uint64 project_id = 1;
487}
488
489message MarkupContent {
490 bool is_markdown = 1;
491 string value = 2;
492}
493
494message PerformRenameResponse {
495 ProjectTransaction transaction = 2;
496}
497
498message CodeAction {
499 uint64 server_id = 1;
500 Anchor start = 2;
501 Anchor end = 3;
502 bytes lsp_action = 4;
503 Kind kind = 5;
504 bool resolved = 6;
505 enum Kind {
506 Action = 0;
507 Command = 1;
508 CodeLens = 2;
509 }
510}
511
512message LanguageServer {
513 uint64 id = 1;
514 string name = 2;
515 optional uint64 worktree_id = 3;
516}
517
518message StartLanguageServer {
519 uint64 project_id = 1;
520 LanguageServer server = 2;
521}
522
523message UpdateDiagnosticSummary {
524 uint64 project_id = 1;
525 uint64 worktree_id = 2;
526 DiagnosticSummary summary = 3;
527}
528
529message DiagnosticSummary {
530 string path = 1;
531 uint64 language_server_id = 2;
532 uint32 error_count = 3;
533 uint32 warning_count = 4;
534}
535
536message UpdateLanguageServer {
537 uint64 project_id = 1;
538 uint64 language_server_id = 2;
539 optional string server_name = 8;
540 oneof variant {
541 LspWorkStart work_start = 3;
542 LspWorkProgress work_progress = 4;
543 LspWorkEnd work_end = 5;
544 LspDiskBasedDiagnosticsUpdating disk_based_diagnostics_updating = 6;
545 LspDiskBasedDiagnosticsUpdated disk_based_diagnostics_updated = 7;
546 StatusUpdate status_update = 9;
547 RegisteredForBuffer registered_for_buffer = 10;
548 }
549}
550
551message LspWorkStart {
552 string token = 1;
553 optional string title = 4;
554 optional string message = 2;
555 optional uint32 percentage = 3;
556 optional bool is_cancellable = 5;
557}
558
559message LspWorkProgress {
560 string token = 1;
561 optional string message = 2;
562 optional uint32 percentage = 3;
563 optional bool is_cancellable = 4;
564}
565
566message LspWorkEnd {
567 string token = 1;
568}
569
570message LspDiskBasedDiagnosticsUpdating {}
571
572message LspDiskBasedDiagnosticsUpdated {}
573
574message StatusUpdate {
575 optional string message = 1;
576 oneof status {
577 ServerBinaryStatus binary = 2;
578 ServerHealth health = 3;
579 }
580}
581
582enum ServerHealth {
583 OK = 0;
584 WARNING = 1;
585 ERROR = 2;
586}
587
588enum ServerBinaryStatus {
589 NONE = 0;
590 CHECKING_FOR_UPDATE = 1;
591 DOWNLOADING = 2;
592 STARTING = 3;
593 STOPPING = 4;
594 STOPPED = 5;
595 FAILED = 6;
596}
597
598message RegisteredForBuffer {
599 string buffer_abs_path = 1;
600}
601
602message LanguageServerLog {
603 uint64 project_id = 1;
604 uint64 language_server_id = 2;
605 oneof log_type {
606 uint32 log_message_type = 3;
607 LspLogTrace log_trace = 4;
608 }
609 string message = 5;
610}
611
612message LspLogTrace {
613 optional string message = 1;
614}
615
616message ApplyCodeActionKind {
617 uint64 project_id = 1;
618 string kind = 2;
619 repeated uint64 buffer_ids = 3;
620}
621
622message ApplyCodeActionKindResponse {
623 ProjectTransaction transaction = 1;
624}
625
626message RegisterBufferWithLanguageServers {
627 uint64 project_id = 1;
628 uint64 buffer_id = 2;
629 repeated LanguageServerSelector only_servers = 3;
630}
631
632enum FormatTrigger {
633 Save = 0;
634 Manual = 1;
635}
636
637message OpenBufferForSymbol {
638 uint64 project_id = 1;
639 Symbol symbol = 2;
640}
641
642message OpenBufferForSymbolResponse {
643 uint64 buffer_id = 1;
644}
645
646message FormatBuffers {
647 uint64 project_id = 1;
648 FormatTrigger trigger = 2;
649 repeated uint64 buffer_ids = 3;
650}
651
652message FormatBuffersResponse {
653 ProjectTransaction transaction = 1;
654}
655
656message GetCompletions {
657 uint64 project_id = 1;
658 uint64 buffer_id = 2;
659 Anchor position = 3;
660 repeated VectorClockEntry version = 4;
661}
662
663message CancelLanguageServerWork {
664 uint64 project_id = 1;
665
666 oneof work {
667 Buffers buffers = 2;
668 LanguageServerWork language_server_work = 3;
669 }
670
671 message Buffers {
672 repeated uint64 buffer_ids = 2;
673 }
674
675 message LanguageServerWork {
676 uint64 language_server_id = 1;
677 optional string token = 2;
678 }
679}
680
681message LanguageServerPromptRequest {
682 uint64 project_id = 1;
683
684 oneof level {
685 Info info = 2;
686 Warning warning = 3;
687 Critical critical = 4;
688 }
689
690 message Info {}
691 message Warning {}
692 message Critical {}
693
694 string message = 5;
695 repeated string actions = 6;
696 string lsp_name = 7;
697}
698
699message LanguageServerPromptResponse {
700 optional uint64 action_response = 1;
701}
702
703message GetDocumentColor {
704 uint64 project_id = 1;
705 uint64 buffer_id = 2;
706 repeated VectorClockEntry version = 3;
707
708}
709
710message GetDocumentColorResponse {
711 repeated ColorInformation colors = 1;
712 repeated VectorClockEntry version = 2;
713
714}
715
716message ColorInformation {
717 PointUtf16 lsp_range_start = 1;
718 PointUtf16 lsp_range_end = 2;
719 float red = 3;
720 float green = 4;
721 float blue = 5;
722 float alpha = 6;
723}
724
725message GetColorPresentation {
726 uint64 project_id = 1;
727 uint64 buffer_id = 2;
728 ColorInformation color = 3;
729 uint64 server_id = 4;
730}
731
732message GetColorPresentationResponse {
733 repeated ColorPresentation presentations = 1;
734}
735
736message ColorPresentation {
737 string label = 1;
738 optional TextEdit text_edit = 2;
739 repeated TextEdit additional_text_edits = 3;
740}
741
742message TextEdit {
743 string new_text = 1;
744 PointUtf16 lsp_range_start = 2;
745 PointUtf16 lsp_range_end = 3;
746}
747
748message MultiLspQuery {
749 uint64 project_id = 1;
750 uint64 buffer_id = 2;
751 repeated VectorClockEntry version = 3;
752 oneof strategy {
753 AllLanguageServers all = 4;
754 }
755 oneof request {
756 GetHover get_hover = 5;
757 GetCodeActions get_code_actions = 6;
758 GetSignatureHelp get_signature_help = 7;
759 GetCodeLens get_code_lens = 8;
760 GetDocumentDiagnostics get_document_diagnostics = 9;
761 GetDocumentColor get_document_color = 10;
762 GetDefinition get_definition = 11;
763 GetDeclaration get_declaration = 12;
764 GetTypeDefinition get_type_definition = 13;
765 GetImplementation get_implementation = 14;
766 GetReferences get_references = 15;
767 }
768}
769
770message AllLanguageServers {}
771
772message LanguageServerSelector {
773 oneof selector {
774 uint64 server_id = 1;
775 string name = 2;
776 }
777}
778
779message RestartLanguageServers {
780 uint64 project_id = 1;
781 repeated uint64 buffer_ids = 2;
782 repeated LanguageServerSelector only_servers = 3;
783 bool all = 4;
784}
785
786message StopLanguageServers {
787 uint64 project_id = 1;
788 repeated uint64 buffer_ids = 2;
789 repeated LanguageServerSelector also_servers = 3;
790 bool all = 4;
791}
792
793message MultiLspQueryResponse {
794 repeated LspResponse responses = 1;
795}
796
797message LspResponse {
798 oneof response {
799 GetHoverResponse get_hover_response = 1;
800 GetCodeActionsResponse get_code_actions_response = 2;
801 GetSignatureHelpResponse get_signature_help_response = 3;
802 GetCodeLensResponse get_code_lens_response = 4;
803 GetDocumentDiagnosticsResponse get_document_diagnostics_response = 5;
804 GetDocumentColorResponse get_document_color_response = 6;
805 GetDefinitionResponse get_definition_response = 8;
806 GetDeclarationResponse get_declaration_response = 9;
807 GetTypeDefinitionResponse get_type_definition_response = 10;
808 GetImplementationResponse get_implementation_response = 11;
809 GetReferencesResponse get_references_response = 12;
810 }
811 uint64 server_id = 7;
812}
813
814message LanguageServerIdForName {
815 uint64 project_id = 1;
816 uint64 buffer_id = 2;
817 string name = 3;
818}
819
820message LanguageServerIdForNameResponse {
821 optional uint64 server_id = 1;
822}
823
824message LspExtRunnables {
825 uint64 project_id = 1;
826 uint64 buffer_id = 2;
827 optional Anchor position = 3;
828}
829
830message LspExtRunnablesResponse {
831 repeated LspRunnable runnables = 1;
832}
833
834message LspRunnable {
835 bytes task_template = 1;
836 optional LocationLink location = 2;
837}
838
839message LspExtCancelFlycheck {
840 uint64 project_id = 1;
841 uint64 buffer_id = 2;
842 uint64 language_server_id = 3;
843}
844
845message LspExtRunFlycheck {
846 uint64 project_id = 1;
847 uint64 buffer_id = 2;
848 uint64 language_server_id = 3;
849 bool current_file_only = 4;
850}
851
852message LspExtClearFlycheck {
853 uint64 project_id = 1;
854 uint64 buffer_id = 2;
855 uint64 language_server_id = 3;
856}
857
858message LspDiagnosticRelatedInformation {
859 optional string location_url = 1;
860 PointUtf16 location_range_start = 2;
861 PointUtf16 location_range_end = 3;
862 string message = 4;
863}
864
865enum LspDiagnosticTag {
866 None = 0;
867 Unnecessary = 1;
868 Deprecated = 2;
869}
870
871message LspDiagnostic {
872 PointUtf16 start = 1;
873 PointUtf16 end = 2;
874 Severity severity = 3;
875 optional string code = 4;
876 optional string code_description = 5;
877 optional string source = 6;
878 string message = 7;
879 repeated LspDiagnosticRelatedInformation related_information = 8;
880 repeated LspDiagnosticTag tags = 9;
881 optional string data = 10;
882
883 enum Severity {
884 None = 0;
885 Error = 1;
886 Warning = 2;
887 Information = 3;
888 Hint = 4;
889 }
890}
891
892message GetDocumentDiagnostics {
893 uint64 project_id = 1;
894 uint64 buffer_id = 2;
895 repeated VectorClockEntry version = 3;
896}
897
898message GetDocumentDiagnosticsResponse {
899 repeated PulledDiagnostics pulled_diagnostics = 1;
900}
901
902message PulledDiagnostics {
903 uint64 server_id = 1;
904 string uri = 2;
905 optional string result_id = 3;
906 bool changed = 4;
907 repeated LspDiagnostic diagnostics = 5;
908}
909
910message PullWorkspaceDiagnostics {
911 uint64 project_id = 1;
912 uint64 server_id = 2;
913}