forked from DonJayamanne/pythonVSCode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhoverProvider.ts
More file actions
24 lines (20 loc) · 954 Bytes
/
hoverProvider.ts
File metadata and controls
24 lines (20 loc) · 954 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
'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));
}
}
}