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