xref: /llvm-project/clang-tools-extra/clangd/index/remote/Index.proto (revision c7ef0ac9fd28cb55b8c7c91a890b365cc688f9a9)
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  optional uint32 supported_directives = 3;
111}
112
113message RelationsRequest {
114  repeated string subjects = 1;
115  optional uint32 predicate = 2;
116  optional uint32 limit = 3;
117}
118
119// The response is a stream of reference messages, and one terminating has_more
120// message.
121message RelationsReply {
122  oneof kind {
123    Relation stream_result = 1;
124    FinalResult final_result = 2;
125  }
126}
127
128// This struct does not mirror clangd::Relation but rather the arguments of
129// SymbolIndex::relations callback.
130message Relation {
131  optional string subject_id = 1;
132  optional Symbol object = 2;
133}
134
135message ContainedRefsRequest {
136  optional string id = 1;
137  optional uint32 limit = 2;
138}
139
140message ContainedRefsReply {
141  oneof kind {
142    ContainedRef stream_result = 1;
143    FinalResult final_result = 2;
144  }
145}
146
147message ContainedRef {
148  optional SymbolLocation location = 1;
149  optional uint32 kind = 2;
150  optional string symbol = 3;
151}
152