diff --git a/src/app/webide/webide.component.ts b/src/app/webide/webide.component.ts index b22d119..10ca71b 100644 --- a/src/app/webide/webide.component.ts +++ b/src/app/webide/webide.component.ts @@ -1,11 +1,22 @@ import { ChangeDetectorRef, Component, OnInit } from '@angular/core'; -import 'brace/mode/python'; +import * as brace from 'brace'; +import 'brace/ext/modelist'; + +import 'brace/mode/c_cpp'; +import 'brace/mode/csharp'; +import 'brace/mode/java'; import 'brace/mode/javascript'; +import 'brace/mode/json'; +import 'brace/mode/python'; +import 'brace/mode/sql'; + import 'brace/theme/monokai'; import { SourceCode } from './source-code'; import { WebSocketService } from '../websocket.service'; +const modelist = brace.acequire('ace/ext/modelist'); + const defaultSourceCode = `alert( 'Hello, world!' );`; @Component({ @@ -29,7 +40,7 @@ export class WebideComponent implements OnInit { this.webSocketService.observeAnchor<SourceCode>(this.anchor_id).subscribe((event) => { this.filename = event.data.filename; this.code = event.data.content; - this.language = event.data.language; + this.language = modelist.getModeForPath(this.filename).name; this.files = event.data.files; if (event.data.command === 'write') { this.saveButtonState = 'SAVED'; }