|
| 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 | +---> |
0 commit comments