import * as vscode from 'vscode' ; import { testWatcher } from '../testRunner/testWatcher' ; import { SFDX_LWC_JEST_FILE_FOCUSED_CONTEXT } from '../types/constants' ; import { isLwcJestTest } from './isLwcJestTest' ; param textEditor function setLwcJestFileFocusedContext ( textEditor ? ) { if ( textEditor ) { vscode . commands . executeCommand ( 'setContext' , SFDX_LWC_JEST_FILE_FOCUSED_CONTEXT , ! ! isLwcJestTest ( textEditor . document ) ) ; testWatcher . setWatchingContext ( textEditor . document . uri ) ; } else { vscode . commands . executeCommand ( 'setContext' , SFDX_LWC_JEST_FILE_FOCUSED_CONTEXT , false ) ; } } param context export function startWatchingEditorFocusChange ( context ) { setLwcJestFileFocusedContext ( vscode . window . activeTextEditor ) ; const handleDidChangeActiveTextEditor = vscode . window . onDidChangeActiveTextEditor ( textEditor => { setLwcJestFileFocusedContext ( textEditor ) ; } ) ; context . subscriptions . push ( handleDidChangeActiveTextEditor ) ; }