dravix-agent 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/settings.example.json +30 -0
- package/ARCHITECTURE.md +410 -0
- package/LICENSE +21 -0
- package/README.md +153 -0
- package/ROADMAP.md +117 -0
- package/data/vulnkb.json +666 -0
- package/dist/bin/aegis.d.ts +3 -0
- package/dist/bin/aegis.d.ts.map +1 -0
- package/dist/bin/aegis.js +489 -0
- package/dist/bin/aegis.js.map +1 -0
- package/dist/cache.d.ts +9 -0
- package/dist/cache.d.ts.map +1 -0
- package/dist/cache.js +146 -0
- package/dist/cache.js.map +1 -0
- package/dist/engines/ai-sinks.d.ts +52 -0
- package/dist/engines/ai-sinks.d.ts.map +1 -0
- package/dist/engines/ai-sinks.js +204 -0
- package/dist/engines/ai-sinks.js.map +1 -0
- package/dist/engines/eslint.d.ts +9 -0
- package/dist/engines/eslint.d.ts.map +1 -0
- package/dist/engines/eslint.js +245 -0
- package/dist/engines/eslint.js.map +1 -0
- package/dist/engines/joern.d.ts +3 -0
- package/dist/engines/joern.d.ts.map +1 -0
- package/dist/engines/joern.js +98 -0
- package/dist/engines/joern.js.map +1 -0
- package/dist/engines/js-sinks.d.ts +70 -0
- package/dist/engines/js-sinks.d.ts.map +1 -0
- package/dist/engines/js-sinks.js +370 -0
- package/dist/engines/js-sinks.js.map +1 -0
- package/dist/engines/llm-critic.d.ts +130 -0
- package/dist/engines/llm-critic.d.ts.map +1 -0
- package/dist/engines/llm-critic.js +551 -0
- package/dist/engines/llm-critic.js.map +1 -0
- package/dist/engines/pragma.d.ts +20 -0
- package/dist/engines/pragma.d.ts.map +1 -0
- package/dist/engines/pragma.js +83 -0
- package/dist/engines/pragma.js.map +1 -0
- package/dist/engines/property-test.d.ts +3 -0
- package/dist/engines/property-test.d.ts.map +1 -0
- package/dist/engines/property-test.js +134 -0
- package/dist/engines/property-test.js.map +1 -0
- package/dist/engines/pyright.d.ts +10 -0
- package/dist/engines/pyright.d.ts.map +1 -0
- package/dist/engines/pyright.js +143 -0
- package/dist/engines/pyright.js.map +1 -0
- package/dist/engines/pysa.d.ts +3 -0
- package/dist/engines/pysa.d.ts.map +1 -0
- package/dist/engines/pysa.js +83 -0
- package/dist/engines/pysa.js.map +1 -0
- package/dist/engines/python-sinks.d.ts +82 -0
- package/dist/engines/python-sinks.d.ts.map +1 -0
- package/dist/engines/python-sinks.js +459 -0
- package/dist/engines/python-sinks.js.map +1 -0
- package/dist/engines/registry.d.ts +26 -0
- package/dist/engines/registry.d.ts.map +1 -0
- package/dist/engines/registry.js +70 -0
- package/dist/engines/registry.js.map +1 -0
- package/dist/engines/secret-scan.d.ts +22 -0
- package/dist/engines/secret-scan.d.ts.map +1 -0
- package/dist/engines/secret-scan.js +179 -0
- package/dist/engines/secret-scan.js.map +1 -0
- package/dist/engines/semgrep.d.ts +10 -0
- package/dist/engines/semgrep.d.ts.map +1 -0
- package/dist/engines/semgrep.js +200 -0
- package/dist/engines/semgrep.js.map +1 -0
- package/dist/engines/treesitter.d.ts +18 -0
- package/dist/engines/treesitter.d.ts.map +1 -0
- package/dist/engines/treesitter.js +135 -0
- package/dist/engines/treesitter.js.map +1 -0
- package/dist/engines/tsc.d.ts +10 -0
- package/dist/engines/tsc.d.ts.map +1 -0
- package/dist/engines/tsc.js +142 -0
- package/dist/engines/tsc.js.map +1 -0
- package/dist/engines/types.d.ts +47 -0
- package/dist/engines/types.d.ts.map +1 -0
- package/dist/engines/types.js +27 -0
- package/dist/engines/types.js.map +1 -0
- package/dist/findings.d.ts +121 -0
- package/dist/findings.d.ts.map +1 -0
- package/dist/findings.js +98 -0
- package/dist/findings.js.map +1 -0
- package/dist/hooks/claude-code.d.ts +3 -0
- package/dist/hooks/claude-code.d.ts.map +1 -0
- package/dist/hooks/claude-code.js +187 -0
- package/dist/hooks/claude-code.js.map +1 -0
- package/dist/index/context.d.ts +127 -0
- package/dist/index/context.d.ts.map +1 -0
- package/dist/index/context.js +267 -0
- package/dist/index/context.js.map +1 -0
- package/dist/index/embeddings.d.ts +68 -0
- package/dist/index/embeddings.d.ts.map +1 -0
- package/dist/index/embeddings.js +570 -0
- package/dist/index/embeddings.js.map +1 -0
- package/dist/index/graph_routing.d.ts +36 -0
- package/dist/index/graph_routing.d.ts.map +1 -0
- package/dist/index/graph_routing.js +170 -0
- package/dist/index/graph_routing.js.map +1 -0
- package/dist/index/joern.d.ts +76 -0
- package/dist/index/joern.d.ts.map +1 -0
- package/dist/index/joern.js +782 -0
- package/dist/index/joern.js.map +1 -0
- package/dist/index/property-test.d.ts +88 -0
- package/dist/index/property-test.d.ts.map +1 -0
- package/dist/index/property-test.js +466 -0
- package/dist/index/property-test.js.map +1 -0
- package/dist/index/proto/scip.proto +897 -0
- package/dist/index/pysa.d.ts +91 -0
- package/dist/index/pysa.d.ts.map +1 -0
- package/dist/index/pysa.js +617 -0
- package/dist/index/pysa.js.map +1 -0
- package/dist/index/scip.d.ts +76 -0
- package/dist/index/scip.d.ts.map +1 -0
- package/dist/index/scip.js +541 -0
- package/dist/index/scip.js.map +1 -0
- package/dist/index/vulrag.d.ts +86 -0
- package/dist/index/vulrag.d.ts.map +1 -0
- package/dist/index/vulrag.js +242 -0
- package/dist/index/vulrag.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/install/claude-code.d.ts +31 -0
- package/dist/install/claude-code.d.ts.map +1 -0
- package/dist/install/claude-code.js +447 -0
- package/dist/install/claude-code.js.map +1 -0
- package/dist/lang.d.ts +5 -0
- package/dist/lang.d.ts.map +1 -0
- package/dist/lang.js +52 -0
- package/dist/lang.js.map +1 -0
- package/dist/learning/suppressions.d.ts +70 -0
- package/dist/learning/suppressions.d.ts.map +1 -0
- package/dist/learning/suppressions.js +179 -0
- package/dist/learning/suppressions.js.map +1 -0
- package/dist/mcp/server.d.ts +2 -0
- package/dist/mcp/server.d.ts.map +1 -0
- package/dist/mcp/server.js +187 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/mcp/tools/explain.d.ts +58 -0
- package/dist/mcp/tools/explain.d.ts.map +1 -0
- package/dist/mcp/tools/explain.js +60 -0
- package/dist/mcp/tools/explain.js.map +1 -0
- package/dist/mcp/tools/precheck.d.ts +29 -0
- package/dist/mcp/tools/precheck.d.ts.map +1 -0
- package/dist/mcp/tools/precheck.js +42 -0
- package/dist/mcp/tools/precheck.js.map +1 -0
- package/dist/mcp/tools/validate.d.ts +73 -0
- package/dist/mcp/tools/validate.d.ts.map +1 -0
- package/dist/mcp/tools/validate.js +66 -0
- package/dist/mcp/tools/validate.js.map +1 -0
- package/dist/mcp/warm.d.ts +88 -0
- package/dist/mcp/warm.d.ts.map +1 -0
- package/dist/mcp/warm.js +331 -0
- package/dist/mcp/warm.js.map +1 -0
- package/dist/orchestrator.d.ts +46 -0
- package/dist/orchestrator.d.ts.map +1 -0
- package/dist/orchestrator.js +596 -0
- package/dist/orchestrator.js.map +1 -0
- package/dist/policy.d.ts +51 -0
- package/dist/policy.d.ts.map +1 -0
- package/dist/policy.js +201 -0
- package/dist/policy.js.map +1 -0
- package/dist/risk.d.ts +31 -0
- package/dist/risk.d.ts.map +1 -0
- package/dist/risk.js +92 -0
- package/dist/risk.js.map +1 -0
- package/dist/stats.d.ts +72 -0
- package/dist/stats.d.ts.map +1 -0
- package/dist/stats.js +217 -0
- package/dist/stats.js.map +1 -0
- package/dist/telemetry/collector.d.ts +10 -0
- package/dist/telemetry/collector.d.ts.map +1 -0
- package/dist/telemetry/collector.js +75 -0
- package/dist/telemetry/collector.js.map +1 -0
- package/dist/telemetry/consent.d.ts +9 -0
- package/dist/telemetry/consent.d.ts.map +1 -0
- package/dist/telemetry/consent.js +42 -0
- package/dist/telemetry/consent.js.map +1 -0
- package/dist/telemetry/installation.d.ts +2 -0
- package/dist/telemetry/installation.d.ts.map +1 -0
- package/dist/telemetry/installation.js +32 -0
- package/dist/telemetry/installation.js.map +1 -0
- package/dist/telemetry/sanitizer.d.ts +5 -0
- package/dist/telemetry/sanitizer.d.ts.map +1 -0
- package/dist/telemetry/sanitizer.js +60 -0
- package/dist/telemetry/sanitizer.js.map +1 -0
- package/dist/telemetry/types.d.ts +39 -0
- package/dist/telemetry/types.d.ts.map +1 -0
- package/dist/telemetry/types.js +4 -0
- package/dist/telemetry/types.js.map +1 -0
- package/dist/telemetry/uploader.d.ts +12 -0
- package/dist/telemetry/uploader.d.ts.map +1 -0
- package/dist/telemetry/uploader.js +92 -0
- package/dist/telemetry/uploader.js.map +1 -0
- package/dist/util/logger.d.ts +19 -0
- package/dist/util/logger.d.ts.map +1 -0
- package/dist/util/logger.js +58 -0
- package/dist/util/logger.js.map +1 -0
- package/dist/util/safe-paths.d.ts +8 -0
- package/dist/util/safe-paths.d.ts.map +1 -0
- package/dist/util/safe-paths.js +102 -0
- package/dist/util/safe-paths.js.map +1 -0
- package/dist/util/subprocess.d.ts +32 -0
- package/dist/util/subprocess.d.ts.map +1 -0
- package/dist/util/subprocess.js +137 -0
- package/dist/util/subprocess.js.map +1 -0
- package/package.json +93 -0
|
@@ -0,0 +1,897 @@
|
|
|
1
|
+
// An index contains one or more pieces of information about a given piece of
|
|
2
|
+
// source code or software artifact. Complementary information can be merged
|
|
3
|
+
// together from multiple sources to provide a unified code intelligence
|
|
4
|
+
// experience.
|
|
5
|
+
//
|
|
6
|
+
// Programs producing a file of this format is an "indexer" and may operate
|
|
7
|
+
// somewhere on the spectrum between precision, such as indexes produced by
|
|
8
|
+
// compiler-backed indexers, and heurstics, such as indexes produced by local
|
|
9
|
+
// syntax-directed analysis for scope rules.
|
|
10
|
+
|
|
11
|
+
syntax = "proto3";
|
|
12
|
+
|
|
13
|
+
package scip;
|
|
14
|
+
|
|
15
|
+
option go_package = "github.com/scip-code/scip/bindings/go/scip/";
|
|
16
|
+
|
|
17
|
+
// Index represents a complete SCIP index for a workspace this is rooted at a
|
|
18
|
+
// single directory. An Index message payload can have a large memory footprint
|
|
19
|
+
// and it's therefore recommended to emit and consume an Index payload one field
|
|
20
|
+
// value at a time. To permit streaming consumption of an Index payload, the
|
|
21
|
+
// `metadata` field must appear at the start of the stream and must only appear
|
|
22
|
+
// once in the stream. Other field values may appear in any order.
|
|
23
|
+
message Index {
|
|
24
|
+
// Metadata about this index.
|
|
25
|
+
Metadata metadata = 1;
|
|
26
|
+
// Documents that belong to this index.
|
|
27
|
+
repeated Document documents = 2;
|
|
28
|
+
// (optional) Symbols that are referenced from this index but are defined in
|
|
29
|
+
// an external package (a separate `Index` message). Leave this field empty
|
|
30
|
+
// if you assume the external package will get indexed separately. If the
|
|
31
|
+
// external package won't get indexed for some reason then you can use this
|
|
32
|
+
// field to provide hover documentation for those external symbols.
|
|
33
|
+
repeated SymbolInformation external_symbols = 3;
|
|
34
|
+
// IMPORTANT: When adding a new field to `Index` here, add a matching
|
|
35
|
+
// function in `IndexVisitor` and update `ParseStreaming`.
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
message Metadata {
|
|
39
|
+
// Which version of this protocol was used to generate this index?
|
|
40
|
+
ProtocolVersion version = 1;
|
|
41
|
+
// Information about the tool that produced this index.
|
|
42
|
+
ToolInfo tool_info = 2;
|
|
43
|
+
// URI-encoded absolute path to the root directory of this index. All
|
|
44
|
+
// documents in this index must appear in a subdirectory of this root
|
|
45
|
+
// directory.
|
|
46
|
+
string project_root = 3;
|
|
47
|
+
// Text encoding of the source files on disk that are referenced from
|
|
48
|
+
// `Document.relative_path`. This value is unrelated to the `Document.text`
|
|
49
|
+
// field, which is a Protobuf string and hence must be UTF-8 encoded.
|
|
50
|
+
TextEncoding text_document_encoding = 4;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
enum ProtocolVersion {
|
|
54
|
+
UnspecifiedProtocolVersion = 0;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
enum TextEncoding {
|
|
58
|
+
UnspecifiedTextEncoding = 0;
|
|
59
|
+
UTF8 = 1;
|
|
60
|
+
UTF16 = 2;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
message ToolInfo {
|
|
64
|
+
// Name of the indexer that produced this index.
|
|
65
|
+
string name = 1;
|
|
66
|
+
// Version of the indexer that produced this index.
|
|
67
|
+
string version = 2;
|
|
68
|
+
// Command-line arguments that were used to invoke this indexer.
|
|
69
|
+
repeated string arguments = 3;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// Document defines the metadata about a source file on disk.
|
|
73
|
+
message Document {
|
|
74
|
+
// The string ID for the programming language this file is written in.
|
|
75
|
+
// The `Language` enum contains the names of most common programming languages.
|
|
76
|
+
// This field is typed as a string to permit any programming language, including
|
|
77
|
+
// ones that are not specified by the `Language` enum.
|
|
78
|
+
string language = 4;
|
|
79
|
+
// (Required) Unique path to the text document.
|
|
80
|
+
//
|
|
81
|
+
// 1. The path must be relative to the directory supplied in the associated
|
|
82
|
+
// `Metadata.project_root`.
|
|
83
|
+
// 2. The path must not begin with a leading '/'.
|
|
84
|
+
// 3. The path must point to a regular file, not a symbolic link.
|
|
85
|
+
// 4. The path must use '/' as the separator, including on Windows.
|
|
86
|
+
// 5. The path must be canonical; it cannot include empty components ('//'),
|
|
87
|
+
// or '.' or '..'.
|
|
88
|
+
string relative_path = 1;
|
|
89
|
+
// Occurrences that appear in this file.
|
|
90
|
+
repeated Occurrence occurrences = 2;
|
|
91
|
+
// Symbols that are "defined" within this document.
|
|
92
|
+
//
|
|
93
|
+
// This should include symbols which technically do not have any definition,
|
|
94
|
+
// but have a reference and are defined by some other symbol (see
|
|
95
|
+
// Relationship.is_definition).
|
|
96
|
+
repeated SymbolInformation symbols = 3;
|
|
97
|
+
|
|
98
|
+
// (optional) Text contents of this document. Indexers are not expected to
|
|
99
|
+
// include the text by default. It's preferable that clients read the text
|
|
100
|
+
// contents from the file system by resolving the absolute path from joining
|
|
101
|
+
// `Index.metadata.project_root` and `Document.relative_path`. This field
|
|
102
|
+
// can be useful for testing or when working with virtual/in-memory documents.
|
|
103
|
+
string text = 5;
|
|
104
|
+
|
|
105
|
+
// Specifies the encoding used for source ranges in this Document.
|
|
106
|
+
//
|
|
107
|
+
// Usually, this will match the type used to index the string type
|
|
108
|
+
// in the indexer's implementation language in O(1) time.
|
|
109
|
+
// - For an indexer implemented in JVM/.NET language or JavaScript/TypeScript,
|
|
110
|
+
// use UTF16CodeUnitOffsetFromLineStart.
|
|
111
|
+
// - For an indexer implemented in Python,
|
|
112
|
+
// use UTF32CodeUnitOffsetFromLineStart.
|
|
113
|
+
// - For an indexer implemented in Go, Rust or C++,
|
|
114
|
+
// use UTF8ByteOffsetFromLineStart.
|
|
115
|
+
PositionEncoding position_encoding = 6;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// Encoding used to interpret the 'character' value in source ranges.
|
|
119
|
+
enum PositionEncoding {
|
|
120
|
+
// Default value. This value should not be used by new SCIP indexers
|
|
121
|
+
// so that a consumer can process the SCIP index without ambiguity.
|
|
122
|
+
UnspecifiedPositionEncoding = 0;
|
|
123
|
+
// The 'character' value is interpreted as an offset in terms
|
|
124
|
+
// of UTF-8 code units (i.e. bytes).
|
|
125
|
+
//
|
|
126
|
+
// Example: For the string "🚀 Woo" in UTF-8, the bytes are
|
|
127
|
+
// [240, 159, 154, 128, 32, 87, 111, 111], so the offset for 'W'
|
|
128
|
+
// would be 5.
|
|
129
|
+
UTF8CodeUnitOffsetFromLineStart = 1;
|
|
130
|
+
// The 'character' value is interpreted as an offset in terms
|
|
131
|
+
// of UTF-16 code units (each is 2 bytes).
|
|
132
|
+
//
|
|
133
|
+
// Example: For the string "🚀 Woo", the UTF-16 code units are
|
|
134
|
+
// ['\ud83d', '\ude80', ' ', 'W', 'o', 'o'], so the offset for 'W'
|
|
135
|
+
// would be 3.
|
|
136
|
+
UTF16CodeUnitOffsetFromLineStart = 2;
|
|
137
|
+
// The 'character' value is interpreted as an offset in terms
|
|
138
|
+
// of UTF-32 code units (each is 4 bytes).
|
|
139
|
+
//
|
|
140
|
+
// Example: For the string "🚀 Woo", the UTF-32 code units are
|
|
141
|
+
// ['🚀', ' ', 'W', 'o', 'o'], so the offset for 'W' would be 2.
|
|
142
|
+
UTF32CodeUnitOffsetFromLineStart = 3;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// Symbol is similar to a URI, it identifies a class, method, or a local
|
|
146
|
+
// variable. `SymbolInformation` contains rich metadata about symbols such as
|
|
147
|
+
// the docstring.
|
|
148
|
+
//
|
|
149
|
+
// Symbol has a standardized string representation, which can be used
|
|
150
|
+
// interchangeably with `Symbol`. The syntax for Symbol is the following:
|
|
151
|
+
// ```
|
|
152
|
+
// # (<x>)+ stands for one or more repetitions of <x>
|
|
153
|
+
// # (<x>)? stands for zero or one occurrence of <x>
|
|
154
|
+
// <symbol> ::= <scheme> ' ' <package> ' ' (<descriptor>)+ | 'local ' <local-id>
|
|
155
|
+
// <package> ::= <manager> ' ' <package-name> ' ' <version>
|
|
156
|
+
// <scheme> ::= any UTF-8, escape spaces with double space. Must not be empty nor start with 'local'
|
|
157
|
+
// <manager> ::= any UTF-8, escape spaces with double space. Use the placeholder '.' to indicate an empty value
|
|
158
|
+
// <package-name> ::= same as above
|
|
159
|
+
// <version> ::= same as above
|
|
160
|
+
// <descriptor> ::= <namespace> | <type> | <term> | <method> | <type-parameter> | <parameter> | <meta> | <macro>
|
|
161
|
+
// <namespace> ::= <name> '/'
|
|
162
|
+
// <type> ::= <name> '#'
|
|
163
|
+
// <term> ::= <name> '.'
|
|
164
|
+
// <meta> ::= <name> ':'
|
|
165
|
+
// <macro> ::= <name> '!'
|
|
166
|
+
// <method> ::= <name> '(' (<method-disambiguator>)? ').'
|
|
167
|
+
// <type-parameter> ::= '[' <name> ']'
|
|
168
|
+
// <parameter> ::= '(' <name> ')'
|
|
169
|
+
// <name> ::= <identifier>
|
|
170
|
+
// <method-disambiguator> ::= <simple-identifier>
|
|
171
|
+
// <identifier> ::= <simple-identifier> | <escaped-identifier>
|
|
172
|
+
// <simple-identifier> ::= (<identifier-character>)+
|
|
173
|
+
// <identifier-character> ::= '_' | '+' | '-' | '$' | ASCII letter or digit
|
|
174
|
+
// <escaped-identifier> ::= '`' (<escaped-character>)+ '`', must contain at least one non-<identifier-character>
|
|
175
|
+
// <escaped-characters> ::= any UTF-8, escape backticks with double backtick.
|
|
176
|
+
// <local-id> ::= <simple-identifier>
|
|
177
|
+
// ```
|
|
178
|
+
//
|
|
179
|
+
// The list of descriptors for a symbol should together form a fully
|
|
180
|
+
// qualified name for the symbol. That is, it should serve as a unique
|
|
181
|
+
// identifier across the package. Typically, it will include one descriptor
|
|
182
|
+
// for every node in the AST (along the ancestry path) between the root of
|
|
183
|
+
// the file and the node corresponding to the symbol.
|
|
184
|
+
//
|
|
185
|
+
// Local symbols MUST only be used for entities which are local to a Document,
|
|
186
|
+
// and cannot be accessed from outside the Document.
|
|
187
|
+
message Symbol {
|
|
188
|
+
string scheme = 1;
|
|
189
|
+
Package package = 2;
|
|
190
|
+
repeated Descriptor descriptors = 3;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
// Unit of packaging and distribution.
|
|
194
|
+
//
|
|
195
|
+
// NOTE: This corresponds to a module in Go and JVM languages.
|
|
196
|
+
message Package {
|
|
197
|
+
string manager = 1;
|
|
198
|
+
string name = 2;
|
|
199
|
+
string version = 3;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
message Descriptor {
|
|
203
|
+
enum Suffix {
|
|
204
|
+
option allow_alias = true;
|
|
205
|
+
UnspecifiedSuffix = 0;
|
|
206
|
+
// Unit of code abstraction and/or namespacing.
|
|
207
|
+
//
|
|
208
|
+
// NOTE: This corresponds to a package in Go and JVM languages.
|
|
209
|
+
Namespace = 1;
|
|
210
|
+
// Use Namespace instead.
|
|
211
|
+
Package = 1 [deprecated = true];
|
|
212
|
+
Type = 2;
|
|
213
|
+
Term = 3;
|
|
214
|
+
Method = 4;
|
|
215
|
+
TypeParameter = 5;
|
|
216
|
+
Parameter = 6;
|
|
217
|
+
// Can be used for any purpose.
|
|
218
|
+
Meta = 7;
|
|
219
|
+
Local = 8;
|
|
220
|
+
Macro = 9;
|
|
221
|
+
}
|
|
222
|
+
string name = 1;
|
|
223
|
+
string disambiguator = 2;
|
|
224
|
+
Suffix suffix = 3;
|
|
225
|
+
// NOTE: If you add new fields here, make sure to update the prepareSlot()
|
|
226
|
+
// function responsible for parsing symbols.
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
// Signature represents the signature of a symbol as it's displayed in API
|
|
230
|
+
// documentation or hover tooltips. It uses a subset of Document's fields with
|
|
231
|
+
// the same field numbers for wire compatibility with older indexes that encoded
|
|
232
|
+
// signatures using the Document message type.
|
|
233
|
+
message Signature {
|
|
234
|
+
// The language of the signature, e.g. "java", "go", "python".
|
|
235
|
+
string language = 4;
|
|
236
|
+
// The text content of the signature, e.g. "void add(int a, int b)".
|
|
237
|
+
string text = 5;
|
|
238
|
+
// (optional) Occurrences within the signature text that reference other
|
|
239
|
+
// symbols, enabling hyperlinking of types in the signature. Ranges are
|
|
240
|
+
// relative to the `text` field.
|
|
241
|
+
repeated Occurrence occurrences = 2;
|
|
242
|
+
|
|
243
|
+
// Reserved field numbers from the Document message to prevent accidental
|
|
244
|
+
// reuse, which would break wire compatibility with older indexes.
|
|
245
|
+
reserved 1, 3, 6;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
// SymbolInformation defines metadata about a symbol, such as the symbol's
|
|
249
|
+
// docstring or what package it's defined it.
|
|
250
|
+
message SymbolInformation {
|
|
251
|
+
// Identifier of this symbol, which can be referenced from `Occurence.symbol`.
|
|
252
|
+
// The string must be formatted according to the grammar in `Symbol`.
|
|
253
|
+
string symbol = 1;
|
|
254
|
+
// (optional, but strongly recommended) The markdown-formatted documentation
|
|
255
|
+
// for this symbol. Use `SymbolInformation.signature_documentation` to
|
|
256
|
+
// document the method/class/type signature of this symbol.
|
|
257
|
+
// Due to historical reasons, indexers may include signature documentation in
|
|
258
|
+
// this field by rendering markdown code blocks. New indexers should only
|
|
259
|
+
// include non-code documentation in this field, for example docstrings.
|
|
260
|
+
repeated string documentation = 3;
|
|
261
|
+
// (optional) Relationships to other symbols (e.g., implements, type definition).
|
|
262
|
+
repeated Relationship relationships = 4;
|
|
263
|
+
// The kind of this symbol. Use this field instead of
|
|
264
|
+
// `SymbolDescriptor.Suffix` to determine whether something is, for example, a
|
|
265
|
+
// class or a method.
|
|
266
|
+
Kind kind = 5;
|
|
267
|
+
// (optional) Kind represents the fine-grained category of a symbol, suitable for presenting
|
|
268
|
+
// information about the symbol's meaning in the language.
|
|
269
|
+
//
|
|
270
|
+
// For example:
|
|
271
|
+
// - A Java method would have the kind `Method` while a Go function would
|
|
272
|
+
// have the kind `Function`, even if the symbols for these use the same
|
|
273
|
+
// syntax for the descriptor `SymbolDescriptor.Suffix.Method`.
|
|
274
|
+
// - A Go struct has the symbol kind `Struct` while a Java class has
|
|
275
|
+
// the symbol kind `Class` even if they both have the same descriptor:
|
|
276
|
+
// `SymbolDescriptor.Suffix.Type`.
|
|
277
|
+
//
|
|
278
|
+
// Since Kind is more fine-grained than Suffix:
|
|
279
|
+
// - If two symbols have the same Kind, they should share the same Suffix.
|
|
280
|
+
// - If two symbols have different Suffixes, they should have different Kinds.
|
|
281
|
+
enum Kind {
|
|
282
|
+
UnspecifiedKind = 0;
|
|
283
|
+
// A method which may or may not have a body. For Java, Kotlin etc.
|
|
284
|
+
AbstractMethod = 66;
|
|
285
|
+
// For Ruby's attr_accessor
|
|
286
|
+
Accessor = 72;
|
|
287
|
+
Array = 1;
|
|
288
|
+
// For Alloy
|
|
289
|
+
Assertion = 2;
|
|
290
|
+
AssociatedType = 3;
|
|
291
|
+
// For C++
|
|
292
|
+
Attribute = 4;
|
|
293
|
+
// For Lean
|
|
294
|
+
Axiom = 5;
|
|
295
|
+
Boolean = 6;
|
|
296
|
+
Class = 7;
|
|
297
|
+
// For C++
|
|
298
|
+
Concept = 86;
|
|
299
|
+
Constant = 8;
|
|
300
|
+
Constructor = 9;
|
|
301
|
+
// For Solidity
|
|
302
|
+
Contract = 62;
|
|
303
|
+
// For Haskell
|
|
304
|
+
DataFamily = 10;
|
|
305
|
+
// For C# and F#
|
|
306
|
+
Delegate = 73;
|
|
307
|
+
Enum = 11;
|
|
308
|
+
EnumMember = 12;
|
|
309
|
+
Error = 63;
|
|
310
|
+
Event = 13;
|
|
311
|
+
// For Dart
|
|
312
|
+
Extension = 84;
|
|
313
|
+
// For Alloy
|
|
314
|
+
Fact = 14;
|
|
315
|
+
Field = 15;
|
|
316
|
+
File = 16;
|
|
317
|
+
Function = 17;
|
|
318
|
+
// For 'get' in Swift, 'attr_reader' in Ruby
|
|
319
|
+
Getter = 18;
|
|
320
|
+
// For Raku
|
|
321
|
+
Grammar = 19;
|
|
322
|
+
// For Purescript and Lean
|
|
323
|
+
Instance = 20;
|
|
324
|
+
Interface = 21;
|
|
325
|
+
Key = 22;
|
|
326
|
+
// For Racket
|
|
327
|
+
Lang = 23;
|
|
328
|
+
// For Lean
|
|
329
|
+
Lemma = 24;
|
|
330
|
+
// For solidity
|
|
331
|
+
Library = 64;
|
|
332
|
+
Macro = 25;
|
|
333
|
+
Method = 26;
|
|
334
|
+
// For Ruby
|
|
335
|
+
MethodAlias = 74;
|
|
336
|
+
// Analogous to 'ThisParameter' and 'SelfParameter', but for languages
|
|
337
|
+
// like Go where the receiver doesn't have a conventional name.
|
|
338
|
+
MethodReceiver = 27;
|
|
339
|
+
// Analogous to 'AbstractMethod', for Go.
|
|
340
|
+
MethodSpecification = 67;
|
|
341
|
+
// For Protobuf
|
|
342
|
+
Message = 28;
|
|
343
|
+
// For Dart
|
|
344
|
+
Mixin = 85;
|
|
345
|
+
// For Solidity
|
|
346
|
+
Modifier = 65;
|
|
347
|
+
Module = 29;
|
|
348
|
+
Namespace = 30;
|
|
349
|
+
Null = 31;
|
|
350
|
+
Number = 32;
|
|
351
|
+
Object = 33;
|
|
352
|
+
Operator = 34;
|
|
353
|
+
Package = 35;
|
|
354
|
+
PackageObject = 36;
|
|
355
|
+
Parameter = 37;
|
|
356
|
+
ParameterLabel = 38;
|
|
357
|
+
// For Haskell's PatternSynonyms
|
|
358
|
+
Pattern = 39;
|
|
359
|
+
// For Alloy
|
|
360
|
+
Predicate = 40;
|
|
361
|
+
Property = 41;
|
|
362
|
+
// Analogous to 'Trait' and 'TypeClass', for Swift and Objective-C
|
|
363
|
+
Protocol = 42;
|
|
364
|
+
// Analogous to 'AbstractMethod', for Swift and Objective-C.
|
|
365
|
+
ProtocolMethod = 68;
|
|
366
|
+
// Analogous to 'AbstractMethod', for C++.
|
|
367
|
+
PureVirtualMethod = 69;
|
|
368
|
+
// For Haskell
|
|
369
|
+
Quasiquoter = 43;
|
|
370
|
+
// 'self' in Python, Rust, Swift etc.
|
|
371
|
+
SelfParameter = 44;
|
|
372
|
+
// For 'set' in Swift, 'attr_writer' in Ruby
|
|
373
|
+
Setter = 45;
|
|
374
|
+
// For Alloy, analogous to 'Struct'.
|
|
375
|
+
Signature = 46;
|
|
376
|
+
// For Ruby
|
|
377
|
+
SingletonClass = 75;
|
|
378
|
+
// Analogous to 'StaticMethod', for Ruby.
|
|
379
|
+
SingletonMethod = 76;
|
|
380
|
+
// Analogous to 'StaticField', for C++
|
|
381
|
+
StaticDataMember = 77;
|
|
382
|
+
// For C#
|
|
383
|
+
StaticEvent = 78;
|
|
384
|
+
// For C#
|
|
385
|
+
StaticField = 79;
|
|
386
|
+
// For Java, C#, C++ etc.
|
|
387
|
+
StaticMethod = 80;
|
|
388
|
+
// For C#, TypeScript etc.
|
|
389
|
+
StaticProperty = 81;
|
|
390
|
+
// For C, C++
|
|
391
|
+
StaticVariable = 82;
|
|
392
|
+
String = 48;
|
|
393
|
+
Struct = 49;
|
|
394
|
+
// For Swift
|
|
395
|
+
Subscript = 47;
|
|
396
|
+
// For Lean
|
|
397
|
+
Tactic = 50;
|
|
398
|
+
// For Lean
|
|
399
|
+
Theorem = 51;
|
|
400
|
+
// Method receiver for languages
|
|
401
|
+
// 'this' in JavaScript, C++, Java etc.
|
|
402
|
+
ThisParameter = 52;
|
|
403
|
+
// Analogous to 'Protocol' and 'TypeClass', for Rust, Scala etc.
|
|
404
|
+
Trait = 53;
|
|
405
|
+
// Analogous to 'AbstractMethod', for Rust, Scala etc.
|
|
406
|
+
TraitMethod = 70;
|
|
407
|
+
// Data type definition for languages like OCaml which use `type`
|
|
408
|
+
// rather than separate keywords like `struct` and `enum`.
|
|
409
|
+
Type = 54;
|
|
410
|
+
TypeAlias = 55;
|
|
411
|
+
// Analogous to 'Trait' and 'Protocol', for Haskell, Purescript etc.
|
|
412
|
+
TypeClass = 56;
|
|
413
|
+
// Analogous to 'AbstractMethod', for Haskell, Purescript etc.
|
|
414
|
+
TypeClassMethod = 71;
|
|
415
|
+
// For Haskell
|
|
416
|
+
TypeFamily = 57;
|
|
417
|
+
TypeParameter = 58;
|
|
418
|
+
// For C, C++, Capn Proto
|
|
419
|
+
Union = 59;
|
|
420
|
+
Value = 60;
|
|
421
|
+
Variable = 61;
|
|
422
|
+
// Next = 87;
|
|
423
|
+
// Feel free to open a PR proposing new language-specific kinds.
|
|
424
|
+
}
|
|
425
|
+
// (optional) The name of this symbol as it should be displayed to the user.
|
|
426
|
+
// For example, the symbol "com/example/MyClass#myMethod(+1)." should have the
|
|
427
|
+
// display name "myMethod". The `symbol` field is not a reliable source of
|
|
428
|
+
// the display name for several reasons:
|
|
429
|
+
//
|
|
430
|
+
// - Local symbols don't encode the name.
|
|
431
|
+
// - Some languages have case-insensitive names, so the symbol is all-lowercase.
|
|
432
|
+
// - The symbol may encode names with special characters that should not be
|
|
433
|
+
// displayed to the user.
|
|
434
|
+
string display_name = 6;
|
|
435
|
+
// (optional) The signature of this symbol as it's displayed in API
|
|
436
|
+
// documentation or in hover tooltips. For example, a Java method that adds
|
|
437
|
+
// two numbers would have `Signature.language = "java"` and
|
|
438
|
+
// `Signature.text = "void add(int a, int b)"`. The `language` and `text`
|
|
439
|
+
// fields are required while `occurrences` can be optionally included to
|
|
440
|
+
// support hyperlinking referenced symbols in the signature.
|
|
441
|
+
Signature signature_documentation = 7;
|
|
442
|
+
// (optional) The enclosing symbol if this is a local symbol. For non-local
|
|
443
|
+
// symbols, the enclosing symbol should be parsed from the `symbol` field
|
|
444
|
+
// using the `Descriptor` grammar.
|
|
445
|
+
//
|
|
446
|
+
// The primary use-case for this field is to allow local symbol to be displayed
|
|
447
|
+
// in a symbol hierarchy for API documentation. It's OK to leave this field
|
|
448
|
+
// empty for local variables since local variables usually don't belong in API
|
|
449
|
+
// documentation. However, in the situation that you wish to include a local
|
|
450
|
+
// symbol in the hierarchy, then you can use `enclosing_symbol` to locate the
|
|
451
|
+
// "parent" or "owner" of this local symbol. For example, a Java indexer may
|
|
452
|
+
// choose to use local symbols for private class fields while providing an
|
|
453
|
+
// `enclosing_symbol` to reference the enclosing class to allow the field to
|
|
454
|
+
// be part of the class documentation hierarchy. From the perspective of an
|
|
455
|
+
// author of an indexer, the decision to use a local symbol or global symbol
|
|
456
|
+
// should exclusively be determined whether the local symbol is accessible
|
|
457
|
+
// outside the document, not by the capability to find the enclosing
|
|
458
|
+
// symbol.
|
|
459
|
+
string enclosing_symbol = 8;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
message Relationship {
|
|
463
|
+
string symbol = 1;
|
|
464
|
+
// When resolving "Find references", this field documents what other symbols
|
|
465
|
+
// should be included together with this symbol. For example, consider the
|
|
466
|
+
// following TypeScript code that defines two symbols `Animal#sound()` and
|
|
467
|
+
// `Dog#sound()`:
|
|
468
|
+
// ```ts
|
|
469
|
+
// interface Animal {
|
|
470
|
+
// ^^^^^^ definition Animal#
|
|
471
|
+
// sound(): string
|
|
472
|
+
// ^^^^^ definition Animal#sound()
|
|
473
|
+
// }
|
|
474
|
+
// class Dog implements Animal {
|
|
475
|
+
// ^^^ definition Dog#, relationships = [{symbol: "Animal#", is_implementation: true}]
|
|
476
|
+
// public sound(): string { return "woof" }
|
|
477
|
+
// ^^^^^ definition Dog#sound(), references_symbols = Animal#sound(), relationships = [{symbol: "Animal#sound()", is_implementation:true, is_reference: true}]
|
|
478
|
+
// }
|
|
479
|
+
// const animal: Animal = new Dog()
|
|
480
|
+
// ^^^^^^ reference Animal#
|
|
481
|
+
// console.log(animal.sound())
|
|
482
|
+
// ^^^^^ reference Animal#sound()
|
|
483
|
+
// ```
|
|
484
|
+
// Doing "Find references" on the symbol `Animal#sound()` should return
|
|
485
|
+
// references to the `Dog#sound()` method as well. Vice-versa, doing "Find
|
|
486
|
+
// references" on the `Dog#sound()` method should include references to the
|
|
487
|
+
// `Animal#sound()` method as well.
|
|
488
|
+
bool is_reference = 2;
|
|
489
|
+
// Similar to `is_reference` but for "Find implementations".
|
|
490
|
+
// It's common for `is_implementation` and `is_reference` to both be true but
|
|
491
|
+
// it's not always the case.
|
|
492
|
+
// In the TypeScript example above, observe that `Dog#` has an
|
|
493
|
+
// `is_implementation` relationship with `"Animal#"` but not `is_reference`.
|
|
494
|
+
// This is because "Find references" on the "Animal#" symbol should not return
|
|
495
|
+
// "Dog#". We only want "Dog#" to return as a result for "Find
|
|
496
|
+
// implementations" on the "Animal#" symbol.
|
|
497
|
+
bool is_implementation = 3;
|
|
498
|
+
// Similar to `references_symbols` but for "Go to type definition".
|
|
499
|
+
bool is_type_definition = 4;
|
|
500
|
+
// Allows overriding the behavior of "Go to definition" and "Find references"
|
|
501
|
+
// for symbols which do not have a definition of their own or could
|
|
502
|
+
// potentially have multiple definitions.
|
|
503
|
+
//
|
|
504
|
+
// For example, in a language with single inheritance and no field overriding,
|
|
505
|
+
// inherited fields can reuse the same symbol as the ancestor which declares
|
|
506
|
+
// the field. In such a situation, is_definition is not needed.
|
|
507
|
+
//
|
|
508
|
+
// On the other hand, in languages with single inheritance and some form
|
|
509
|
+
// of mixins, you can use is_definition to relate the symbol to the
|
|
510
|
+
// matching symbol in ancestor classes, and is_reference to relate the
|
|
511
|
+
// symbol to the matching symbol in mixins.
|
|
512
|
+
bool is_definition = 5;
|
|
513
|
+
// Update registerInverseRelationships on adding a new field here.
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
// SymbolRole declares what "role" a symbol has in an occurrence. A role is
|
|
517
|
+
// encoded as a bitset where each bit represents a different role. For example,
|
|
518
|
+
// to determine if the `Import` role is set, test whether the second bit of the
|
|
519
|
+
// enum value is defined. In pseudocode, this can be implemented with the
|
|
520
|
+
// logic: `const isImportRole = (role.value & SymbolRole.Import.value) > 0`.
|
|
521
|
+
enum SymbolRole {
|
|
522
|
+
// This case is not meant to be used; it only exists to avoid an error
|
|
523
|
+
// from the Protobuf code generator.
|
|
524
|
+
UnspecifiedSymbolRole = 0;
|
|
525
|
+
// Is the symbol defined here? If not, then this is a symbol reference.
|
|
526
|
+
Definition = 0x1;
|
|
527
|
+
// Is the symbol imported here?
|
|
528
|
+
Import = 0x2;
|
|
529
|
+
// Is the symbol written here?
|
|
530
|
+
WriteAccess = 0x4;
|
|
531
|
+
// Is the symbol read here?
|
|
532
|
+
ReadAccess = 0x8;
|
|
533
|
+
// Is the symbol in generated code?
|
|
534
|
+
Generated = 0x10;
|
|
535
|
+
// Is the symbol in test code?
|
|
536
|
+
Test = 0x20;
|
|
537
|
+
// Is this a signature for a symbol that is defined elsewhere?
|
|
538
|
+
//
|
|
539
|
+
// Applies to forward declarations for languages like C, C++
|
|
540
|
+
// and Objective-C, as well as `val` declarations in interface
|
|
541
|
+
// files in languages like SML and OCaml.
|
|
542
|
+
ForwardDefinition = 0x40;
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
enum SyntaxKind {
|
|
546
|
+
option allow_alias = true;
|
|
547
|
+
|
|
548
|
+
UnspecifiedSyntaxKind = 0;
|
|
549
|
+
|
|
550
|
+
// Comment, including comment markers and text
|
|
551
|
+
Comment = 1;
|
|
552
|
+
|
|
553
|
+
// `;` `.` `,`
|
|
554
|
+
PunctuationDelimiter = 2;
|
|
555
|
+
// (), {}, [] when used syntactically
|
|
556
|
+
PunctuationBracket = 3;
|
|
557
|
+
|
|
558
|
+
// `if`, `else`, `return`, `class`, etc.
|
|
559
|
+
Keyword = 4;
|
|
560
|
+
IdentifierKeyword = 4 [deprecated = true];
|
|
561
|
+
|
|
562
|
+
// `+`, `*`, etc.
|
|
563
|
+
IdentifierOperator = 5;
|
|
564
|
+
|
|
565
|
+
// non-specific catch-all for any identifier not better described elsewhere
|
|
566
|
+
Identifier = 6;
|
|
567
|
+
// Identifiers builtin to the language: `min`, `print` in Python.
|
|
568
|
+
IdentifierBuiltin = 7;
|
|
569
|
+
// Identifiers representing `null`-like values: `None` in Python, `nil` in Go.
|
|
570
|
+
IdentifierNull = 8;
|
|
571
|
+
// `xyz` in `const xyz = "hello"`
|
|
572
|
+
IdentifierConstant = 9;
|
|
573
|
+
// `var X = "hello"` in Go
|
|
574
|
+
IdentifierMutableGlobal = 10;
|
|
575
|
+
// Parameter definition and references
|
|
576
|
+
IdentifierParameter = 11;
|
|
577
|
+
// Identifiers for variable definitions and references within a local scope
|
|
578
|
+
IdentifierLocal = 12;
|
|
579
|
+
// Identifiers that shadow other identifiers in an outer scope
|
|
580
|
+
IdentifierShadowed = 13;
|
|
581
|
+
// Identifier representing a unit of code abstraction and/or namespacing.
|
|
582
|
+
//
|
|
583
|
+
// NOTE: This corresponds to a package in Go and JVM languages,
|
|
584
|
+
// and a module in languages like Python and JavaScript.
|
|
585
|
+
IdentifierNamespace = 14;
|
|
586
|
+
IdentifierModule = 14 [deprecated = true];
|
|
587
|
+
|
|
588
|
+
// Function references, including calls
|
|
589
|
+
IdentifierFunction = 15;
|
|
590
|
+
// Function definition only
|
|
591
|
+
IdentifierFunctionDefinition = 16;
|
|
592
|
+
|
|
593
|
+
// Macro references, including invocations
|
|
594
|
+
IdentifierMacro = 17;
|
|
595
|
+
// Macro definition only
|
|
596
|
+
IdentifierMacroDefinition = 18;
|
|
597
|
+
|
|
598
|
+
// non-builtin types
|
|
599
|
+
IdentifierType = 19;
|
|
600
|
+
// builtin types only, such as `str` for Python or `int` in Go
|
|
601
|
+
IdentifierBuiltinType = 20;
|
|
602
|
+
|
|
603
|
+
// Python decorators, c-like __attribute__
|
|
604
|
+
IdentifierAttribute = 21;
|
|
605
|
+
|
|
606
|
+
// `\b`
|
|
607
|
+
RegexEscape = 22;
|
|
608
|
+
// `*`, `+`
|
|
609
|
+
RegexRepeated = 23;
|
|
610
|
+
// `.`
|
|
611
|
+
RegexWildcard = 24;
|
|
612
|
+
// `(`, `)`, `[`, `]`
|
|
613
|
+
RegexDelimiter = 25;
|
|
614
|
+
// `|`, `-`
|
|
615
|
+
RegexJoin = 26;
|
|
616
|
+
|
|
617
|
+
// Literal strings: "Hello, world!"
|
|
618
|
+
StringLiteral = 27;
|
|
619
|
+
// non-regex escapes: "\t", "\n"
|
|
620
|
+
StringLiteralEscape = 28;
|
|
621
|
+
// datetimes within strings, special words within a string, `{}` in format strings
|
|
622
|
+
StringLiteralSpecial = 29;
|
|
623
|
+
// "key" in { "key": "value" }, useful for example in JSON
|
|
624
|
+
StringLiteralKey = 30;
|
|
625
|
+
// 'c' or similar, in languages that differentiate strings and characters
|
|
626
|
+
CharacterLiteral = 31;
|
|
627
|
+
// Literal numbers, both floats and integers
|
|
628
|
+
NumericLiteral = 32;
|
|
629
|
+
// `true`, `false`
|
|
630
|
+
BooleanLiteral = 33;
|
|
631
|
+
|
|
632
|
+
// Used for XML-like tags
|
|
633
|
+
Tag = 34;
|
|
634
|
+
// Attribute name in XML-like tags
|
|
635
|
+
TagAttribute = 35;
|
|
636
|
+
// Delimiters for XML-like tags
|
|
637
|
+
TagDelimiter = 36;
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
// Occurrence associates a source position with a symbol and/or highlighting
|
|
641
|
+
// information.
|
|
642
|
+
//
|
|
643
|
+
// If possible, indexers should try to bundle logically related information
|
|
644
|
+
// across occurrences into a single occurrence to reduce payload sizes.
|
|
645
|
+
message Occurrence {
|
|
646
|
+
// Half-open [start, end) range of this occurrence. Must be exactly three or four
|
|
647
|
+
// elements:
|
|
648
|
+
//
|
|
649
|
+
// - Four elements: `[startLine, startCharacter, endLine, endCharacter]`
|
|
650
|
+
// - Three elements: `[startLine, startCharacter, endCharacter]`. The end line
|
|
651
|
+
// is inferred to have the same value as the start line.
|
|
652
|
+
//
|
|
653
|
+
// It is allowed for the range to be empty (i.e. start==end).
|
|
654
|
+
//
|
|
655
|
+
// Line numbers and characters are always 0-based. Make sure to increment the
|
|
656
|
+
// line/character values before displaying them in an editor-like UI because
|
|
657
|
+
// editors conventionally use 1-based numbers.
|
|
658
|
+
//
|
|
659
|
+
// The 'character' value is interpreted based on the PositionEncoding for
|
|
660
|
+
// the Document.
|
|
661
|
+
//
|
|
662
|
+
// Historical note: the original draft of this schema had a `Range` message
|
|
663
|
+
// type with `start` and `end` fields of type `Position`, mirroring LSP.
|
|
664
|
+
// Benchmarks revealed that this encoding was inefficient and that we could
|
|
665
|
+
// reduce the total payload size of an index by 50% by using `repeated int32`
|
|
666
|
+
// instead. The `repeated int32` encoding is admittedly more embarrassing to
|
|
667
|
+
// work with in some programming languages but we hope the performance
|
|
668
|
+
// improvements make up for it.
|
|
669
|
+
repeated int32 range = 1;
|
|
670
|
+
// (optional) The symbol that appears at this position. See
|
|
671
|
+
// `SymbolInformation.symbol` for how to format symbols as strings.
|
|
672
|
+
string symbol = 2;
|
|
673
|
+
// (optional) Bitset containing `SymbolRole`s in this occurrence.
|
|
674
|
+
// See `SymbolRole`'s documentation for how to read and write this field.
|
|
675
|
+
int32 symbol_roles = 3;
|
|
676
|
+
// (optional) CommonMark-formatted documentation for this specific range. If
|
|
677
|
+
// empty, the `Symbol.documentation` field is used instead. One example
|
|
678
|
+
// where this field might be useful is when the symbol represents a generic
|
|
679
|
+
// function (with abstract type parameters such as `List<T>`) and at this
|
|
680
|
+
// occurrence we know the exact values (such as `List<String>`).
|
|
681
|
+
//
|
|
682
|
+
// This field can also be used for dynamically or gradually typed languages,
|
|
683
|
+
// which commonly allow for type-changing assignment.
|
|
684
|
+
repeated string override_documentation = 4;
|
|
685
|
+
// (optional) What syntax highlighting class should be used for this range?
|
|
686
|
+
SyntaxKind syntax_kind = 5;
|
|
687
|
+
// (optional) Diagnostics that have been reported for this specific range.
|
|
688
|
+
repeated Diagnostic diagnostics = 6;
|
|
689
|
+
// (optional) Using the same encoding as the sibling `range` field, half-open
|
|
690
|
+
// source range of the nearest non-trivial enclosing AST node. This range must
|
|
691
|
+
// enclose the `range` field. Example applications that make use of the
|
|
692
|
+
// enclosing_range field:
|
|
693
|
+
//
|
|
694
|
+
// - Call hierarchies: to determine what symbols are references from the body
|
|
695
|
+
// of a function
|
|
696
|
+
// - Symbol outline: to display breadcrumbs from the cursor position to the
|
|
697
|
+
// root of the file
|
|
698
|
+
// - Expand selection: to select the nearest enclosing AST node.
|
|
699
|
+
// - Highlight range: to indicate the AST expression that is associated with a
|
|
700
|
+
// hover popover
|
|
701
|
+
//
|
|
702
|
+
// For definition occurrences, the enclosing range should indicate the
|
|
703
|
+
// start/end bounds of the entire definition AST node, including
|
|
704
|
+
// documentation.
|
|
705
|
+
// ```
|
|
706
|
+
// const n = 3
|
|
707
|
+
// ^ range
|
|
708
|
+
// ^^^^^^^^^^^ enclosing_range
|
|
709
|
+
//
|
|
710
|
+
// /** Parses the string into something */
|
|
711
|
+
// ^ enclosing_range start --------------------------------------|
|
|
712
|
+
// function parse(input string): string { |
|
|
713
|
+
// ^^^^^ range |
|
|
714
|
+
// return input.slice(n) |
|
|
715
|
+
// } |
|
|
716
|
+
// ^ enclosing_range end <---------------------------------------|
|
|
717
|
+
// ```
|
|
718
|
+
//
|
|
719
|
+
// Any attributes/decorators/attached macros should also be part of the
|
|
720
|
+
// enclosing range.
|
|
721
|
+
//
|
|
722
|
+
// ```python
|
|
723
|
+
// @cache
|
|
724
|
+
// ^ enclosing_range start---------------------|
|
|
725
|
+
// def factorial(n): |
|
|
726
|
+
// return n * factorial(n-1) if n else 1 |
|
|
727
|
+
// < enclosing_range end-----------------------|
|
|
728
|
+
//
|
|
729
|
+
// ```
|
|
730
|
+
//
|
|
731
|
+
// For reference occurrences, the enclosing range should indicate the start/end
|
|
732
|
+
// bounds of the parent expression.
|
|
733
|
+
// ```
|
|
734
|
+
// const a = a.b
|
|
735
|
+
// ^ range
|
|
736
|
+
// ^^^ enclosing_range
|
|
737
|
+
// const b = a.b(41).f(42).g(43)
|
|
738
|
+
// ^ range
|
|
739
|
+
// ^^^^^^^^^^^^^ enclosing_range
|
|
740
|
+
// ```
|
|
741
|
+
repeated int32 enclosing_range = 7;
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
// Represents a diagnostic, such as a compiler error or warning, which should be
|
|
745
|
+
// reported for a document.
|
|
746
|
+
message Diagnostic {
|
|
747
|
+
// Should this diagnostic be reported as an error, warning, info, or hint?
|
|
748
|
+
Severity severity = 1;
|
|
749
|
+
// (optional) Code of this diagnostic, which might appear in the user interface.
|
|
750
|
+
string code = 2;
|
|
751
|
+
// Message of this diagnostic.
|
|
752
|
+
string message = 3;
|
|
753
|
+
// (optional) Human-readable string describing the source of this diagnostic, e.g.
|
|
754
|
+
// 'typescript' or 'super lint'.
|
|
755
|
+
string source = 4;
|
|
756
|
+
repeated DiagnosticTag tags = 5;
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
enum Severity {
|
|
760
|
+
UnspecifiedSeverity = 0;
|
|
761
|
+
Error = 1;
|
|
762
|
+
Warning = 2;
|
|
763
|
+
Information = 3;
|
|
764
|
+
Hint = 4;
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
enum DiagnosticTag {
|
|
768
|
+
UnspecifiedDiagnosticTag = 0;
|
|
769
|
+
Unnecessary = 1;
|
|
770
|
+
Deprecated = 2;
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
// Language standardises names of common programming languages that can be used
|
|
774
|
+
// for the `Document.language` field. The primary purpose of this enum is to
|
|
775
|
+
// prevent a situation where we have a single programming language ends up with
|
|
776
|
+
// multiple string representations. For example, the C++ language uses the name
|
|
777
|
+
// "CPP" in this enum and other names such as "cpp" are incompatible.
|
|
778
|
+
// Feel free to send a pull-request to add missing programming languages.
|
|
779
|
+
enum Language {
|
|
780
|
+
UnspecifiedLanguage = 0;
|
|
781
|
+
ABAP = 60;
|
|
782
|
+
Apex = 96;
|
|
783
|
+
APL = 49;
|
|
784
|
+
Ada = 39;
|
|
785
|
+
Agda = 45;
|
|
786
|
+
AsciiDoc = 86;
|
|
787
|
+
Assembly = 58;
|
|
788
|
+
Awk = 66;
|
|
789
|
+
Bat = 68;
|
|
790
|
+
BibTeX = 81;
|
|
791
|
+
C = 34;
|
|
792
|
+
COBOL = 59;
|
|
793
|
+
CPP = 35; // C++ (the name "CPP" was chosen for consistency with LSP)
|
|
794
|
+
CSS = 26;
|
|
795
|
+
CSharp = 1;
|
|
796
|
+
Clojure = 8;
|
|
797
|
+
Coffeescript = 21;
|
|
798
|
+
CommonLisp = 9;
|
|
799
|
+
Coq = 47;
|
|
800
|
+
CUDA = 97;
|
|
801
|
+
Dart = 3;
|
|
802
|
+
Delphi = 57;
|
|
803
|
+
Diff = 88;
|
|
804
|
+
Dockerfile = 80;
|
|
805
|
+
Dyalog = 50;
|
|
806
|
+
Elixir = 17;
|
|
807
|
+
Erlang = 18;
|
|
808
|
+
FSharp = 42;
|
|
809
|
+
Fish = 65;
|
|
810
|
+
Flow = 24;
|
|
811
|
+
Fortran = 56;
|
|
812
|
+
Git_Commit = 91;
|
|
813
|
+
Git_Config = 89;
|
|
814
|
+
Git_Rebase = 92;
|
|
815
|
+
Go = 33;
|
|
816
|
+
GraphQL = 98;
|
|
817
|
+
Groovy = 7;
|
|
818
|
+
HTML = 30;
|
|
819
|
+
Hack = 20;
|
|
820
|
+
Handlebars = 90;
|
|
821
|
+
Haskell = 44;
|
|
822
|
+
Idris = 46;
|
|
823
|
+
Ini = 72;
|
|
824
|
+
J = 51;
|
|
825
|
+
JSON = 75;
|
|
826
|
+
Java = 6;
|
|
827
|
+
JavaScript = 22;
|
|
828
|
+
JavaScriptReact = 93;
|
|
829
|
+
Jsonnet = 76;
|
|
830
|
+
Julia = 55;
|
|
831
|
+
Justfile = 109;
|
|
832
|
+
Kotlin = 4;
|
|
833
|
+
LaTeX = 83;
|
|
834
|
+
Lean = 48;
|
|
835
|
+
Less = 27;
|
|
836
|
+
Lua = 12;
|
|
837
|
+
Luau = 108;
|
|
838
|
+
Makefile = 79;
|
|
839
|
+
Markdown = 84;
|
|
840
|
+
Matlab = 52;
|
|
841
|
+
Nickel = 110; // https://nickel-lang.org/
|
|
842
|
+
Nix = 77;
|
|
843
|
+
OCaml = 41;
|
|
844
|
+
Objective_C = 36;
|
|
845
|
+
Objective_CPP = 37;
|
|
846
|
+
Pascal = 99;
|
|
847
|
+
PHP = 19;
|
|
848
|
+
PLSQL = 70;
|
|
849
|
+
Perl = 13;
|
|
850
|
+
PowerShell = 67;
|
|
851
|
+
Prolog = 71;
|
|
852
|
+
Protobuf = 100;
|
|
853
|
+
Python = 15;
|
|
854
|
+
R = 54;
|
|
855
|
+
Racket = 11;
|
|
856
|
+
Raku = 14;
|
|
857
|
+
Razor = 62;
|
|
858
|
+
Repro = 102; // Internal language for testing SCIP
|
|
859
|
+
ReST = 85;
|
|
860
|
+
Ruby = 16;
|
|
861
|
+
Rust = 40;
|
|
862
|
+
SAS = 61;
|
|
863
|
+
SCSS = 29;
|
|
864
|
+
SML = 43;
|
|
865
|
+
SQL = 69;
|
|
866
|
+
Sass = 28;
|
|
867
|
+
Scala = 5;
|
|
868
|
+
Scheme = 10;
|
|
869
|
+
ShellScript = 64; // Bash
|
|
870
|
+
Skylark = 78;
|
|
871
|
+
Slang = 107;
|
|
872
|
+
Solidity = 95;
|
|
873
|
+
Svelte = 106;
|
|
874
|
+
Swift = 2;
|
|
875
|
+
Tcl = 101;
|
|
876
|
+
TOML = 73;
|
|
877
|
+
TeX = 82;
|
|
878
|
+
Thrift = 103;
|
|
879
|
+
TypeScript = 23;
|
|
880
|
+
TypeScriptReact = 94;
|
|
881
|
+
Verilog = 104;
|
|
882
|
+
VHDL = 105;
|
|
883
|
+
VisualBasic = 63;
|
|
884
|
+
Vue = 25;
|
|
885
|
+
Wolfram = 53;
|
|
886
|
+
XML = 31;
|
|
887
|
+
XSL = 32;
|
|
888
|
+
YAML = 74;
|
|
889
|
+
Zig = 38;
|
|
890
|
+
// NextLanguage = 111;
|
|
891
|
+
// Steps add a new language:
|
|
892
|
+
// 1. Copy-paste the "NextLanguage = N" line above
|
|
893
|
+
// 2. Increment "NextLanguage = N" to "NextLanguage = N+1"
|
|
894
|
+
// 3. Replace "NextLanguage = N" with the name of the new language.
|
|
895
|
+
// 4. Move the new language to the correct line above using alphabetical order
|
|
896
|
+
// 5. (optional) Add a brief comment behind the language if the name is not self-explanatory
|
|
897
|
+
}
|