Open
Description
i'm adding a go to definition feature using a langserver.
monaco notices it's a new model 👍, and then tries to load it.
the ranges of the place that contains definition is correct.
does monaco support in-place replacement of the model?
what i'm seeing is that it just offers to download the whole
file containing the resulting definition, i.e., this line
window.open(data.resource.toString());
.
in my monaco build:
private doOpenEditor(editor:editorCommon.ICommonCodeEditor, data:IResourceInput): IEditor {
var model = this.findModel(editor, data);
if (!model) {
if (data.resource) {
if (this.openEditorDelegate) {
this.openEditorDelegate(data.resource.toString());
return null;
} else {
var schema = data.resource.scheme;
if (schema === Schemas.http || schema === Schemas.https) {
// This is a fully qualified http or https URL
window.open(data.resource.toString());
return this.editor;
}
}
}
return null;
}
var selection = <editorCommon.IRange>data.options.selection;
if (selection) {
if (typeof selection.endLineNumber === 'number' && typeof selection.endColumn === 'number') {
editor.setSelection(selection);
editor.revealRangeInCenter(selection);
} else {
var pos = {
lineNumber: selection.startLineNumber,
column: selection.startColumn
};
editor.setPosition(pos);
editor.revealPositionInCenter(pos);
}
}
return this.editor;
}