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 { MavenUtils } from '../utils/mavenUtils' ; import { FocusType } from '../focus/abstractFocus' ; export class MavenHover extends AbstractHoverProvider { constructor ( treesManager ) { super ( MavenUtils . DOCUMENT_SELECTOR , treesManager ) ; } @override  public getNodeByLocation ( document , cursorPosition ) { let dependenciesTree = this . _treesManager . dependenciesTreeDataProvider . getDependenciesTreeNode ( 'maven' , path . dirname ( document . uri . fsPath ) ) ; if ( ! dependenciesTree ) { return ; } for ( const child of dependenciesTree . children ) { let positionList = MavenUtils . getDependencyPos ( document , child , FocusType . Dependency ) ; for ( let i = 0 ; i < positionList . length ; i += 2 ) { let range = new vscode . Range ( positionList [ i ] , positionList [ i + 1 ] ) ; if ( range . contains ( cursorPosition ) ) { return child ; } } } return ; } }