CodeLens style decorations

If we wanted to implement CodeLens style decorations (inserting text above specific elements), would we still need to use absolute positioning as mentioned here (CodeLens like in VSCode · Issue #5940 · codemirror/codemirror5 · GitHub) or is there a better way with CodeMirror 6?

It might be possible to insert a widget decoration holding a relatively positioned element, and then position the text absolutely within that.