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