Skip to content

Commit 7201ba1

Browse files
committed
Add type hierarchy to the spec
1 parent 4d7c820 commit 7201ba1

File tree

4 files changed

+212
-2
lines changed

4 files changed

+212
-2
lines changed

_data/linkableTypes.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -708,6 +708,20 @@
708708
link: '#monikerKind'
709709
- type: 'Moniker'
710710
link: '#moniker'
711+
- type: 'TypeHierarchyClientCapabilities'
712+
link: '#typeHierarchyClientCapabilities'
713+
- type: 'TypeHierarchyOptions'
714+
link: '#typeHierarchyOptions'
715+
- type: 'TypeHierarchyRegistrationOptions'
716+
link: '#typeHierarchyRegistrationOptions'
717+
- type: 'TypeHierarchyPrepareParams'
718+
link: '#typeHierarchyPrepareParams'
719+
- type: 'TypeHierarchyItem'
720+
link: '#typeHierarchyItem'
721+
- type: 'TypeHierarchySupertypesParams'
722+
link: '#typeHierarchySupertypesParams'
723+
- type: 'TypeHierarchySubtypesParams'
724+
link: '#typeHierarchySubtypesParams'
711725
- type: 'InlayHintClientCapabilities'
712726
link: '#inlayHintClientCapabilities'
713727
- type: 'InlayHintOptions'

