author linhuiw
 *  desc import * as fs from 'fs-extra' ; import * as path from 'path' ; import * as vscode from 'vscode' ; import { findPositionInCode } from './utils' ; export async function findInHtmls ( text , fsPath = path . join ( vscode . workspace . workspaceFolders [ 0 ] . uri . fsPath , 'src' ) ) { const info = await fs . lstat ( fsPath ) ; if ( ! info . isDirectory ( ) ) { if ( path . extname ( fsPath ) !== '.html' ) { return [ ] ; } const content = ( await fs . readFile ( fsPath ) ) . toString ( 'utf8' ) ; if ( content . includes ( text ) ) { const location = new vscode . Location ( vscode . Uri . file ( fsPath ) , findPositionInCode ( text , content ) ) ; return [ location ] ; } return [ ] ; } const paths = await fs . readdir ( fsPath ) ; const locationses = await Promise . all ( paths . map ( currPath => findInHtmls ( text , path . join ( fsPath , currPath ) ) ) ) ; return locationses . reduce ( ( pre , next ) => pre . concat ( next ) , [ ] ) ; }