MCPcopy
hub / github.com/compiler-explorer/compiler-explorer / onLanguageChange

Method onLanguageChange

static/panes/executor.ts:1286–1307  ·  view source on GitHub ↗
(editorId: number | boolean, newLangId: string)

Source from the content-addressed store, hash-verified

1284 }
1285
1286 onLanguageChange(editorId: number | boolean, newLangId: string): void {
1287 if (this.sourceEditorId === editorId && this.currentLangId) {
1288 const languages = languagesService.getLanguagesOrFail();
1289 const oldLangId = this.currentLangId;
1290 this.currentLangId = newLangId;
1291 // Store the current selected stuff to come back to it later in the same session (Not state stored!)
1292 this.infoByLang[oldLangId] = {
1293 compiler: this.compiler?.id ? this.compiler.id : (languages[oldLangId]?.defaultCompiler ?? ''),
1294 options: this.options,
1295 execArgs: this.executionArguments,
1296 execStdin: this.executionStdin,
1297 };
1298 const info = this.infoByLang[this.currentLangId];
1299 this.initLangAndCompiler({compilerName: '', id: 0, lang: newLangId, compiler: info?.compiler ?? ''}).then(
1300 () => {
1301 this.updateCompilersSelector(info);
1302 this.updateCompilerUI();
1303 this.updateState();
1304 },
1305 );
1306 }
1307 }
1308
1309 async getCurrentLangCompilers(): Promise<CompilerInfo[]> {
1310 const allCompilers = await this.hub.compilerService.getCompilersForLang(this.currentLangId);

Callers

nothing calls this directly

Calls 5

initLangAndCompilerMethod · 0.95
updateCompilerUIMethod · 0.95
updateStateMethod · 0.95
getLanguagesOrFailMethod · 0.80

Tested by

no test coverage detected