Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async get(uri: URI): Promise {
await this.editorPreferences.ready;
let editor: MonacoEditor;
const toDispose = new DisposableCollection();
if (!DiffUris.isDiffUri(uri)) {
const model = await this.getModel(uri, toDispose);
editor = this.createEditor((node, override) => new MonacoEditor(
uri, model, node, this.m2p, this.p2m, this.getEditorOptions(model), override
), toDispose);
} else {
const [original, modified] = DiffUris.decode(uri);
const originalModel = await this.getModel(original, toDispose);
const modifiedModel = await this.getModel(modified, toDispose);
editor = this.createEditor((node, override) => new MonacoDiffEditor(
node,
originalModel,
modifiedModel,
this.m2p,
this.p2m,
this.getDiffEditorOptions(originalModel, modifiedModel),
override
), toDispose);
}
return Promise.resolve(editor);