| 29 | } |
| 30 | @singleton() |
| 31 | export class ProblemsController |
| 32 | extends Controller |
| 33 | implements IProblemsController |
| 34 | { |
| 35 | private readonly panelService: IPanelService; |
| 36 | private readonly statusBarService: IStatusBarService; |
| 37 | private readonly layoutService: ILayoutService; |
| 38 | private readonly monacoService: IMonacoService; |
| 39 | private readonly problemsService: ProblemsService; |
| 40 | private readonly builtinService: IBuiltinService; |
| 41 | |
| 42 | constructor() { |
| 43 | super(); |
| 44 | this.panelService = container.resolve(PanelService); |
| 45 | this.statusBarService = container.resolve(StatusBarService); |
| 46 | this.monacoService = container.resolve(MonacoService); |
| 47 | this.layoutService = container.resolve(LayoutService); |
| 48 | this.problemsService = container.resolve(ProblemsService); |
| 49 | this.builtinService = container.resolve(BuiltinService); |
| 50 | } |
| 51 | |
| 52 | private showHideProblems() { |
| 53 | const { panel } = this.layoutService.getState(); |
| 54 | const { current } = this.panelService.getState(); |
| 55 | const { builtInPanelProblems } = this.builtinService.getModules(); |
| 56 | if (builtInPanelProblems) { |
| 57 | if (panel.hidden || current?.id === builtInPanelProblems.id) { |
| 58 | this.monacoService.commandService.executeCommand( |
| 59 | QuickTogglePanelAction.ID |
| 60 | ); |
| 61 | } |
| 62 | |
| 63 | this.panelService.open(builtInPanelProblems); |
| 64 | } |
| 65 | } |
| 66 | |
| 67 | public onClick = (e: React.MouseEvent, item: IStatusBarItem) => { |
| 68 | this.showHideProblems(); |
| 69 | }; |
| 70 | |
| 71 | public initView() { |
| 72 | const { builtInStatusProblems: statusProblems, builtInPanelProblems } = |
| 73 | this.builtinService.getModules(); |
| 74 | |
| 75 | if (statusProblems) { |
| 76 | statusProblems.render = (item) => ( |
| 77 | <ProblemsStatusBarView {...item} /> |
| 78 | ); |
| 79 | statusProblems.onClick = this.onClick; |
| 80 | |
| 81 | this.statusBarService.add(statusProblems, Float.left); |
| 82 | } |
| 83 | |
| 84 | if (builtInPanelProblems) { |
| 85 | // keep ProblemsPaneView updated to problems' state |
| 86 | const ProblemsView = connect( |
| 87 | this.problemsService, |
| 88 | ProblemsPaneView |
nothing calls this directly
no test coverage detected