diff --git a/newton/fs.js b/newton/fs.js index 472118f..dda2ac8 100644 --- a/newton/fs.js +++ b/newton/fs.js @@ -12,7 +12,7 @@ const SETTINGS_CONFIG_PATH = path.join(CONFIG_PATH, "/settings.json"); const LSP_CONFIG_PATH = path.join(BASE_PATH, "/resources/lsp-servers-config.json"); let window = null; let watcher = null; -let skipOnceFileWatchChange = false; +let skipOnceFileWatchChange = false; diff --git a/src/app/common/services/editor/files.service.ts b/src/app/common/services/editor/files.service.ts index f73f2e9..fe84b7b 100644 --- a/src/app/common/services/editor/files.service.ts +++ b/src/app/common/services/editor/files.service.ts @@ -90,10 +90,8 @@ export class FilesService { data = await window.fs.getFileContents(file.path); file.session = new EditSession(data); - file.session.setMode( - getModeForPath( file.path ).mode - ); file.session.setUndoManager( new UndoManager() ); + file.session.setMode( getModeForPath( file.path ).mode ); this.files.set(file.path, file); } catch (error) { diff --git a/src/app/common/services/lsp.service.ts b/src/app/common/services/lsp.service.ts index 2816e67..126f401 100644 --- a/src/app/common/services/lsp.service.ts +++ b/src/app/common/services/lsp.service.ts @@ -74,4 +74,15 @@ export class LSPService { let worker = new Worker(new URL('./webworker.js', import.meta.url)); return LanguageProvider.create(worker); } + + protected setSessionFilePath(session: any, mode: string = "", filePath: string = "") => { + if ( !session || !mode || !filePath || !this.languageProviders[mode] ) return; + this.languageProviders[mode].setSessionFilePath(session, filePath); + } + + protected closeDocument(session: any, mode: string) => { + if ( !session || !mode || !this.languageProviders[mode] ) return; + this.languageProviders[mode].closeDocument(session); + } + } \ No newline at end of file diff --git a/src/app/editor/newton-editor/newton-editor.component.ts b/src/app/editor/newton-editor/newton-editor.component.ts index acff2cc..93487fd 100644 --- a/src/app/editor/newton-editor/newton-editor.component.ts +++ b/src/app/editor/newton-editor/newton-editor.component.ts @@ -46,13 +46,16 @@ export class NewtonEditorComponent extends NewtonEditorBase { } private loadAce(): void { + this.configAceAndBindToElement() + this.loadAceKeyBindings(); + this.loadAceEventBindings(); + } + + private configAceAndBindToElement(): void { ace.config.set('basePath', this.editorSettings.BASE_PATH); this.editor = ace.edit( this.editorElm.nativeElement ); this.editor.setOptions( this.editorSettings.CONFIG ); - - this.loadAceKeyBindings(); - this.loadAceEventBindings(); } private loadAceKeyBindings(): void { diff --git a/src/assets/css/ace-overrides.css b/src/assets/css/ace-overrides.css index 8500c26..ff90ac7 100644 --- a/src/assets/css/ace-overrides.css +++ b/src/assets/css/ace-overrides.css @@ -39,6 +39,7 @@ } .ace_print-margin { + width: 1px !important; background-color: rgba(255, 0, 0, 0.84) !important; }