title: Monaco editor deltaDecorations changes the style of the whole text instead of just the given range
body: <p>I am using Monaco editor with <a href="https://github.com/react-monaco-editor/react-monaco-editor" rel="nofollow noreferrer">React</a>. I want to change the background color of a specific range in a line. I am following <a href="https://microsoft.github.io/monaco-editor/playground.html#interacting-with-the-editor-line-and-inline-decorations" rel="nofollow noreferrer">this tutorial</a> which is from the official documentation.</p>
  <p>Here's how the code looks like.</p>
  <pre class="lang-js prettyprint-override"><code>const editorDidMount = (editor, monaco) =&gt; {
      const r = new monaco.Range(1, 3, 1, 10);
      editor.deltaDecorations(
          [],
          [
              {
                  range: r,
                  options: {
                      inlineClassName: &quot;myInlineDecoration&quot;,
                  },
              },
          ]
      );
  };
  </code></pre>
  <p>This is how I create the editor element. Nothing special.</p>
  <pre class="lang-js prettyprint-override"><code>&lt;MonacoEditor
      width={800}
      height={400}
      language=&quot;java&quot;
      value={value}
      onChange={onValueChange}
      editorDidMount={editorDidMount}
  /&gt;
  
  </code></pre>
  <p>and the css</p>
  <pre class="lang-css prettyprint-override"><code>.myInlineDecoration {
      background: lightgreen;
  }
  </code></pre>
  <p>The problem is that this changes the background color of the whole text to <code>lightgreen</code> instead of just the given range.</p>
  <p>It looks like this. But I just want a specific range, not everything.
  <a href="https://i.stack.imgur.com/ErwhL.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ErwhL.png" alt="enter image description here" /></a></p>
  <p>I tried different options from <a href="https://microsoft.github.io/monaco-editor/api/interfaces/monaco.editor.imodeldecorationoptions.html" rel="nofollow noreferrer">here</a> but none of them made any difference.</p>
  <p>Let me know if more information is needed.</p>