aaaaargZombies / webcomponent-template-editor.nvim

access html / css language features while editing template strings in webcomponents
MIT License
1 stars 0 forks source link

least specific capture always chosen to send to buffer #3

Closed aaaaargZombies closed 2 weeks ago

aaaaargZombies commented 1 month ago

description

when mapping an array of a to html elements inside another template the outer selection will always trigger the edit action.

    return html`<p>SUCCESS STATE</p>
      <p>I probably want to quantize these values somehow</p>
      <p>
        <code>(min: ${Math.min(...heights)}</code>,
        <code> max: ${Math.max(...heights)})</code>
      </p>
      <div class="track">
        ${heights.map(
          (x) => html`
            <div style="height:${Math.round(quantize(x))}px;"></div>
          `
        )}
      </div>`;

view code in context

This is because we work from top to bottom to grab the captures and then start work if our cursor is within the bounds of the captures rows.

solutions might be:

https://github.com/aaaaargZombies/webcomponent-template-editor.nvim/blob/086c143151c3c71ccd55124e991d363a07a15879/lua/webcomponent-template-editor/init.lua#L90-L93