| 1353 | } |
| 1354 | |
| 1355 | class HoverFeature extends TextDocumentFeature<TextDocumentRegistrationOptions> { |
| 1356 | |
| 1357 | constructor(client: BaseLanguageClient) { |
| 1358 | super(client, HoverRequest.type); |
| 1359 | } |
| 1360 | |
| 1361 | public fillClientCapabilities(capabilites: ClientCapabilities): void { |
| 1362 | const hoverCapability = (ensure(ensure(capabilites, 'textDocument')!, 'hover')!); |
| 1363 | hoverCapability.dynamicRegistration = true; |
| 1364 | hoverCapability.contentFormat = [MarkupKind.Markdown, MarkupKind.PlainText]; |
| 1365 | } |
| 1366 | |
| 1367 | public initialize(capabilities: ServerCapabilities, documentSelector: DocumentSelector): void { |
| 1368 | if (!capabilities.hoverProvider || !documentSelector) { |
| 1369 | return; |
| 1370 | } |
| 1371 | this.register(this.messages, { |
| 1372 | id: UUID.generateUuid(), |
| 1373 | registerOptions: Object.assign({}, { documentSelector: documentSelector }) |
| 1374 | }); |
| 1375 | } |
| 1376 | |
| 1377 | protected registerLanguageProvider(options: TextDocumentRegistrationOptions): Disposable { |
| 1378 | let client = this._client; |
| 1379 | let provideHover: ProvideHoverSignature = (document, position, token) => { |
| 1380 | return client.sendRequest(HoverRequest.type, client.code2ProtocolConverter.asTextDocumentPositionParams(document, position), token).then( |
| 1381 | client.protocol2CodeConverter.asHover, |
| 1382 | (error) => { |
| 1383 | client.logFailedRequest(HoverRequest.type, error); |
| 1384 | return Promise.resolve(null); |
| 1385 | } |
| 1386 | ); |
| 1387 | }; |
| 1388 | let middleware = client.clientOptions.middleware!; |
| 1389 | return Languages.registerHoverProvider(options.documentSelector!, { |
| 1390 | provideHover: (document: TextDocument, position: VPosition, token: CancellationToken): ProviderResult<VHover> => { |
| 1391 | return middleware.provideHover |
| 1392 | ? middleware.provideHover(document, position, token, provideHover) |
| 1393 | : provideHover(document, position, token); |
| 1394 | } |
| 1395 | }); |
| 1396 | } |
| 1397 | } |
| 1398 | |
| 1399 | class SignatureHelpFeature extends TextDocumentFeature<SignatureHelpRegistrationOptions> { |
| 1400 |
nothing calls this directly
no outgoing calls
no test coverage detected