Replies: 1 comment
-
I found a way to do this with When that is fired, I look at the uri of the new model and use an appropriate method to set the different line number. Like this: const customLineNumbersAlpha = (num) => {
const map = [ '', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H'];
return (num < map.length) ? map[num] : ' ';
}
const customLineNumbersFrom10 = (num) => {
const map = [ '', '10', '11', '12', '13', '14', '15', '16'];
return (num < map.length) ? map[num] : ' ';
}
monaco.editor.onDidCreateEditor(newEditor => {
newEditor.onDidChangeModel(e => {
if (e.newModelUrl == model1.uri)
{
newEditor.updateOptions({ lineNumbers: customLineNumbersAlpha });
}
else if (e.newModelUrl == model2.uri)
{
newEditor.updateOptions({ lineNumbers: customLineNumbersFrom10 });
}
});
}); |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm trying to find a way to use custom line numbering that is relative to the model/file being displayed and so works when I peek a definition.
The intention is that line numbers are used for a purpose other than displaying the actual line from the file but something relative to the content.
So, in the repro below, line numbers would either start with 'A' or '10' depending on the models.
Minimal repro of what I'm trying to do within the playground with this code:
This currently produces this when clicking on the definition link:
The editor always seems to think the model is the one I originally set, not the one from the definition and the one being shown inline.
Is the inline editor (used for peeking) part of the same "editor" or is it a different one?
Is there a way to do what I'm trying?
Also, is there a way to tell if a model is being displayed in a peeked/inline way?
Beta Was this translation helpful? Give feedback.
All reactions