atom / language-ruby

Ruby package for Atom
Other
101 stars 144 forks source link

Block parameters no longer able to be styled #243

Closed npezza93 closed 6 years ago

npezza93 commented 6 years ago

Prerequisites

Description

Block parameters and surrounding pipes are grouped as one node and cannot be separately styled.

With TreeSitter on:

<div class="line cursor-line" style="" data-screen-row="47">
  <span class="">
    <span class="syntax--entity syntax--name syntax--function">imablock</span> 
    <span class="syntax--keyword syntax--control">do</span> 
    |param1, param2|
  </span>
</div>
image

With TreeSitter off:

<div class="line cursor-line" style="" data-screen-row="47">
  <span class="">
    <span class="syntax--source syntax--ruby">
      imablock 
      <span class="syntax--keyword syntax--control syntax--start-block syntax--ruby">do</span> 
      <span class="syntax--punctuation syntax--separator syntax--variable syntax--ruby">|</span>
      <span class="syntax--variable syntax--other syntax--block syntax--ruby">param1</span>
      <span class="syntax--punctuation syntax--separator syntax--object syntax--ruby">,</span> 
      <span class="syntax--variable syntax--other syntax--block syntax--ruby">param2</span>
      <span class="syntax--punctuation syntax--separator syntax--variable syntax--ruby">|</span>
    </span>
  </span>
</div>
image

Now with TreeSitter on I can how this styling might be the default because it is almost the exact same as a normal method definition:

<div class="line cursor-line" style="" data-screen-row="44">
  <span class="">
    <span class="syntax--keyword syntax--control">def</span> 
    <span class="syntax--entity syntax--name syntax--function">imablock</span>
    <span class="syntax--punctuation syntax--definition syntax--parameters">(</span>
    param1, param2
    <span class="syntax--punctuation syntax--definition syntax--parameters">)</span>
  </span>
</div>
image

But in a method definition the parenthesis are wrapped in their own element. So

  1. Could we get the ability to style block parameters?
  2. If one is not possible or is working as desired, could we wrap the pipes with their own classes like what's on method definitions?

Thanks!

Steps to Reproduce

  1. Create a block like shown above and toggle TreeSitter using the One Dark syntax theme.

Expected behavior: To be able to style block parameters Actual behavior: Can no longer styling block parameters Reproduces how often: 100%

Versions

1.34.0-nightly2

rsese commented 6 years ago

Thanks for these report @npezza93 - just noting I can reproduce what you describe with 1.34.0-nightly0 on macOS 10.12.6, we'll ask the team to take a look.