import * as vscode from 'vscode' ; import { FoodPyramidHierarchyProvider } from './FoodPyramidHierarchyProvider' ; import { TextDecoder } from 'util' ; export function activate ( context ) { console . log ( 'Congratulations, your extension "call-hierarchy-sample" is now active!' ) ; const disposable = vscode . languages . registerCallHierarchyProvider ( 'plaintext' , new FoodPyramidHierarchyProvider ( ) ) ; context . subscriptions . push ( disposable ) ; showSampleText ( context ) ; } async function showSampleText ( context ) { const sampleTextEncoded = await vscode . workspace . fs . readFile ( vscode . Uri . file ( context . asAbsolutePath ( 'sample.txt' ) ) ) ; const sampleText = new TextDecoder ( 'utf-8' ) . decode ( sampleTextEncoded ) ; const doc = await vscode . workspace . openTextDocument ( { language : 'plaintext' , content : sampleText } ) ; vscode . window . showTextDocument ( doc ) ; }