[英]monaco-editor: vertical line padding
Inspired by IntelliJ's 3 panel merge conflict view, I am trying to build something similar for vscode.受 IntelliJ 的 3 面板合并冲突视图的启发,我正在尝试为 vscode 构建类似的东西。 I figured out, that I can integrate three complete customizable monaco-editors within a vscode Webview.
我发现,我可以在 vscode Webview 中集成三个完整的可定制摩纳哥编辑器。 But I cannot figure out, how monaco-editor applies the line padding in its diff-view like in the picture below (as I don't want to have a two-way but a 3-way diff using the internal diff-view is not an option for me):
但我无法弄清楚,monaco-editor 如何在其差异视图中应用行填充,如下图所示(因为我不想使用内部差异视图的双向但三向差异是不是我的选择):
Is it done through custom lineNumbers: lineNumber => isPaddingLine ? '' : lineNumber - someOffset,
是通过自定义
lineNumbers: lineNumber => isPaddingLine ? '' : lineNumber - someOffset,
lineNumbers: lineNumber => isPaddingLine ? '' : lineNumber - someOffset,
and inserting empty lines ("padding lines") at the related place and apply a deltaDecorations
to those lines? lineNumbers: lineNumber => isPaddingLine ? '' : lineNumber - someOffset,
并在相关位置插入空行(“填充行”)并将deltaDecorations
应用到这些行?
I hope there is a more easy way, which does not need the "padding lines" hack.我希望有一种更简单的方法,它不需要“填充线”黑客。 Ideally I could just add something to a
deltaDecoration
like padding-bottom: $Xem
理想情况下,我可以在
deltaDecoration
添加一些东西,比如padding-bottom: $Xem
If I have just overlooked a way with vscode's api to achieve something like that, that would be of course more welcome than to deal directly with monaco-editor.如果我刚刚忽略了使用 vscode 的 api 实现类似目标的方法,那当然比直接与 monaco-editor 打交道更受欢迎。
Thx a lot for any help / ideas :)非常感谢任何帮助/想法:)
I finally found it :) IViewZone is the used magic.我终于找到了 :) IViewZone是使用的魔法。
And https://microsoft.github.io/monaco-editor/playground.html#interacting-with-the-editor-listening-to-mouse-events is a nice example https://microsoft.github.io/monaco-editor/playground.html#interacting-with-the-editor-listening-to-mouse-events是一个很好的例子
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.