_data/specification-3-17-toc.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,16 @@
143143
anchor: textDocument_references
144144
- title: Prepare Call Hierarchy
145145
anchor: textDocument_prepareCallHierarchy
146-
- title: Call Hierarchy incoming calls
146+
- title: Call Hierarchy Incoming Calls
147147
anchor: callHierarchy_incomingCalls
148-
- title: Call Hierarchy outgoing calls
148+
- title: Call Hierarchy Outgoing Calls
149149
anchor: callHierarchy_outgoingCalls
150+
- title: Prepare Type Hierarchy
151+
anchor: textDocument_prepareTypeHierarchy
152+
- title: Type Hierarchy Super Types
153+
anchor: typeHierarchy_supertypes
154+
- title: Type Hierarchy Sub Types
155+
anchor: typeHierarchy_subtypes
150156
- title: Document Highlight
151157
anchor: textDocument_documentHighlight
152158
- title: Document Link
Lines changed: 189 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,189 @@
1+
2+
#### <a href="#textDocument_prepareTypeHierarchy" name="textDocument_prepareTypeHierarchy" class="anchor">Prepare Type Hierarchy Request (:leftwards_arrow_with_hook:)</a>
3+
4+
> *Since version 3.17.0*
5+
6+
The type hierarchy request is sent from the client to the server to return a type hierarchy for the language element of given text document positions. Will return `null` if the server couldn't infer a valid type from the position. The type hierarchy requests are executed in two steps:
7+
8+
1. first a type hierarchy item is prepared for the given text document position.
9+
1. for a type hierarchy item the supertype or subtype type hierarchy items are resolved.
10+
11+
_Client Capability_:
12+
13+
* property name (optional): `textDocument.typeHierarchy`
14+
* property type: `TypeHierarchyClientCapabilities` defined as follows:
15+
16+
<div class="anchorHolder"><a href="#typeHierarchyClientCapabilities" name="typeHierarchyClientCapabilities" class="linkableAnchor"></a></div>
17+
18+
```typescript
19+
type TypeHierarchyClientCapabilities = {
20+
/**
21+
* Whether implementation supports dynamic registration. If this is set to
22+
* `true` the client supports the new `(TextDocumentRegistrationOptions &
23+
* StaticRegistrationOptions)` return value for the corresponding server
24+
* capability as well.
25+
*/
26+
dynamicRegistration?: boolean;
27+
};
28+
```
29+
30+
_Server Capability_:
31+
32+
* property name (optional): `typeHierarchyProvider`
33+
* property type: `boolean | TypeHierarchyOptions | TypeHierarchyRegistrationOptions` where `TypeHierarchyOptions` is defined as follows:
34+
35+
<div class="anchorHolder"><a href="#typeHierarchyOptions" name="typeHierarchyOptions" class="linkableAnchor"></a></div>
36+
37+
```typescript
38+
export type TypeHierarchyOptions = WorkDoneProgressOptions;
39+
```
40+
41+
_Registration Options_: `TypeHierarchyRegistrationOptions` defined as follows:
42+
43+
<div class="anchorHolder"><a href="#typeHierarchyRegistrationOptions" name="typeHierarchyRegistrationOptions" class="linkableAnchor"></a></div>
44+
45+
```typescript
46+
export type TypeHierarchyRegistrationOptions =
47+
TextDocumentRegistrationOptions & TypeHierarchyOptions &
48+
StaticRegistrationOptions;
49+
```
50+
51+
_Request_:
52+
53+
* method: 'textDocument/prepareTypeHierarchy'
54+
* params: `TypeHierarchyPrepareParams` defined as follows:
55+
56+
<div class="anchorHolder"><a href="#typeHierarchyPrepareParams" name="typeHierarchyPrepareParams" class="linkableAnchor"></a></div>
57+
58+
```typescript
59+
export type TypeHierarchyPrepareParams = TextDocumentPositionParams &
60+
WorkDoneProgressParams;
61+
```
62+
63+
_Response_:
64+
65+
* result: `TypeHierarchyItem[] | null` defined as follows:
66+
67+
<div class="anchorHolder"><a href="#typeHierarchyItem" name="typeHierarchyItem" class="linkableAnchor"></a></div>
68+
69+
```typescript
70+
export type TypeHierarchyItem = {
71+
/**
72+
* The name of this item.
73+
*/
74+
name: string;
75+
76+
/**
77+
* The kind of this item.
78+
*/
79+
kind: SymbolKind;
80+
81+
/**
82+
* Tags for this item.
83+
*/
84+
tags?: SymbolTag[];
85+
86+
/**
87+
* More detail for this item, e.g. the signature of a function.
88+
*/
89+
detail?: string;
90+
91+
/**
92+
* The resource identifier of this item.
93+
*/
94+
uri: DocumentUri;
95+
96+
/**
97+
* The range enclosing this symbol not including leading/trailing whitespace
98+
* but everything else, e.g. comments and code.
99+
*/
100+
range: Range;
101+
102+
/**
103+
* The range that should be selected and revealed when this symbol is being
104+
* picked, e.g. the name of a function. Must be contained by the
105+
* [`range`](#TypeHierarchyItem.range).
106+
*/
107+
selectionRange: Range;
108+
109+
/**
110+
* A data entry field that is preserved between a type hierarchy prepare and
111+
* supertypes or subtypes requests. It could also be used to identify the
112+
* type hierarchy in the server, helping improve the performance on
113+
* resolving supertypes and subtypes.
114+
*/
115+
data?: LSPAny;
116+
};
117+
```
118+
119+
* error: code and message set in case an exception happens during the 'textDocument/prepareTypeHierarchy' request
120+
121+
#### <a href="#typeHierarchy_supertypes" name="typeHierarchy_supertypes" class="anchor">Type Hierarchy Supertypes(:leftwards_arrow_with_hook:)</a>
122+
123+
> *Since version 3.17.0*
124+
125+
The request is sent from the client to the server to resolve the supertypes for a given type hierarchy item. Will return `null` if the server couldn't infer a valid type from `item` in the params. The request doesn't define its own client and server capabilities. It is only issued if a server registers for the [`textDocument/prepareTypeHierarchy` request](#textDocument_prepareTypeHierarchy).
126+
127+
_Request_:
128+
129+
* method: 'typeHierarchy/supertypes'
130+
* params: `TypeHierarchySupertypesParams` defined as follows:
131+
132+
<div class="anchorHolder"><a href="#typeHierarchySupertypesParams" name="typeHierarchySupertypesParams" class="linkableAnchor"></a></div>
133+
134+
```typescript
135+
export type TypeHierarchySupertypesParams =
136+
WorkDoneProgressParams & PartialResultParams & {
137+
item: TypeHierarchyItem;
138+
};
139+
```
140+
_Response_:
141+
142+
* result: `TypeHierarchyItem[] | null`
143+
* partial result: `TypeHierarchyItem[]`
144+
* error: code and message set in case an exception happens during the 'typeHierarchy/supertypes' request
145+
146+
#### <a href="#typeHierarchy_subtypes" name="typeHierarchy_subtypes" class="anchor">Type Hierarchy Subtypes(:leftwards_arrow_with_hook:)</a>
147+
148+
> *Since version 3.17.0*
149+
150+
The request is sent from the client to the server to resolve the subtypes for a given type hierarchy item. Will return `null` if the server couldn't infer a valid type from `item` in the params. The request doesn't define its own client and server capabilities. It is only issued if a server registers for the [`textDocument/prepareTypeHierarchy` request](#textDocument_prepareTypeHierarchy).
151+
152+
_Request_:
153+
154+
* method: 'typeHierarchy/subtypes'
155+
* params: `TypeHierarchySubtypesParams` defined as follows:
156+
157+
<div class="anchorHolder"><a href="#typeHierarchySubtypesParams" name="typeHierarchySubtypesParams" class="linkableAnchor"></a></div>
158+
159+
```typescript
160+
export type TypeHierarchySubtypesParams =
161+
WorkDoneProgressParams & PartialResultParams & {
162+
item: TypeHierarchyItem;
163+
};
164+
```
165+
_Response_:
166+
167+
* result: `TypeHierarchyItem[] | null`
168+
* partial result: `TypeHierarchyItem[]`
169+
* error: code and message set in case an exception happens during the 'typeHierarchy/subtypes' request
170+
171+
172+
<!--- linable types addition
173+
174+
- type: 'TypeHierarchyClientCapabilities'
175+
link: '#typeHierarchyClientCapabilities'
176+
- type: 'TypeHierarchyOptions'
177+
link: '#typeHierarchyOptions'
178+
- type: 'TypeHierarchyRegistrationOptions'
179+
link: '#typeHierarchyRegistrationOptions'
180+
- type: 'TypeHierarchyPrepareParams'
181+
link: '#typeHierarchyPrepareParams'
182+
- type: 'TypeHierarchyItem'
183+
link: '#typeHierarchyItem'
184+
- type: 'TypeHierarchySupertypesParams'
185+
link: '#typeHierarchySupertypesParams'
186+
- type: 'TypeHierarchySubtypesParams'
187+
link: '#typeHierarchySubtypesParams'
188+
189+
--->

_specifications/lsp/3.17/specification.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -655,6 +655,7 @@ Language Feature provide the actual smarts in the language server protocol. The
655655
{% include_relative language/implementation.md %}
656656
{% include_relative language/references.md %}
657657
{% include_relative language/callHierarchy.md %}
658+
{% include_relative language/typeHierarchy.md %}
658659
{% include_relative language/documentHighlight.md %}
659660
{% include_relative language/documentLink.md %}
660661
{% include_relative language/hover.md %}

0 commit comments

Comments
 (0)