|
4 | 4 | *--------------------------------------------------------------------------------------------*/ |
5 | 5 |
|
6 | 6 | import { RequestHandler, RequestHandler0 } from 'vscode-jsonrpc'; |
7 | | -import { Command, Location, MarkupContent, Position, Range, TextDocumentIdentifier } from 'vscode-languageserver-types'; |
| 7 | +import { Command, Location, MarkupContent, Position, Range, TextDocumentIdentifier, TextEdit } from 'vscode-languageserver-types'; |
8 | 8 | import { ProtocolRequestType, ProtocolRequestType0 } from './messages'; |
9 | 9 |
|
10 | 10 | import type { StaticRegistrationOptions, TextDocumentRegistrationOptions, WorkDoneProgressOptions, WorkDoneProgressParams } from './protocol'; |
@@ -162,6 +162,15 @@ export type InlayHint = { |
162 | 162 | */ |
163 | 163 | kind?: InlayHintKind; |
164 | 164 |
|
| 165 | + /** |
| 166 | + * Optional text edits that are performed when accepting this inlay hint. |
| 167 | + * |
| 168 | + * *Note* that edits are expected to change the document so that the inlay |
| 169 | + * hint (or its nearest variant) is now part of the document and the inlay |
| 170 | + * hint itself is now obsolete. |
| 171 | + */ |
| 172 | + textEdits?: TextEdit[]; |
| 173 | + |
165 | 174 | /** |
166 | 175 | * The tooltip text when you hover over this item. |
167 | 176 | */ |
@@ -201,6 +210,7 @@ export namespace InlayHint { |
201 | 210 | return Is.objectLiteral(candidate) && Position.is(candidate.position) |
202 | 211 | && (Is.string(candidate.label) || Is.typedArray(candidate.label, InlayHintLabelPart.is)) |
203 | 212 | && (candidate.kind === undefined || InlayHintKind.is(candidate.kind)) |
| 213 | + && (candidate.textEdits === undefined) || Is.typedArray(candidate.textEdits, TextEdit.is) |
204 | 214 | && (candidate.tooltip === undefined || Is.string(candidate.tooltip) || MarkupContent.is(candidate.tooltip)) |
205 | 215 | && (candidate.paddingLeft === undefined || Is.boolean(candidate.paddingLeft)) |
206 | 216 | && (candidate.paddingRight === undefined || Is.boolean(candidate.paddingRight)); |
|
0 commit comments