Skip to content

Commit

Permalink
[Ruby] More specific language constant scopes.
Browse files Browse the repository at this point in the history
This commit assigns more specific scopes for boolean constants `true` &
`false` from `constant.language` to `constant.language.boolean` & `nil`
from `constant.language` to `constant.language.nil`.
  • Loading branch information
UltraInstinct05 committed Aug 18, 2021
1 parent cd88108 commit cda32ee
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
7 changes: 5 additions & 2 deletions Ruby/Ruby.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,11 @@ contexts:
captures:
1: punctuation.definition.constant.ruby
push: try-regex
- match: '\b(nil|true|false)\b(?![?!])'
scope: constant.language.ruby
- match: '\b(nil)\b(?![?!])'
scope: constant.language.null.ruby
push: after-constant
- match: '\b(true|false)\b(?![?!])'
scope: constant.language.boolean.ruby
push: after-constant
- match: '\b(__(FILE|LINE|ENCODING)__|self)\b(?![?!])'
scope: variable.language.ruby
Expand Down
12 changes: 7 additions & 5 deletions Ruby/syntax_test_ruby.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1126,15 +1126,17 @@ def block_param(&block)
# ^^^^^ variable.parameter
end

def keyword_args a: nil, b: true
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function
# ^^^^^^^^^^^^^^^ meta.function.parameters
def keyword_args a: nil, b: true, c: false
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function
# ^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.parameters
# ^^^^^ meta.function.parameters.default-value
# ^ punctuation.separator
# ^^^ constant.language
# ^^^ constant.language.null
# ^ punctuation.separator
# ^ punctuation.separator
# ^^^^ constant.language
# ^^^^ constant.language.boolean
# ^ punctuation.separator.ruby
# ^^^^^ constant.language.boolean.ruby
end

def multiline_args(a, # a comment
Expand Down

0 comments on commit cda32ee

Please sign in to comment.