Skip to content

Commit 26c40ff

Browse files
committed
Document type/call hierarchies in the ycmd API
1 parent 37eb656 commit 26c40ff

File tree

5 files changed

+240
-8
lines changed

5 files changed

+240
-8
lines changed

docs/bundle.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/index.html

+164
Original file line numberDiff line numberDiff line change
@@ -2365,6 +2365,21 @@ <h3 class="panel-title"><span class="operation-name">POST</span> <strong>/run_co
23652365
messages are typically multiple lines (such as the documentation and
23662366
signature for a method) and are best displayed in a panel or preview
23672367
area (or equivalent).</li>
2368+
<li>A <em>Hierarchy</em> response. This is identified where the type of the
2369+
response is a list of objects containing <code>kind</code> and <code>locations</code>
2370+
properties.
2371+
Hierarchy requests work similarly to those in the LSP specification.
2372+
If a completer supports call/type hierarchies, the initial request
2373+
should be sent through <code>TypeHierarchy</code>/<code>CallHierarchy</code> subcommand.
2374+
Resolving any item in the hierarchy tree is done by subsequent
2375+
<code>ResolveCallHierarchyItem</code> and <code>ResolveTypeHierarchyItem</code> requests.
2376+
When resolving a hierarchy item, the arguments following
2377+
the subcommand name are the item being resolved and the direction in
2378+
which the item should be resolved.
2379+
For call hierarchies, the directions are <code>incoming</code> and <code>outgoing</code>.
2380+
For type hierarchies, the directions are <code>subtypes</code> and <code>supertypes</code>.
2381+
Note that, except for the root node of the hierarchy, resolving an
2382+
item in both directions is discouraged.</li>
23682383
<li>A <em>GoTo</em> response. This is identified where the response type cannot
23692384
be determined by any of the above methods. A GoTo response may contain
23702385
either a single location (e.g. for <code>GoToDeclaration</code>), or a list of
@@ -4524,6 +4539,121 @@ <h3 class="panel-title"><a name="/definitions/FixIt"></a>FixIt:
45244539
</section>
45254540
</div>
45264541
</div>
4542+
<div id="definition-Hierarchy" class="panel panel-definition">
4543+
<div class="panel-heading">
4544+
<h3 class="panel-title"><a name="/definitions/Hierarchy"></a>Hierarchy:
4545+
<span class="json-property-type">
4546+
<span class="json-property-type">object</span>
4547+
<span class="json-property-range" title="Value limits"></span>
4548+
4549+
</span>
4550+
</h3>
4551+
</div>
4552+
<div class="panel-body">
4553+
<section class="json-schema-description">
4554+
<p>An object returned, in a list, as a response to hierarchy requests.
4555+
The object may contain additional properties, which are used to identify
4556+
the hierarchy tree node, by the subservers.</p>
4557+
4558+
</section>
4559+
4560+
<section class="json-schema-properties">
4561+
<dl>
4562+
<dt data-property-name="kind">
4563+
<span class="json-property-name">kind:</span>
4564+
4565+
<span class="json-property-type">string</span> <span class="json-property-enum" title="Possible values">, x &isin; {
4566+
<span class="json-property-enum-item">File</span>
4567+
,
4568+
<span class="json-property-enum-item">Module</span>
4569+
,
4570+
<span class="json-property-enum-item">Namespace</span>
4571+
,
4572+
<span class="json-property-enum-item">Package</span>
4573+
,
4574+
<span class="json-property-enum-item">Class</span>
4575+
,
4576+
<span class="json-property-enum-item">Method</span>
4577+
,
4578+
<span class="json-property-enum-item">Property</span>
4579+
,
4580+
<span class="json-property-enum-item">Field</span>
4581+
,
4582+
<span class="json-property-enum-item">Constructor</span>
4583+
,
4584+
<span class="json-property-enum-item">Enum</span>
4585+
,
4586+
<span class="json-property-enum-item">Interface</span>
4587+
,
4588+
<span class="json-property-enum-item">Function</span>
4589+
,
4590+
<span class="json-property-enum-item">Variable</span>
4591+
,
4592+
<span class="json-property-enum-item">Constant</span>
4593+
,
4594+
<span class="json-property-enum-item">String</span>
4595+
,
4596+
<span class="json-property-enum-item">Number</span>
4597+
,
4598+
<span class="json-property-enum-item">Boolean</span>
4599+
,
4600+
<span class="json-property-enum-item">Array</span>
4601+
,
4602+
<span class="json-property-enum-item">Object</span>
4603+
,
4604+
<span class="json-property-enum-item">Key</span>
4605+
,
4606+
<span class="json-property-enum-item"></span>
4607+
,
4608+
<span class="json-property-enum-item">EnumMember</span>
4609+
,
4610+
<span class="json-property-enum-item">Struct</span>
4611+
,
4612+
<span class="json-property-enum-item">Event</span>
4613+
,
4614+
<span class="json-property-enum-item">Operator</span>
4615+
,
4616+
<span class="json-property-enum-item">TypeParameter</span>
4617+
4618+
}
4619+
</span>
4620+
<span class="json-property-range" title="Value limits"></span>
4621+
4622+
<span class="json-property-required"></span>
4623+
</dt>
4624+
<dd>
4625+
4626+
<div class="json-inner-schema">
4627+
4628+
</div>
4629+
</dd>
4630+
<dt data-property-name="locations">
4631+
<span class="json-property-name">locations:</span>
4632+
4633+
<span class="json-property-type">object[]</span>
4634+
<span class="json-property-range" title="Value limits"></span>
4635+
4636+
<span class="json-property-required"></span>
4637+
</dt>
4638+
<dd>
4639+
4640+
<div class="json-inner-schema">
4641+
4642+
<section class="json-schema-array-items">
4643+
4644+
<span class="json-property-type"> <a class="json-schema-ref" href="#/defintions/Location">#/defintions/Location</a>
4645+
</span>
4646+
<span class="json-property-range" title="Value limits"></span>
4647+
4648+
<div class="json-inner-schema">
4649+
4650+
</div>
4651+
</section> </div>
4652+
</dd>
4653+
</dl>
4654+
</section>
4655+
</div>
4656+
</div>
45274657
<div id="definition-InlayHint" class="panel panel-definition">
45284658
<div class="panel-heading">
45294659
<h3 class="panel-title"><a name="/definitions/InlayHint"></a>InlayHint:
@@ -4548,6 +4678,8 @@ <h3 class="panel-title"><a name="/definitions/InlayHint"></a>InlayHint:
45484678
<span class="json-property-name">kind:</span>
45494679

