import * as path from 'path' ; import * as vscode from 'vscode' ; import { DependenciesTreeNode } from '../treeDataProviders/dependenciesTree/dependenciesTreeNode' ; import { TreesManager } from '../treeDataProviders/treesManager' ; import { AbstractHoverProvider } from './abstractHoverProvider' ; import { GoUtils } from '../utils/goUtils' ; import { FocusType } from '../focus/abstractFocus' ; export class GoHover extends AbstractHoverProvider { constructor ( treesManager ) { super ( GoUtils . DOCUMENT_SELECTOR , treesManager ) ; } @override  public getNodeByLocation ( document , cursorPosition ) { let dependenciesTree = this . _treesManager . dependenciesTreeDataProvider . getDependenciesTreeNode ( 'go' , path . dirname ( document . uri . fsPath ) ) ; if ( ! dependenciesTree ) { return ; } for ( const child of dependenciesTree . children ) { let pos = GoUtils . getDependencyPos ( document , child , FocusType . Dependency ) ; let range = new vscode . Range ( pos [ 0 ] , pos [ 1 ] ) ; if ( range . contains ( cursorPosition ) ) { return child ; } } return undefined ; } }