atom / language-ruby

Ruby package for Atom
Other
101 stars 144 forks source link

Implement naming conventions in Ruby grammar #291

Open chbk opened 3 years ago

chbk commented 3 years ago

Description of the Change

This is a rewrite of the Tree-sitter grammar to implement naming conventions for syntax scopes.

Benefits

Possible Drawbacks

Some new scopes to be added to themes. The changes aim to facilitate theme development, filling the template is enough to ensure coherent highlighting across languages, instead of painfully creating styling rules for every language separately.

Applicable Issues

Related Pull Requests

chbk commented 3 years ago

Preview of the changes with Atom's default syntax themes:

Without naming conventions
(current Tree-sitter grammar)
With naming conventions in
theme and Tree-sitter grammar
Solarized Dark
solarized-dark-ruby-0
Solarized Dark
solarized-dark-ruby-1
One Dark
one-dark-ruby-0
One Dark
one-dark-ruby-1
Base16 Tomorrow Dark
base16-dark-ruby-0
Base16 Tomorrow Dark
base16-dark-ruby-1
Atom Dark
atom-dark-ruby-0
Atom Dark
atom-dark-ruby-1
Solarized Light
solarized-light-ruby-0
Solarized Light
solarized-light-ruby-1
One Light
one-light-ruby-0
One Light
one-light-ruby-1
Base16 Tomorrow Light
base16-light-ruby-0
Base16 Tomorrow Light
base16-light-ruby-1
Atom Light
atom-light-ruby-0
Atom Light
atom-light-ruby-1

Code snippet:

require 'nebuchadnezzar.rb'

# That is the sound of inevitability

BEGIN {
  call = ['Knock', 'Knock', 'Neo']
  call.each do |x| puts x end
}

follow = /^(?:white)\s[rR]ab{2}it$/

door == 101 ? IO.open : IO.close

module Program
  class Smith < Agent

    include KungFu

    def -@
      super %(zion = #{23 << 1})
    end

    public
    def capture(morpheus: nil)
      if block_given?
        yield self
      else
        @humans = virus | mammal
      end
    end

    alias_method 'torment', :capture
  end
end

$red_dress = Program::Smith.new

$red_dress&.torment(morpheus: true)

begin
  6.times { *pills = :red, :blue }
rescue => unplug
  PHONEBOOTH = {
    'last_name': 'Anderson',
    :first_name => 'Thomas'
  }
end