mirror of
https://github.com/compiler-explorer/compiler-explorer.git
synced 2026-12-02 05:59:46 -06:00
fix #4194
This commit is contained in:
+34
-29
@@ -60,20 +60,20 @@ const languages = options.languages as Record<string, Language | undefined>;
|
||||
|
||||
// eslint-disable-next-line max-statements
|
||||
export class Editor extends MonacoPane<monaco.editor.IStandaloneCodeEditor, EditorState> {
|
||||
private readonly id: number;
|
||||
private readonly ourCompilers: Record<string, boolean>;
|
||||
private readonly ourExecutors: Record<number, boolean>;
|
||||
private readonly httpRoot: string;
|
||||
private readonly asmByCompiler: Record<string, ResultLine[] | undefined>;
|
||||
private readonly defaultFileByCompiler: Record<number, string>;
|
||||
private readonly busyCompilers: Record<number, boolean>;
|
||||
private id: number;
|
||||
private ourCompilers: Record<string, boolean>;
|
||||
private ourExecutors: Record<number, boolean>;
|
||||
private httpRoot: string;
|
||||
private asmByCompiler: Record<string, ResultLine[] | undefined>;
|
||||
private defaultFileByCompiler: Record<number, string>;
|
||||
private busyCompilers: Record<number, boolean>;
|
||||
private colours: string[];
|
||||
private readonly treeCompilers: Record<number, Record<number, boolean> | undefined>;
|
||||
private treeCompilers: Record<number, Record<number, boolean> | undefined>;
|
||||
private decorations: Record<string, IModelDeltaDecoration[] | undefined>;
|
||||
private prevDecorations: string[];
|
||||
private extraDecorations?: Decoration[];
|
||||
private fadeTimeoutId: NodeJS.Timeout | null;
|
||||
private readonly editorSourceByLang: Record<LanguageKey, string | undefined>;
|
||||
private editorSourceByLang: Record<LanguageKey, string | undefined>;
|
||||
private alertSystem: Alert;
|
||||
private filename: string | false;
|
||||
private awaitingInitialResults: boolean;
|
||||
@@ -104,30 +104,10 @@ export class Editor extends MonacoPane<monaco.editor.IStandaloneCodeEditor, Edit
|
||||
|
||||
constructor(hub: Hub, state: MonacoPaneState & EditorState, container: Container) {
|
||||
super(hub, container, state);
|
||||
this.id = state.id || hub.nextEditorId();
|
||||
this.ourCompilers = {};
|
||||
this.ourExecutors = {};
|
||||
this.httpRoot = window.httpRoot;
|
||||
this.asmByCompiler = {};
|
||||
this.defaultFileByCompiler = {};
|
||||
this.busyCompilers = {};
|
||||
this.colours = [];
|
||||
this.treeCompilers = {};
|
||||
|
||||
this.decorations = {};
|
||||
this.prevDecorations = [];
|
||||
this.extraDecorations = [];
|
||||
|
||||
this.fadeTimeoutId = null;
|
||||
|
||||
this.editorSourceByLang = {} as Record<LanguageKey, string | undefined>;
|
||||
this.alertSystem = new Alert();
|
||||
this.alertSystem.prefixMessage = 'Editor #' + this.id;
|
||||
|
||||
this.awaitingInitialResults = false;
|
||||
|
||||
this.revealJumpStack = [];
|
||||
|
||||
if (this.currentLanguage) this.onLanguageChange(this.currentLanguage.id, true);
|
||||
|
||||
if (state.source !== undefined) {
|
||||
@@ -168,6 +148,28 @@ export class Editor extends MonacoPane<monaco.editor.IStandaloneCodeEditor, Edit
|
||||
// }, this));
|
||||
}
|
||||
|
||||
override initializeDefaults(): void {
|
||||
this.ourCompilers = {};
|
||||
this.ourExecutors = {};
|
||||
this.asmByCompiler = {};
|
||||
this.defaultFileByCompiler = {};
|
||||
this.busyCompilers = {};
|
||||
this.colours = [];
|
||||
this.treeCompilers = {};
|
||||
|
||||
this.decorations = {};
|
||||
this.prevDecorations = [];
|
||||
this.extraDecorations = [];
|
||||
|
||||
this.fadeTimeoutId = null;
|
||||
|
||||
this.editorSourceByLang = {} as Record<LanguageKey, string | undefined>;
|
||||
|
||||
this.awaitingInitialResults = false;
|
||||
|
||||
this.revealJumpStack = [];
|
||||
}
|
||||
|
||||
override registerOpeningAnalyticsEvent(): void {
|
||||
ga.proxy('send', {
|
||||
hitType: 'event',
|
||||
@@ -492,6 +494,7 @@ export class Editor extends MonacoPane<monaco.editor.IStandaloneCodeEditor, Edit
|
||||
override initializeGlobalDependentProperties(): void {
|
||||
super.initializeGlobalDependentProperties();
|
||||
|
||||
this.httpRoot = window.httpRoot;
|
||||
this.settings = Settings.getStoredSettings();
|
||||
this.langKeys = Object.keys(languages);
|
||||
}
|
||||
@@ -499,6 +502,8 @@ export class Editor extends MonacoPane<monaco.editor.IStandaloneCodeEditor, Edit
|
||||
override initializeStateDependentProperties(state: MonacoPaneState & EditorState): void {
|
||||
super.initializeStateDependentProperties(state);
|
||||
|
||||
this.id = state.id || this.hub.nextEditorId();
|
||||
|
||||
this.filename = state.filename ?? false;
|
||||
this.selection = state.selection;
|
||||
this.legacyReadOnly = state.options && !!state.options.readOnly;
|
||||
|
||||
@@ -79,6 +79,7 @@ export abstract class Pane<S> {
|
||||
|
||||
this.paneRenaming = new PaneRenaming(this, state);
|
||||
|
||||
this.initializeDefaults();
|
||||
this.initializeGlobalDependentProperties();
|
||||
this.initializeStateDependentProperties(state);
|
||||
|
||||
@@ -116,6 +117,8 @@ export abstract class Pane<S> {
|
||||
*/
|
||||
abstract registerOpeningAnalyticsEvent(): void;
|
||||
|
||||
initializeDefaults(): void {}
|
||||
|
||||
initializeGlobalDependentProperties(): void {}
|
||||
|
||||
initializeStateDependentProperties(state: S): void {}
|
||||
|
||||
Reference in New Issue
Block a user