Commit 15993df1 authored by Mike Greiling's avatar Mike Greiling

remove need to pass monaco around through DI

parent 2729205b
import * as monaco from 'monaco-editor';
import Disposable from './disposable';
import eventHub from '../../eventhub';
export default class Model {
constructor(monaco, file, head = null) {
constructor(file, head = null) {
this.monaco = monaco;
this.disposable = new Disposable();
this.file = file;
......
......@@ -3,8 +3,7 @@ import Disposable from './disposable';
import Model from './model';
export default class ModelManager {
constructor(monaco) {
this.monaco = monaco;
constructor() {
this.disposable = new Disposable();
this.models = new Map();
}
......@@ -22,7 +21,7 @@ export default class ModelManager {
return this.getModel(file.key);
}
const model = new Model(this.monaco, file, head);
const model = new Model(file, head);
this.models.set(model.path, model);
this.disposable.add(model);
......
......@@ -31,7 +31,7 @@ export default class Editor {
this.instance = null;
this.dirtyDiffController = null;
this.disposable = new Disposable();
this.modelManager = new ModelManager(this.monaco);
this.modelManager = new ModelManager();
this.decorationsController = new DecorationsController(this);
this.setupMonacoTheme();
......
import * as monaco from 'monaco-editor';
import eventHub from '~/ide/eventhub';
import ModelManager from '~/ide/lib/common/model_manager';
import { file } from '../../helpers';
......@@ -7,7 +6,7 @@ describe('Multi-file editor library model manager', () => {
let instance;
beforeEach(() => {
instance = new ModelManager(monaco);
instance = new ModelManager();
});
afterEach(() => {
......
import * as monaco from 'monaco-editor';
import eventHub from '~/ide/eventhub';
import Model from '~/ide/lib/common/model';
import { file } from '../../helpers';
......@@ -12,7 +11,7 @@ describe('Multi-file editor library model', () => {
const f = file('path');
f.mrChange = { diff: 'ABC' };
f.baseRaw = 'test';
model = new Model(monaco, f);
model = new Model(f);
});
afterEach(() => {
......@@ -33,7 +32,7 @@ describe('Multi-file editor library model', () => {
const f = file('path');
model.dispose();
model = new Model(monaco, f, {
model = new Model(f, {
...f,
content: '123 testing',
});
......
import * as monaco from 'monaco-editor';
import Editor from '~/ide/lib/editor';
import DecorationsController from '~/ide/lib/decorations/controller';
import Model from '~/ide/lib/common/model';
......@@ -14,7 +13,7 @@ describe('Multi-file editor library decorations controller', () => {
editorInstance.createInstance(document.createElement('div'));
controller = new DecorationsController(editorInstance);
model = new Model(monaco, file('path'));
model = new Model(file('path'));
});
afterEach(() => {
......
import * as monaco from 'monaco-editor';
import { Range } from 'monaco-editor';
import Editor from '~/ide/lib/editor';
import ModelManager from '~/ide/lib/common/model_manager';
import DecorationsController from '~/ide/lib/decorations/controller';
......@@ -17,7 +17,7 @@ describe('Multi-file editor library dirty diff controller', () => {
editorInstance = Editor.create();
editorInstance.createInstance(document.createElement('div'));
modelManager = new ModelManager(monaco);
modelManager = new ModelManager();
decorationsController = new DecorationsController(editorInstance);
model = modelManager.addModel(file('path'));
......@@ -165,7 +165,7 @@ describe('Multi-file editor library dirty diff controller', () => {
[],
[
{
range: new monaco.Range(1, 1, 1, 1),
range: new Range(1, 1, 1, 1),
options: {
isWholeLine: true,
linesDecorationsClassName: 'dirty-diff dirty-diff-modified',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment