title: Calculate Range for Diagnostic report
body: <p>I have this JSON</p>
  <pre class="lang-json prettyprint-override"><code>{
    &quot;components&quot;: [
      &quot;component1&quot;,
      &quot;component2&quot;,
      &quot;component3&quot;
    ],
    &quot;validFrom&quot;: &quot;someDate&quot;
  }
  </code></pre>
  <p>I would like to calculate the <a href="https://code.visualstudio.com/api/references/vscode-api#Range" rel="nofollow noreferrer"><code>Range</code></a> for VSCode so that I can report <a href="https://code.visualstudio.com/api/references/vscode-api#Diagnostic" rel="nofollow noreferrer"><code>Diagnostics</code></a> in my extension.</p>
  <p>How can I calculate the Range, i.e. for <code>&quot;component1&quot;</code>? Some utility function should return something like <code>(startLine: 3, startCharacter: 5,  endLine: 3, endCharacter: 5 + component1.length)</code>.</p>