Format the code
continuous-integration/drone/push Build is passing Details

pull/13/head
Colin FRIZOT 11 months ago
parent d86f2779a5
commit 1b96aced93

@ -1,12 +1,12 @@
import {Component, Input, ViewChild} from '@angular/core';
import {BackendService} from 'src/app/services/backendService.service';
import {Compartment, StateEffect} from '@codemirror/state';
import {CodeMirrorComponent} from '@sandkasten/codemirror6-editor';
import {LanguageDescription} from '@codemirror/language';
import {CODE_DEFAULTS, LANGUAGES} from '../languages';
import {SafeHTMLPipe} from '../../safe-html.pipe';
import {ReactiveFormsModule, FormsModule} from '@angular/forms';
import {Router} from '@angular/router';
import { Component, Input, ViewChild } from '@angular/core';
import { BackendService } from 'src/app/services/backendService.service';
import { Compartment, StateEffect } from '@codemirror/state';
import { CodeMirrorComponent } from '@sandkasten/codemirror6-editor';
import { LanguageDescription } from '@codemirror/language';
import { CODE_DEFAULTS, LANGUAGES } from '../languages';
import { SafeHTMLPipe } from '../../safe-html.pipe';
import { ReactiveFormsModule, FormsModule } from '@angular/forms';
import { Router } from '@angular/router';
import {
keymap,
highlightSpecialChars,
@ -19,7 +19,7 @@ import {
highlightActiveLineGutter,
gutter,
} from '@codemirror/view';
import {Extension, EditorState} from '@codemirror/state';
import { Extension, EditorState } from '@codemirror/state';
import {
defaultHighlightStyle,
syntaxHighlighting,
@ -28,21 +28,21 @@ import {
foldGutter,
foldKeymap,
} from '@codemirror/language';
import {defaultKeymap, history, historyKeymap} from '@codemirror/commands';
import {searchKeymap, highlightSelectionMatches} from '@codemirror/search';
import { defaultKeymap, history, historyKeymap } from '@codemirror/commands';
import { searchKeymap, highlightSelectionMatches } from '@codemirror/search';
import {
autocompletion,
completionKeymap,
closeBrackets,
closeBracketsKeymap,
} from '@codemirror/autocomplete';
import {lintKeymap} from '@codemirror/lint';
import { lintKeymap } from '@codemirror/lint';
import {
Connection,
getDocument,
peerExtension,
} from '../../services/connection.service';
import {environment} from "../../../environments/environment";
import { environment } from '../../../environments/environment';
const basicSetup: Extension = (() => [
highlightActiveLineGutter(),
@ -53,7 +53,7 @@ const basicSetup: Extension = (() => [
dropCursor(),
EditorState.allowMultipleSelections.of(true),
indentOnInput(),
syntaxHighlighting(defaultHighlightStyle, {fallback: true}),
syntaxHighlighting(defaultHighlightStyle, { fallback: true }),
bracketMatching(),
closeBrackets(),
autocompletion(),
@ -153,7 +153,7 @@ export class EditorComponent {
this.client = new WebSocket(`${environment.webSocketUrl}/live/${idRoom}`);
this.client.addEventListener('open', async () => {
let conn = new Connection(this.client!);
let {version, doc} = await getDocument(conn);
let { version, doc } = await getDocument(conn);
this.codemirror.editor?.dispatch({
changes: {
@ -218,7 +218,7 @@ export class EditorComponent {
}
saveToFile() {
const blob = new Blob([this.editorContent], {type: 'text/plain'});
const blob = new Blob([this.editorContent], { type: 'text/plain' });
const a = document.createElement('a');
a.download = `code.${this.selectedLanguage.extensions![0]}`;
a.href = URL.createObjectURL(blob);

@ -1,7 +1,7 @@
import {Injectable} from '@angular/core';
import {SSE} from 'sse.js';
import {Observable, Subject} from 'rxjs';
import {environment} from "../../environments/environment";
import { Injectable } from '@angular/core';
import { SSE } from 'sse.js';
import { Observable, Subject } from 'rxjs';
import { environment } from '../../environments/environment';
export type ExecutionMessage = {
type: 'stdout' | 'stderr' | 'exit';
@ -16,8 +16,7 @@ export class BackendService {
private resultSubject = new Subject<ExecutionMessage>();
constructor() {
}
constructor() {}
async createRoom(code: string) {
const reponse = await fetch(`${this.apiUrl}/live`, {
@ -25,7 +24,7 @@ export class BackendService {
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({code}),
body: JSON.stringify({ code }),
});
return reponse.text();
}
@ -37,7 +36,7 @@ export class BackendService {
'Content-Type': 'application/json',
Accept: 'text/event-stream',
},
payload: JSON.stringify({code, language}),
payload: JSON.stringify({ code, language }),
});
sse.addEventListener('message', (event: MessageEvent<string>) => {
@ -49,7 +48,7 @@ export class BackendService {
if (type === 'end') {
sse.close();
}
this.resultSubject.next({type, text});
this.resultSubject.next({ type, text });
});
}

Loading…
Cancel
Save