Atom API marker decoration not functioning


#1

Hi,

I’m trying to decorate some markers on a text editor, but atom is not marking the items, nor decorating them.

Snippet:

// Highlight first line from col 1 to col 10
var row = 1, start_column = 1, end_column = 10;
var range = [[row, start_column], [row, end_column]];
var marker = aTextEditorObjectHere.markBufferRange(range);
aTextEditorObjectHere.decorateMarker(marker, {type: ‘highlight’, class: ‘my-highlighter-class’});

And this is the content of [my-package.css] in the ‘styles’ folder of my package:
.my-highlighter-class {
color: red;
background-color: yellow;
}

Nothing shows up. I open devtools to inspect the doom, no

highlight was added to the specified range.

Thank you for your help :thumbs:


#2

Updating from Slack discussion

I used the following code in the Developer Tools console and the decorations appeared as expected using both v1.14.4 and the latest development version:

editor = atom.workspace.getActiveTextEditor()
marker = editor.markBufferRange([[0, 0], [Infinity, Infinity]])
editor.decorateMarker(marker, {type: 'highlight', class: 'selection'})

It made the entire editor appear as if it were selected.