Line decorations showing on markers but not highlight decorations…?



I have code like so:

marker = editor.markBufferRange(new Range(startPos, endPos),
                invalidate: 'inside'
                class: 'scala-symbol')
        decoration = editor.decorateMarker(marker,
          type: 'highlight',
          class: 'scala-symbol2'

and I have debugged that it is running, but I can’t see any decorations showing up. If I change ‘highlight’ for ‘line’ I get the style class on the line in the DOM, but nothing happens with ‘highlight’. Can this be some kind of interference with a syntax highlightling plugin I’m using that already puts a lot of spans around everything?

The line looks like:

<div class="cursor-line line scala-symbol2" style="position: absolute; top: 0px; width: 1078px;" data-screen-row="0"><span class="source scala"><span class="keyword declaration scala">object</span> <span class="entity name class declaration">Bar</span> <span class="meta bracket scala">{</span></span></div>


If I’m understanding what you’re asking about, highlights don’t show up on the line in the DOM. They’re stored separately and placed in the proper location visually through absolute positioning:



That definitely means I was looking at the wrong place. However, my highlights-div is empty so problem remains.

Using highlight I get:

Using line, I get:

The highlight doesn’t show…


One thing you might try using a “Range-compatible Array” instead of new Range. See the discussion here:


Ouuch! That was it thanks a lot! I would neeever have found that myself. I mean markBufferRange just swallows it…