import * as vscode from 'vscode' ; import { ColorExtractor } from './color_extractor' ; import { ColorDisplay } from './color_info_display' ; /**
 * Color info hover provider
 */ export default class ColorInfoHoverProvider implements vscode . HoverProvider { private _extractor : ColorExtractor ; private _display : ColorDisplay ; constructor ( extractor , display ) { this . _extractor = extractor ; this . _display = display ; } public provideHover ( document , position , _token ) { const line = document . lineAt ( position . line ) ; const match = this . _extractor . getColorAtPosition ( line . text , position ) ; if ( match ) { const display = this . _display . display ( match ) ; if ( display ) { return new vscode . Hover ( display ) ; } } return null ; } }