MCPcopy Create free account
hub / github.com/compiler-explorer/compiler-explorer / onCompilerOpen

Method onCompilerOpen

static/panes/editor.ts:1379–1411  ·  view source on GitHub ↗
(compilerId: number, editorId: number, treeId: number | boolean)

Source from the content-addressed store, hash-verified

1377 }
1378
1379 async onCompilerOpen(compilerId: number, editorId: number, treeId: number | boolean): Promise<void> {
1380 if (editorId === this.id) {
1381 // On any compiler open, rebroadcast our state in case they need to know it.
1382 if (this.waitingForLanguage) {
1383 const glCompiler = _.find(
1384 this.container.layoutManager.root.getComponentsByName('compiler'),
1385 c => c.id === compilerId,
1386 );
1387 if (glCompiler) {
1388 const result = await this.hub.compilerService.processFromLangAndCompiler(
1389 null,
1390 glCompiler.originalCompilerId,
1391 );
1392 if (result?.compiler) {
1393 this.changeLanguage(result.compiler.lang);
1394 }
1395 }
1396 }
1397
1398 if (typeof treeId === 'number' && treeId > 0) {
1399 if (!this.treeCompilers[treeId]) {
1400 this.treeCompilers[treeId] = {};
1401 }
1402
1403 unwrap(this.treeCompilers[treeId])[compilerId] = true;
1404 }
1405 this.ourCompilers[compilerId] = true;
1406
1407 if (!treeId) {
1408 this.maybeEmitChange(true, compilerId);
1409 }
1410 }
1411 }
1412
1413 onTreeCompilerEditorIncludeChange(treeId: number, editorId: number, compilerId: number): void {
1414 if (this.id === editorId) {

Callers 1

Calls 5

changeLanguageMethod · 0.95
maybeEmitChangeMethod · 0.95
findMethod · 0.80
unwrapFunction · 0.50

Tested by

no test coverage detected