1//===--- Index.proto - Remote index Protocol Buffers definition -----------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9syntax = "proto2";
10
11package clang.clangd.remote;
12
13// Common final result for streaming requests.
14message FinalResult { optional bool has_more = 1; }
15
16message LookupRequest { repeated string ids = 1; }
17
18// The response is a stream of symbol messages and the terminating message
19// indicating the end of stream.
20message LookupReply {
21  oneof kind {
22    Symbol stream_result = 1;
23    FinalResult final_result = 2;
24  }
25}
26
27message FuzzyFindRequest {
28  optional string query = 1;
29  repeated string scopes = 2;
30  optional bool any_scope = 3;
31  optional uint32 limit = 4;
32  optional bool restricted_for_code_completion = 5;
33  repeated string proximity_paths = 6;
34  repeated string preferred_types = 7;
35}
36
37// The response is a stream of symbol messages, and one terminating has_more
38// message.
39message FuzzyFindReply {
40  oneof kind {
41    Symbol stream_result = 1;
42    FinalResult final_result = 2;
43  }
44}
45
46message RefsRequest {
47  repeated string ids = 1;
48  optional uint32 filter = 2;
49  optional uint32 limit = 3;
50  optional bool want_container = 4;
51}
52
53// The response is a stream of reference messages, and one terminating has_more
54// message.
55message RefsReply {
56  oneof kind {
57    Ref stream_result = 1;
58    FinalResult final_result = 2;
59  }
60}
61
62message Symbol {
63  optional string id = 1;
64  optional SymbolInfo info = 2;
65  optional string name = 3;
66  optional SymbolLocation definition = 4;
67  optional string scope = 5;
68  optional SymbolLocation canonical_declaration = 6;
69  optional int32 references = 7;
70  reserved 8;
71  optional string signature = 9;
72  optional string template_specialization_args = 10;
73  optional string completion_snippet_suffix = 11;
74  optional string documentation = 12;
75  optional string return_type = 13;
76  optional string type = 14;
77  repeated HeaderWithReferences headers = 15;
78  optional uint32 flags = 16;
79}
80
81message Ref {
82  optional SymbolLocation location = 1;
83  optional uint32 kind = 2;
84}
85
86message SymbolInfo {
87  optional uint32 kind = 1;
88  optional uint32 subkind = 2;
89  optional uint32 language = 3;
90  optional uint32 properties = 4;
91}
92
93message SymbolLocation {
94  optional Position start = 1;
95  optional Position end = 2;
96  // clangd::SymbolLocation stores FileURI, but the protocol transmits a the
97  // relative path. Because paths are different on the remote and local machines
98  // they will be translated in the marshalling layer.
99  optional string file_path = 3;
100}
101
102message Position {
103  optional uint32 line = 1;
104  optional uint32 column = 2;
105}
106
107message HeaderWithReferences {
108  optional string header = 1;
109  optional uint32 references = 2;
110}
111
112message RelationsRequest {
113  repeated string subjects = 1;
114  optional uint32 predicate = 2;
115  optional uint32 limit = 3;
116}
117
118// The response is a stream of reference messages, and one terminating has_more
119// message.
120message RelationsReply {
121  oneof kind {
122    Relation stream_result = 1;
123    FinalResult final_result = 2;
124  }
125}
126
127// This struct does not mirror clangd::Relation but rather the arguments of
128// SymbolIndex::relations callback.
129message Relation {
130  optional string subject_id = 1;
131  optional Symbol object = 2;
132}
133