import * as vscode from 'vscode' ; interface CodeSpellCheckerExtension { registerConfig ( path ) : Promise < void > ; enableLocal ( isGlobal , locale ) : Promise < void > ; disableLocal ( isGlobal , locale ) : Promise < void > ; } const locale = 'es-ES' ; export function activate ( context ) { const vscodeSpellCheckerExtension = 'streetsidesoftware.code-spell-checker' ; const configLocation = context . asAbsolutePath ( './cspell-ext.json' ) ; const extension = vscode . extensions . getExtension < CodeSpellCheckerExtension > ( vscodeSpellCheckerExtension ) ; if ( extension ) { extension . activate ( ) . then ( ( ext ) => { ext ?. registerConfig ?. ( configLocation ) ; } ) ; } function enable ( isGlobal ) { extension && extension . activate ( ) . then ( ( ext ) => { ext ?. enableLocal ?. ( isGlobal , locale ) ; } ) ; } function disable ( isGlobal ) { extension && extension . activate ( ) . then ( ( ext ) => { ext ?. disableLocal ?. ( isGlobal , locale ) ; } ) ; } context . subscriptions . push ( vscode . commands . registerCommand ( 'cSpell.enableSpanish' , ( ) => enable ( true ) ) , vscode . commands . registerCommand ( 'cSpell.disableSpanish' , ( ) => disable ( true ) ) , vscode . commands . registerCommand ( 'cSpell.enableSpanishWorkspace' , ( ) => enable ( false ) ) , vscode . commands . registerCommand ( 'cSpell.disableSpanishWorkspace' , ( ) => disable ( false ) ) ) ; } export function deactivate ( ) { }