有没有办法让插件在原子中显示行 'between' 编号行?

Is there a way to make a plugin display lines 'between' numbered lines in atom?

在原子编辑器中,我希望能够创建注释 'in between' 文件的行。我非常乐意通过插件来做到这一点,但我想知道是否有人在 API 方面更有经验,可以在我开始之前确认它是否可行。

基本上,如果我打开一个包含 10 行的文件,我希望能够 'insert' 在其中一些行之间换行(这将被保存到另一个文件),同时仍然保持行号原始文件。例如:

1 Hello
2 World
.   This is a note line saved in another file 'attached' to line 2
3 Foo
4 Etc

按照 inline comments on GitHub 的思路思考。

您可以使用 block decorations 在两行之间插入文本:

A block decoration is a special kind of decoration that allows you to insert a DOM node before or after a certain line, and have it follow the line as the buffer changes. You can see it in action by running the snippet below in the DevTools:

var element = document.createElement('div')
element.textContent = 'Block decorations! '
var editor = atom.workspace.getActiveTextEditor()
var marker = editor.markScreenPosition([0, 0])
editor.decorateMarker(marker, {type: 'block', position: 'before', item: element})

在您的情况下,您将注入文本而不是 GIF,但您明白了!