45504680
<span class="json-property-type">string</span> <span class="json-property-enum" title="Possible values">, x &isin; {
4681+
<span class="json-property-enum-item">Unknown</span>
4682+
,
45514683
<span class="json-property-enum-item">Type</span>
45524684
,
45534685
<span class="json-property-enum-item">Parameter</span>
@@ -5448,6 +5580,38 @@ <h3 class="panel-title"><a name="/definitions/SubcommandResponse"></a>Subcommand
54485580

54495581
</div>
54505582
</dd>
5583+
<dt data-property-name="kind">
5584+
<span class="json-property-name">kind:</span>
5585+
5586+
<span class="json-property-type">string</span>
5587+
<span class="json-property-range" title="Value limits"></span>
5588+
5589+
</dt>
5590+
<dd>
5591+
<p>If present, this is a <em>Hierarchy response</em> and this value
5592+
describes the kind of symbol a node in the call/type hierarchy
5593+
tree is referring to.</p>
5594+
5595+
<div class="json-inner-schema">
5596+
5597+
</div>
5598+
</dd>
5599+
<dt data-property-name="locations">
5600+
<span class="json-property-name">locations:</span>
5601+
5602+
<span class="json-property-type">object[]</span>
5603+
<span class="json-property-range" title="Value limits"></span>
5604+
5605+
</dt>
5606+
<dd>
5607+
<p>If present, this is a <em>Hierarchy response</em> and this value
5608+
contains a list of locations that a node in the call/type
5609+
hierarchy tree is referring to.</p>
5610+
5611+
<div class="json-inner-schema">
5612+
5613+
</div>
5614+
</dd>
54515615
<dt data-property-name="line_num">
54525616
<span class="json-property-name">line_num:</span>
54535617

docs/main.css.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/openapi.yml

+74-1
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,49 @@ definitions:
190190
191191
additionalProperties:
192192
$ref: "#/definitions/FileData"
193-
193+
Hierarchy:
194+
type: object
195+
required:
196+
- kind
197+
- locations
198+
description: |-
199+
An object returned, in a list, as a response to hierarchy requests.
200+
The object may contain additional properties, which are used to identify
201+
the hierarchy tree node, by the subservers.
202+
properties:
203+
kind:
204+
type: string
205+
enum:
206+
- File
207+
- Module
208+
- Namespace
209+
- Package
210+
- Class
211+
- Method
212+
- Property
213+
- Field
214+
- Constructor
215+
- Enum
216+
- Interface
217+
- Function
218+
- Variable
219+
- Constant
220+
- String
221+
- Number
222+
- Boolean
223+
- Array
224+
- Object
225+
- Key
226+
- Null
227+
- EnumMember
228+
- Struct
229+
- Event
230+
- Operator
231+
- TypeParameter
232+
locations:
233+
type: array
234+
items:
235+
$ref: "#/defintions/Location"
194236
# Due to the way the API combines keys at the top level, we are not able to
195237
# compose this item per-request. So this definition must be copy-pasted for
196238
# some requests.
@@ -368,6 +410,22 @@ definitions:
368410
If present, this is a single *GoTo response* and this value
369411
contains the absolute path of the buffer containing the
370412
target location (identified in `line_num` and `column_num`).
413+
kind:
414+
type: string
415+
description: |-
416+
If present, this is a *Hierarchy response* and this value
417+
describes the kind of symbol a node in the call/type hierarchy
418+
tree is referring to.
419+
hierarchy details:
420+
$ref: "#/definitions/Hierarchy"
421+
locations:
422+
type: array
423+
description: |-
424+
If present, this is a *Hierarchy response* and this value
425+
contains a list of locations that a node in the call/type
426+
hierarchy tree is referring to.
427+
hierarchy details:
428+
$ref: "#/definitions/Hierarchy"
371429
line_num:
372430
$ref: "#/definitions/LineNumber"
373431
column_num:
@@ -886,6 +944,21 @@ paths:
886944
messages are typically multiple lines (such as the documentation and
887945
signature for a method) and are best displayed in a panel or preview
888946
area (or equivalent).
947+
- A *Hierarchy* response. This is identified where the type of the
948+
response is a list of objects containing `kind` and `locations`
949+
properties.
950+
Hierarchy requests work similarly to those in the LSP specification.
951+
If a completer supports call/type hierarchies, the initial request
952+
should be sent through `TypeHierarchy`/`CallHierarchy` subcommand.
953+
Resolving any item in the hierarchy tree is done by subsequent
954+
`ResolveCallHierarchyItem` and `ResolveTypeHierarchyItem` requests.
955+
When resolving a hierarchy item, the arguments following
956+
the subcommand name are the item being resolved and the direction in
957+
which the item should be resolved.
958+
For call hierarchies, the directions are `incoming` and `outgoing`.
959+
For type hierarchies, the directions are `subtypes` and `supertypes`.
960+
Note that, except for the root node of the hierarchy, resolving an
961+
item in both directions is discouraged.
889962
- A *GoTo* response. This is identified where the response type cannot
890963
be determined by any of the above methods. A GoTo response may contain
891964
either a single location (e.g. for `GoToDeclaration`), or a list of

update_api_docs.py

-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
#!/usr/bin/env python3
22

3-
from __future__ import print_function
4-
from __future__ import division
5-
from __future__ import unicode_literals
6-
from __future__ import absolute_import
7-
83
import os
94
import platform
105
import sys

0 commit comments

Comments
 (0)