Sublime Forum

Ruby 2.0 syntax (Ruby.tmLanguage)

#1

We should support Ruby 2.0 new symbol’s array syntax:
i%(id name title content)
It should be like array of strings:
%w(…)

How can i achieve this? I tried to place “Ruby.tmLanguage” in “Packages/Ruby” but it does not work.

0 Likes

#2

I just answered a question on StackOverflow about this. If you use the new Ruby2.tmLanguage gist I posted and follow the directions in my answer, you should have the following two lines highlighted identically:

%w[foo bar] # "foo", "bar"]
%i[foo bar] # :foo, :bar]
0 Likes

#3

Thanks for the StackOverflow pointer. While poking around in my local copy of Ruby.tmLanguage, I noticed that there are separate sections for the lower- and upper-case members of Ruby’s “%” operator set. %i has its interpolated counterpart, %I, so it makes sense to add support for that as well.

I noticed at the same time that the file seems to support a “%R” operator. After being equally unable to find any documentation mentioning it, or of producing any form that irb found digestible, I concluded that it is not a feature of current Ruby and deleted it from my copy of Ruby.tmLanguage.

I have a running collection of tweaks to Sublime Text Ruby files here: github.com/hivehand/rt_st2

At the moment they’re limited to support for the require_relative keyword, pipe characters (‘|’) as paired elements, and, as of now, the %i and %I operators. Suggestions are welcome.

0 Likes