atom / language-ruby

Ruby package for Atom
Other
100 stars 144 forks source link

Keyword arguments not properly highlighted #241

Closed npezza93 closed 5 years ago

npezza93 commented 5 years ago

Prerequisites

Description

With tree sitter off the markup looks like:

<span class="syntax--meta syntax--function syntax--method syntax--with-arguments syntax--ruby">
  <span class="syntax--keyword syntax--control syntax--def syntax--ruby">def</span> 
  <span class="syntax--entity syntax--name syntax--function syntax--ruby">predicate?</span>
  <span class="syntax--punctuation syntax--definition syntax--parameters syntax--ruby">(</span>
  <span class="syntax--constant syntax--other syntax--symbol syntax--hashkey syntax--parameter syntax--function syntax--ruby">
    date
    <span class="syntax--punctuation syntax--definition syntax--constant syntax--hashkey syntax--ruby">:</span>
  </span> 
  start_on
  <span class="syntax--punctuation syntax--definition syntax--parameters syntax--ruby">)</span>
</span>
image

With tree sitter on you get:

<span class="">
  <span class="leading-whitespace">    </span>
  <span class="syntax--keyword syntax--control">
    def
  </span> 
  <span class="syntax--entity syntax--name syntax--function">predicate?</span>
  <span class="syntax--punctuation syntax--definition syntax--parameters">(</span>
  date: start_on
  <span class="syntax--punctuation syntax--definition syntax--parameters">)</span>
</span>
image

I would expect the date symbol in this case to be highlighted and not grouped together with the default param.

Steps to Reproduce

  1. Create a method with a keyword argument that has a default value that calls another method. Eg:
    def predicate?(date: start_on)
    do_a_thing
    end

Expected behavior: I expected the keyword argument to be highlighted and not gray. Actual behavior: It is not highlighted.

Reproduces how often: 100%

Versions

Atom Nightly -> 1.34.0-nightly2

Perhaps this is intentional but it's different than I would expect so feel free to close if this is in fact intentional. Thanks!

Ben3eeE commented 5 years ago

Thanks for the report 🙇

This looks like a regression with tree-sitter. We will take a look at this as soon as we can 🙂