forked from microsoft/vscode-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhoverProvider.ts
More file actions
27 lines (23 loc) · 958 Bytes
/
hoverProvider.ts
File metadata and controls
27 lines (23 loc) · 958 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
'use strict';
import * as vscode from 'vscode';
import { JediFactory } from '../languageServices/jediProxyFactory';
import { captureTelemetry } from '../telemetry';
import { EventName } from '../telemetry/constants';
import { ItemInfoSource } from './itemInfoSource';
export class PythonHoverProvider implements vscode.HoverProvider {
private itemInfoSource: ItemInfoSource;
constructor(jediFactory: JediFactory) {
this.itemInfoSource = new ItemInfoSource(jediFactory);
}
@captureTelemetry(EventName.HOVER_DEFINITION)
public async provideHover(
document: vscode.TextDocument,
position: vscode.Position,
token: vscode.CancellationToken,
): Promise<vscode.Hover | undefined> {
const itemInfos = await this.itemInfoSource.getItemInfoFromDocument(document, position, token);
if (itemInfos) {
return new vscode.Hover(itemInfos.map((item) => item.tooltip));
}
}
}