Skip to content

Commit

Permalink
Extend Ruby word characters to include valid identifier chars (#7824)
Browse files Browse the repository at this point in the history
In Ruby `_$=@!:?` can all be part of an identifier. If we don't have
them in this list, autocomplete doesn't work as expected.

See: https://gist.github.com/misfo/1072693

This fixes one part of #7819 but not the whole ticket.

Release Notes:

- Fixed completions in Ruby not working for identifiers that start or
end with special characters (e.g.: `@`)
  • Loading branch information
mrnugget authored Feb 15, 2024
1 parent e93dca5 commit 3921259
Showing 1 changed file with 30 additions and 23 deletions.
53 changes: 30 additions & 23 deletions crates/zed/src/languages/ruby/config.toml
Original file line number Diff line number Diff line change
@@ -1,33 +1,40 @@
name = "Ruby"
grammar = "ruby"
path_suffixes = [
"rb",
"Gemfile",
"rake",
"Rakefile",
"ru",
"thor",
"cap",
"capfile",
"Capfile",
"jbuilder",
"rabl",
"rxml",
"builder",
"gemspec",
"rdoc",
"thor",
"pryrc",
"simplecov"
"rb",
"Gemfile",
"rake",
"Rakefile",
"ru",
"thor",
"cap",
"capfile",
"Capfile",
"jbuilder",
"rabl",
"rxml",
"builder",
"gemspec",
"rdoc",
"thor",
"pryrc",
"simplecov",
]
first_line_pattern = '^#!.*\bruby\b'
line_comments = ["# "]
autoclose_before = ";:.,=}])>"
brackets = [
{ start = "{", end = "}", close = true, newline = true },
{ start = "[", end = "]", close = true, newline = true },
{ start = "(", end = ")", close = true, newline = true },
{ start = "\"", end = "\"", close = true, newline = false, not_in = ["comment", "string"] },
{ start = "'", end = "'", close = true, newline = false, not_in = ["comment", "string"] },
{ start = "{", end = "}", close = true, newline = true },
{ start = "[", end = "]", close = true, newline = true },
{ start = "(", end = ")", close = true, newline = true },
{ start = "\"", end = "\"", close = true, newline = false, not_in = [
"comment",
"string",
] },
{ start = "'", end = "'", close = true, newline = false, not_in = [
"comment",
"string",
] },
]
collapsed_placeholder = "# ..."
word_characters = ["_", "$", "=", "@", "!", ":", "?"]

0 comments on commit 3921259

Please sign in to comment.