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}
199
200message ApplyCompletionAdditionalEdits {
201 uint64 project_id = 1;
202 uint64 buffer_id = 2;
203 Completion completion = 3;
204}
205
206message ApplyCompletionAdditionalEditsResponse {
207 Transaction transaction = 1;
208}
209
210message Completion {
211 Anchor old_replace_start = 1;
212 Anchor old_replace_end = 2;
213 string new_text = 3;
214 uint64 server_id = 4;
215 bytes lsp_completion = 5;
216 bool resolved = 6;
217 Source source = 7;
218 optional bytes lsp_defaults = 8;
219 optional Anchor buffer_word_start = 9;
220 optional Anchor buffer_word_end = 10;
221 Anchor old_insert_start = 11;
222 Anchor old_insert_end = 12;
223
224 enum Source {
225 Lsp = 0;
226 Custom = 1;
227 BufferWord = 2;
228 }
229}
230
231message GetCodeActions {
232 uint64 project_id = 1;
233 uint64 buffer_id = 2;
234 Anchor start = 3;
235 Anchor end = 4;
236 repeated VectorClockEntry version = 5;
237}
238
239message GetCodeActionsResponse {
240 repeated CodeAction actions = 1;
241 repeated VectorClockEntry version = 2;
242}
243
244message GetSignatureHelp {
245 uint64 project_id = 1;
246 uint64 buffer_id = 2;
247 Anchor position = 3;
248 repeated VectorClockEntry version = 4;
249}
250
251message GetSignatureHelpResponse {
252 optional SignatureHelp signature_help = 1;
253}
254
255message SignatureHelp {
256 repeated SignatureInformation signatures = 1;
257 optional uint32 active_signature = 2;
258 optional uint32 active_parameter = 3;
259}
260
261message SignatureInformation {
262 string label = 1;
263 optional Documentation documentation = 2;
264 repeated ParameterInformation parameters = 3;
265 optional uint32 active_parameter = 4;
266}
267
268message Documentation {
269 oneof content {
270 string value = 1;
271 MarkupContent markup_content = 2;
272 }
273}
274
275enum MarkupKind {
276 PlainText = 0;
277 Markdown = 1;
278}
279
280message ParameterInformation {
281 oneof label {
282 string simple = 1;
283 LabelOffsets label_offsets = 2;
284 }
285 optional Documentation documentation = 3;
286}
287
288message LabelOffsets {
289 uint32 start = 1;
290 uint32 end = 2;
291}
292
293message GetHover {
294 uint64 project_id = 1;
295 uint64 buffer_id = 2;
296 Anchor position = 3;
297 repeated VectorClockEntry version = 5;
298}
299
300message GetHoverResponse {
301 optional Anchor start = 1;
302 optional Anchor end = 2;
303 repeated HoverBlock contents = 3;
304}
305
306message HoverBlock {
307 string text = 1;
308 optional string language = 2;
309 bool is_markdown = 3;
310}
311
312message ApplyCodeAction {
313 uint64 project_id = 1;
314 uint64 buffer_id = 2;
315 CodeAction action = 3;
316}
317
318message ApplyCodeActionResponse {
319 ProjectTransaction transaction = 1;
320}
321
322message PrepareRename {
323 uint64 project_id = 1;
324 uint64 buffer_id = 2;
325 Anchor position = 3;
326 repeated VectorClockEntry version = 4;
327}
328
329message PrepareRenameResponse {
330 bool can_rename = 1;
331 Anchor start = 2;
332 Anchor end = 3;
333 repeated VectorClockEntry version = 4;
334 bool only_unprepared_rename_supported = 5;
335}
336
337message PerformRename {
338 uint64 project_id = 1;
339 uint64 buffer_id = 2;
340 Anchor position = 3;
341 string new_name = 4;
342 repeated VectorClockEntry version = 5;
343}
344
345message OnTypeFormatting {
346 uint64 project_id = 1;
347 uint64 buffer_id = 2;
348 Anchor position = 3;
349 string trigger = 4;
350 repeated VectorClockEntry version = 5;
351}
352
353message OnTypeFormattingResponse {
354 Transaction transaction = 1;
355}
356
357
358message LinkedEditingRange {
359 uint64 project_id = 1;
360 uint64 buffer_id = 2;
361 Anchor position = 3;
362 repeated VectorClockEntry version = 4;
363}
364
365message LinkedEditingRangeResponse {
366 repeated AnchorRange items = 1;
367 repeated VectorClockEntry version = 4;
368}
369
370message InlayHint {
371 Anchor position = 1;
372 InlayHintLabel label = 2;
373 optional string kind = 3;
374 bool padding_left = 4;
375 bool padding_right = 5;
376 InlayHintTooltip tooltip = 6;
377 ResolveState resolve_state = 7;
378}
379
380message InlayHintLabel {
381 oneof label {
382 string value = 1;
383 InlayHintLabelParts label_parts = 2;
384 }
385}
386
387message InlayHintLabelParts {
388 repeated InlayHintLabelPart parts = 1;
389}
390
391message InlayHintLabelPart {
392 string value = 1;
393 InlayHintLabelPartTooltip tooltip = 2;
394 optional string location_url = 3;
395 PointUtf16 location_range_start = 4;
396 PointUtf16 location_range_end = 5;
397 optional uint64 language_server_id = 6;
398}
399
400message InlayHintTooltip {
401 oneof content {
402 string value = 1;
403 MarkupContent markup_content = 2;
404 }
405}
406
407message InlayHintLabelPartTooltip {
408 oneof content {
409 string value = 1;
410 MarkupContent markup_content = 2;
411 }
412}
413
414message ResolveState {
415 State state = 1;
416 LspResolveState lsp_resolve_state = 2;
417
418 enum State {
419 Resolved = 0;
420 CanResolve = 1;
421 Resolving = 2;
422 }
423
424 message LspResolveState {
425 optional string value = 1;
426 uint64 server_id = 2;
427 }
428}
429
430// This type is used to resolve more than just
431// the documentation, but for backwards-compatibility
432// reasons we can't rename the type.
433message ResolveCompletionDocumentation {
434 uint64 project_id = 1;
435 uint64 language_server_id = 2;
436 bytes lsp_completion = 3;
437 uint64 buffer_id = 4;
438}
439
440message ResolveCompletionDocumentationResponse {
441 string documentation = 1;
442 bool documentation_is_markdown = 2;
443 Anchor old_replace_start = 3;
444 Anchor old_replace_end = 4;
445 string new_text = 5;
446 bytes lsp_completion = 6;
447 Anchor old_insert_start = 7;
448 Anchor old_insert_end = 8;
449}
450
451message ResolveInlayHint {
452 uint64 project_id = 1;
453 uint64 buffer_id = 2;
454 uint64 language_server_id = 3;
455 InlayHint hint = 4;
456}
457
458message ResolveInlayHintResponse {
459 InlayHint hint = 1;
460}
461
462message RefreshInlayHints {
463 uint64 project_id = 1;
464}
465
466message CodeLens {
467 bytes lsp_lens = 1;
468}
469
470message GetCodeLens {
471 uint64 project_id = 1;
472 uint64 buffer_id = 2;
473 repeated VectorClockEntry version = 3;
474}
475
476message GetCodeLensResponse {
477 repeated CodeAction lens_actions = 1;
478 repeated VectorClockEntry version = 2;
479}
480
481message RefreshCodeLens {
482 uint64 project_id = 1;
483}
484
485message MarkupContent {
486 bool is_markdown = 1;
487 string value = 2;
488}
489
490message PerformRenameResponse {
491 ProjectTransaction transaction = 2;
492}
493
494message CodeAction {
495 uint64 server_id = 1;
496 Anchor start = 2;
497 Anchor end = 3;
498 bytes lsp_action = 4;
499 Kind kind = 5;
500 bool resolved = 6;
501 enum Kind {
502 Action = 0;
503 Command = 1;
504 CodeLens = 2;
505 }
506}
507
508message LanguageServer {
509 uint64 id = 1;
510 string name = 2;
511 optional uint64 worktree_id = 3;
512}
513
514message StartLanguageServer {
515 uint64 project_id = 1;
516 LanguageServer server = 2;
517}
518
519message UpdateDiagnosticSummary {
520 uint64 project_id = 1;
521 uint64 worktree_id = 2;
522 DiagnosticSummary summary = 3;
523}
524
525message DiagnosticSummary {
526 string path = 1;
527 uint64 language_server_id = 2;
528 uint32 error_count = 3;
529 uint32 warning_count = 4;
530}
531
532message UpdateLanguageServer {
533 uint64 project_id = 1;
534 uint64 language_server_id = 2;
535 oneof variant {
536 LspWorkStart work_start = 3;
537 LspWorkProgress work_progress = 4;
538 LspWorkEnd work_end = 5;
539 LspDiskBasedDiagnosticsUpdating disk_based_diagnostics_updating = 6;
540 LspDiskBasedDiagnosticsUpdated disk_based_diagnostics_updated = 7;
541 }
542}
543
544message LspWorkStart {
545 string token = 1;
546 optional string title = 4;
547 optional string message = 2;
548 optional uint32 percentage = 3;
549 optional bool is_cancellable = 5;
550}
551
552message LspWorkProgress {
553 string token = 1;
554 optional string message = 2;
555 optional uint32 percentage = 3;
556 optional bool is_cancellable = 4;
557}
558
559message LspWorkEnd {
560 string token = 1;
561}
562
563message LspDiskBasedDiagnosticsUpdating {}
564
565message LspDiskBasedDiagnosticsUpdated {}
566
567message LanguageServerLog {
568 uint64 project_id = 1;
569 uint64 language_server_id = 2;
570 oneof log_type {
571 uint32 log_message_type = 3;
572 LspLogTrace log_trace = 4;
573 }
574 string message = 5;
575}
576
577message LspLogTrace {
578 optional string message = 1;
579}
580
581message ApplyCodeActionKind {
582 uint64 project_id = 1;
583 string kind = 2;
584 repeated uint64 buffer_ids = 3;
585}
586
587message ApplyCodeActionKindResponse {
588 ProjectTransaction transaction = 1;
589}
590
591message RegisterBufferWithLanguageServers {
592 uint64 project_id = 1;
593 uint64 buffer_id = 2;
594}
595
596enum FormatTrigger {
597 Save = 0;
598 Manual = 1;
599}
600
601message OpenBufferForSymbol {
602 uint64 project_id = 1;
603 Symbol symbol = 2;
604}
605
606message OpenBufferForSymbolResponse {
607 uint64 buffer_id = 1;
608}
609
610message FormatBuffers {
611 uint64 project_id = 1;
612 FormatTrigger trigger = 2;
613 repeated uint64 buffer_ids = 3;
614}
615
616message FormatBuffersResponse {
617 ProjectTransaction transaction = 1;
618}
619
620message GetCompletions {
621 uint64 project_id = 1;
622 uint64 buffer_id = 2;
623 Anchor position = 3;
624 repeated VectorClockEntry version = 4;
625}
626
627message CancelLanguageServerWork {
628 uint64 project_id = 1;
629
630 oneof work {
631 Buffers buffers = 2;
632 LanguageServerWork language_server_work = 3;
633 }
634
635 message Buffers {
636 repeated uint64 buffer_ids = 2;
637 }
638
639 message LanguageServerWork {
640 uint64 language_server_id = 1;
641 optional string token = 2;
642 }
643}
644
645message LanguageServerPromptRequest {
646 uint64 project_id = 1;
647
648 oneof level {
649 Info info = 2;
650 Warning warning = 3;
651 Critical critical = 4;
652 }
653
654 message Info {}
655 message Warning {}
656 message Critical {}
657
658 string message = 5;
659 repeated string actions = 6;
660 string lsp_name = 7;
661}
662
663message LanguageServerPromptResponse {
664 optional uint64 action_response = 1;
665}
666
667message MultiLspQuery {
668 uint64 project_id = 1;
669 uint64 buffer_id = 2;
670 repeated VectorClockEntry version = 3;
671 oneof strategy {
672 AllLanguageServers all = 4;
673 }
674 oneof request {
675 GetHover get_hover = 5;
676 GetCodeActions get_code_actions = 6;
677 GetSignatureHelp get_signature_help = 7;
678 GetCodeLens get_code_lens = 8;
679 }
680}
681
682message AllLanguageServers {}
683
684message RestartLanguageServers {
685 uint64 project_id = 1;
686 repeated uint64 buffer_ids = 2;
687}
688
689message StopLanguageServers {
690 uint64 project_id = 1;
691 repeated uint64 buffer_ids = 2;
692}
693
694message MultiLspQueryResponse {
695 repeated LspResponse responses = 1;
696}
697
698message LspResponse {
699 oneof response {
700 GetHoverResponse get_hover_response = 1;
701 GetCodeActionsResponse get_code_actions_response = 2;
702 GetSignatureHelpResponse get_signature_help_response = 3;
703 GetCodeLensResponse get_code_lens_response = 4;
704 }
705}
706
707message LanguageServerIdForName {
708 uint64 project_id = 1;
709 uint64 buffer_id = 2;
710 string name = 3;
711}
712
713message LanguageServerIdForNameResponse {
714 optional uint64 server_id = 1;
715}
716
717message LspExtRunnables {
718 uint64 project_id = 1;
719 uint64 buffer_id = 2;
720 optional Anchor position = 3;
721}
722
723message LspExtRunnablesResponse {
724 repeated LspRunnable runnables = 1;
725}
726
727message LspRunnable {
728 bytes task_template = 1;
729 optional LocationLink location = 2;
730}
731
732message LspExtCancelFlycheck {
733 uint64 project_id = 1;
734 uint64 buffer_id = 2;
735 uint64 language_server_id = 3;
736}
737
738message LspExtRunFlycheck {
739 uint64 project_id = 1;
740 uint64 buffer_id = 2;
741 uint64 language_server_id = 3;
742 bool current_file_only = 4;
743}
744
745message LspExtClearFlycheck {
746 uint64 project_id = 1;
747 uint64 buffer_id = 2;
748 uint64 language_server_id = 3;
749}