Replies: 14 comments
-
I had asked this question on the stackoverflow, but no one have answer me. 😔 |
Beta Was this translation helpful? Give feedback.
-
@chhpt may be you're looking for the |
Beta Was this translation helpful? Give feedback.
-
@myfoxtail Could the |
Beta Was this translation helpful? Give feedback.
-
@chhpt I guess you can try to create a decoration and apply it to the particular range if your content. Every decoration has it's own css class which I guess you can fill with margins and paddings.
|
Beta Was this translation helpful? Give feedback.
-
@myfoxtail I have tried it. It seems that it is not working. The |
Beta Was this translation helpful? Give feedback.
-
You could try with decorations that use var jsCode = [
'"use strict";',
'function Person(age) {',
' if (age) {',
' this.age = age;',
' }',
'}',
'Person.prototype.getAge = function () {',
' return this.age;',
'};'
].join('\n');
var editor = monaco.editor.create(document.getElementById("container"), {
value: jsCode,
language: "javascript"
});
var decorations = editor.deltaDecorations([], [
{ range: new monaco.Range(7,1,7,24), options: { beforeContentClassName: 'myInlineDecoration' }},
]); .myInlineDecoration::before {
content: " ";
background: red;
width: 100px;
display: inline-block;
} |
Beta Was this translation helpful? Give feedback.
-
Maybe I should show my thoughts more clearly. First please see this pic. If I don't do anything, it look like this. This doesn't look so good. So I decided to add some space around the content. I add a All is well except the scrollbar. I want to find way that could make it work like this but make the scrollbar on the edge. May like this: The var decorations = editor.deltaDecorations([], [
{ range: new monaco.Range(1,1,10,24), options: { beforeContentClassName: 'myInlineDecoration' }},
]); |
Beta Was this translation helpful? Give feedback.
-
Thanks for posting screenshots, it makes it clearer for me what you're trying to do. At this time, the editor doesn't support any form of padding inside the content (such that the scrollbar stays put). |
Beta Was this translation helpful? Give feedback.
-
@alexandrudima Do you have a plan to realize it? I hope the feature could be come ture. |
Beta Was this translation helpful? Give feedback.
-
Any update related this feature? @alexdima |
Beta Was this translation helpful? Give feedback.
-
Any update related this feature? @alexdima |
Beta Was this translation helpful? Give feedback.
-
@alexdima How do I get to put a consistent single space between words on the same line. I am using a plaintext editor. Please help me . I want to use create a data like tab separated files. Eg. |
Beta Was this translation helpful? Give feedback.
-
I would also like to ask for this functionality :) This provides a very useful inlay ability for consumers to inject content. I believe this should be fairly possible similar to how the "peek" mode has been implemented -- as it would effectively work in the same way. |
Beta Was this translation helpful? Give feedback.
-
I ended up using a sort of workaround by using ViewZones. In my case, I also want it to show the text that's selected, so it includes a small sample implementation of that. Visually, it inserts a block "decoration" fairly well. I hadn't encountered any major problems so far. |
Beta Was this translation helpful? Give feedback.
-
Because of some reasons, I want to add some space around the content(view-lines). I found the way to add space on the left of the content using the API lineDecorationsWidth, but I have no idea how to add space on the other side, top, bottom and right and keep the action work well, such as copy, select all, input...
Beta Was this translation helpful? Give feedback.
All reactions