()
| 343 | } |
| 344 | |
| 345 | override registerCallbacks(): void { |
| 346 | this.container.on('shown', this.resize, this); |
| 347 | this.container.on('open', () => { |
| 348 | this.eventHub.emit('editorOpen', this.id); |
| 349 | }); |
| 350 | this.container.layoutManager.on('initialised', () => { |
| 351 | // Once initialized, let everyone know what text we have. |
| 352 | this.maybeEmitChange(); |
| 353 | }); |
| 354 | |
| 355 | this.eventHub.on('treeCompilerEditorIncludeChange', this.onTreeCompilerEditorIncludeChange, this); |
| 356 | this.eventHub.on('treeCompilerEditorExcludeChange', this.onTreeCompilerEditorExcludeChange, this); |
| 357 | this.eventHub.on('coloursForEditor', this.onColoursForEditor, this); |
| 358 | this.eventHub.on('compilerOpen', this.onCompilerOpen, this); |
| 359 | this.eventHub.on('executorOpen', this.onExecutorOpen, this); |
| 360 | this.eventHub.on('executorClose', this.onExecutorClose, this); |
| 361 | this.eventHub.on('compiling', this.onCompiling, this); |
| 362 | this.eventHub.on('executeResult', this.onExecuteResponse, this); |
| 363 | this.eventHub.on('selectLine', this.onSelectLine, this); |
| 364 | this.eventHub.on('editorDisplayFlow', this.onEditorDisplayFlow, this); |
| 365 | this.eventHub.on('editorLinkLine', this.onEditorLinkLine, this); |
| 366 | this.eventHub.on('editorApplyQuickfix', this.onEditorApplyQuickfix, this); |
| 367 | this.eventHub.on('conformanceViewOpen', this.onConformanceViewOpen, this); |
| 368 | this.eventHub.on('conformanceViewClose', this.onConformanceViewClose, this); |
| 369 | this.eventHub.on('newSource', this.onNewSource, this); |
| 370 | this.eventHub.on('motd', this.onMotd, this); |
| 371 | this.eventHub.on('findEditors', this.sendEditor, this); |
| 372 | this.eventHub.emit('requestMotd'); |
| 373 | |
| 374 | this.debouncedEmitChange = _.debounce(() => { |
| 375 | this.maybeEmitChange(); |
| 376 | }, this.settings.delayAfterChange); |
| 377 | |
| 378 | this.editor.getModel()?.onDidChangeContent(() => { |
| 379 | this.debouncedEmitChange(); |
| 380 | this.updateState(); |
| 381 | }); |
| 382 | |
| 383 | this.mouseMoveThrottledFunction = _.throttle(this.onMouseMove.bind(this), 50); |
| 384 | |
| 385 | this.editor.onMouseMove(e => { |
| 386 | if (this.mouseMoveThrottledFunction) this.mouseMoveThrottledFunction(e); |
| 387 | }); |
| 388 | |
| 389 | if (window.compilerExplorerOptions.mobileViewer) { |
| 390 | // workaround for issue with contextmenu not going away when tapping somewhere else on the screen |
| 391 | this.editor.onDidChangeCursorSelection(() => { |
| 392 | const contextmenu = $('div.context-view.monaco-menu-container'); |
| 393 | if (contextmenu.css('display') !== 'none') { |
| 394 | contextmenu.hide(); |
| 395 | } |
| 396 | }); |
| 397 | } |
| 398 | |
| 399 | this.cursorSelectionThrottledFunction = _.throttle(this.onDidChangeCursorSelection.bind(this), 500); |
| 400 | this.editor.onDidChangeCursorSelection(e => { |
| 401 | if (this.cursorSelectionThrottledFunction) this.cursorSelectionThrottledFunction(e); |
| 402 | }); |
nothing calls this directly
no test coverage detected