import * as vscode from 'vscode' ; import { DialogResponses , IActionContext } from 'vscode-azureextensionui' ; import { localize } from '../localize' ; import { openUrl } from '../utils/openUrl' ; export function checkCsharpExtensionInstalled ( actionContext ) { const csharpExtension = vscode . extensions . getExtension ( "ms-dotnettools.csharp" ) || vscode . extensions . getExtension ( "ms-vscode.csharp" ) ; if ( ! csharpExtension ) { const message = localize ( 'csharpExtensionNotInstalled' , 'You must have the VSCode CSharp extension installed to improve policy authoring experience.' ) ; if ( ! actionContext . errorHandling . suppressDisplay ) { vscode . window . showErrorMessage ( message , DialogResponses . learnMore ) . then ( async ( result ) => { if ( result === DialogResponses . learnMore ) { await openUrl ( 'https://marketplace.visualstudio.com/items?itemName=ms-vscode.csharp' ) ; } } ) ; actionContext . errorHandling . suppressDisplay = true ; } throw new Error ( message ) ; } }