atom / language-ruby Goto Github PK
View Code? Open in Web Editor NEWRuby package for Atom
License: Other
Ruby package for Atom
License: Other
hi,
auto-indent for the following yields:
result = Foo.bar
(
from_month: from_month,
to_month: to_month
)
is there any way to coax auto-indent to yield the parameters indented like so...?:
result = Foo.bar
(
from_month: from_month,
to_month: to_month
)
similarly, the following yields like so:
result = Foo.bar(from_month: from_month,
to_month: to_month)
i might have expected something like:
result = Foo.bar(from_month: from_month,
to_month: to_month)
regards,
tony...
Consider the following code fragment, when inserted into the editor the syntax highlighitng shows all the code below the closed string as a string. This is not the case in sublime2 and other text-editors.
email.header = "[[\"Received\", \"by luna.mailgun.net with SMTP mgrt 8788212249833; Fri, 26 Apr 2013 18:50:30 +0000\"], [\"Received\", \"from [10.20.76.69] (Unknown [50.56.129.169]) by mxa.mailgun.org with ESMTP id 517acc75.4b341f0-worker2; Fri, 26 Apr 2013 18:50:29 -0000 (UTC)\"], [\"Message-Id\", \"<[email protected]>\"], [\"Date\", \"Fri, 26 Apr 2013 11:50:29 -0700\"], [\"From\", \"Bob <[email protected]>\"], [\"User-Agent\", \"Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130308 Thunderbird/17.0.4\"], [\"Mime-Version\", \"1.0\"], [\"To\", \"Alice <[email protected]>\"], [\"Subject\", \"Re: Sample POST request\"], [\"References\", \"<[email protected]>\"], [\"In-Reply-To\", \"<[email protected]>\"], [\"X-Mailgun-Variables\", \"{\\\"my_var_1\\\": \\\"Mailgun Variable #1\\\", \\\"my-var-2\\\": \\\"awesome\\\"}\"], [\"Content-Type\", \"multipart/mixed; boundary=\\\"------------020601070403020003080006\\\"\"], [\"Sender\", \"[email protected]\"]]"
email.content_type = params['Content-Type']
In the comment:
# @return [Array#[](0), Array[0], Array] comment
It thinks everything after #[]
is part of the string when it's part of the list of possible return classes.
Can we please get highlighting support for:
def function(keyword: var)
"win"
end
So that we can highlight the keyword different than a normal param.
Full example:
module EnvyGeeks
module Get extend self
def ips(cidr = "192.168.1.0/24")
# Technically we don't need the select but we should defensively double chck.
`ip route show #{cidr}`.each_line.select { |v| v =~ /scope link/ }.map do |v|
IPAddr.new(v.match(/(?:src )(#{Regexp.escape(cidr.gsub(/\/\d+\Z/, "").gsub(/\.\d+\Z/, ""))}\.\d+)/)[1])
end
end
end
end
sql = <<-SQL
blah1
blah2
SQL
sql = <<-SQL
blah1
blah2
SQL
sql = <<-SQL
blah1
blah2
SQL
Note the missing indention for blah1 and blah2. I've noticed it with other things in ruby as well like certain blocks and if/else statements.
Some syntaxes (like Solarized Dark and Solarized Light) need special highlight for function and class definitions.
The problem is that I can't find a way to differentiate the blocks end
s from functions and classes end
s.
Is there a way to do:
class Foo
def bar
[].each do |e|
end # normal end (no special color) ๐
end # <--- Special class (close def)
end # <--- Special class (close class)
I'd be happy to try to help if you're open to some help.
Both with and without soft wrapping enabled, atom --safe
fails to highlight this file.
Running atom 0.135.0 with Language Ruby 0.38.0 on MacOS X 10.9.5
The following loses all regexp syntax highlighting.
hello =~ /world/ ? hello : world
For some reason it actually ends up marking it as an arithmetic operator.
It would be interesting to add the ability to automatically add end
in the next line when writing new:
Thanks.
:$symbol
Gets highlighted as a global (with the colon in black or white) instead of as a symbol.
I'm using the regex railroad diagram package and noticed that many ruby regexps stopped working a while back. Seems to be an issue only with ruby. I also noticed that regexps are syntax highlighted differently depending on where they occur.
This is not syntax highlighted (railroad doesn't work):
"hello".gsub(/[aeiou]/, '*')
This is highlighted (railroad works):
x = /[aeiou]/
class Green
def initialize(value = ['1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19','20','21','22','23','PROBLEM'])
@array = value
end
def why_green
puts "everyhing is green"
puts "Unitl the next apostrophe"
'
end
def not_green
puts "Syntax is now correct"
end
end
Please add, in grammars/ruby.cson, fileTypes += "jbuilder" for https://github.com/rails/jbuilder support.
Starting in language-ruby v0.39.0, some comments are not highlighted right. It seems to be when the hash is followed by a space, @ symbol, and a Ruby method.
Here is an example:
# @attr
Opal is a ruby implementation in the browser.
I'd love to be able to type #
in a double quoted string and it would fill in #{}
or #{<selection>}
if I have something selected
If you do something like (1+2)/3, it breaks syntax highlighting. I'm using 0.31.0.
Result:
def test_subscriptions_with_sort_ordeattr_reader :attr_names
end
Expected:
def test_subscriptions_with_sort_order
<cursor here>
end
This just recently started happening.
Why every type of variables except local ones supported, is this intended or ...?
When doing the regexp:
/=\Z/
it doesn't get highlighted. It seems to only happen with =
I'm testing Atom from a Sublime Text background. I've noticed two main highlighting differences:
The former seemed like a nice change but it doesn't always detect constants correctly so I think it should default to class styling. The latter is the most important thing to address though, I've never seen any highlighter do this.
Windows 7
Atom 0.136.0
Monokai 0.8.0
Language Ruby 0.39.0
I'm using the Monokai theme and describing things in terms of those colours and how Sublime Text handles it, but lots of these are legacy issues from TextMate that Atom has inherited (which were otherwise fixed in Sublime and its ruby packages). Please read the screenshot:
Gist
I can break this down into 11 tickets if needed, it was just convenient for me to display and annotate it all in a single image.
After #41, I thought to check if multiline regexs are supported by the regex highlighting, and they're not.
Can't think of a simple way to detect the difference between the opening of a multi-line regex and a simple /
, though, given that a file may have multiple /
, all unrelated.
Using 0.32.0.
When my cursor is on an def
it should hilight the corresponding end
, same if I'm inside the block.
Having a default parameter use a )
messes up syntax highlighting. I tried to fix the issue myself but just don't have enough experience with the code to find out how to deal with it. Interestingly enough it doesn't happen if the )
is in a string and it doesn't happen with other recursive tokens like %(te(s)t)
Properly Highlighted:
LineRegexps = [
/Invalid\suser\s.*\sfrom/
]
if val =~ /Invalid\suser\s.*\sfrom/
# Do Work Son
end
Loses syntax highlighting:
LineRegexps = [
/Invalid\suser\s.*\sfrom/,
]
if val =~ /Invalid\suser\s.*\sfrom/ \
|| other
# Do work Son
end
(self.dup).downcase.gsub(/#{REMOVE_FROM_STRING}/, ""). \
gsub(/_/, "-").gsub(/\s+/, "-").gsub(/-+/, "-")
Single and multiple line regexp like the above results in everything past the #
being a comment.
language-ruby does a good job loading Guardfile
s as Ruby code. In large projects, I like to name these Guardfile-test
, Guardfile-lint
, Guardfile-doc
, etc. Could we please treat Guardfile*
as Ruby code, so these files are colorized as well?
When a user highlights something in a double quote string and presses pound it should assume the use wants to interpolate. Right now it replaces the highlighted text with a pound symbol.
Pressing pound within a double quoted string should also assume the user intends to interpolate.
e.g.
"#{}"
" Good morning #{user} It is good to see you."
Rails.logger.error("\s\s" + <<-STR.strip_heredoc.strip)
#{error_.message}: #{error_.backtrace[0]}
STR
The result is that the end )
is the same color as the string. (Actually this seems to be a bug inside of Pygments too since it seems to do the same thing.)
See atom/atom#731
In a hash table like {a: /#{x}/i}
or {:a => /#{x}/i}
the regex is not rederred as expected
def meth *args
ends up leading to the *
being marked what (
is usually highlighted as (punctuation.definition
along with variable.ruby
) instead of as a storage modifier.
See: atom/language-coffee-script#39
Per the discussion on the CoffeeScript language package, it makes sense to keep the various default Atom language packages consistent. So rather than self
being given a class of variable.language.ruby
it should be given a class of variable.language.self.ruby
.
I experienced this bug with the =~
operator originally, but it's not limited to there.
Atom seems to always want to de-indent when
in a case
statement in Ruby. It was bad that it always broke the way I like to tab single-line when
s but it got worse when I started commenting above the when
statement it would then tab behind the case
resulting in:
case true
# Comment
when arguments then do_work(son)
end
It would be nice if language-ruby respected our custom tabbing and didn't try to enforce crazy rules, please, because I like my single line when
s to look like:
case true
when argument then do_work(son)
end
But editing always breaks the tabbing in some way especially when you start commenting.
repitition => repetition
It's also misspelled in a few other places:
https://github.com/search?q=repitition+user%3Aatom&ref=searchresults&type=Code
Brought into visibility after mega-commit eb6db3d, which joined them all together.
Some snippets have identical prefixes, and it looks like Atom will choose the last-defined one.
The TextMate behavior was to pop open a prompt after pressing Tab
, allowing interactive selection of any of the available methods via (1, 2, ...) selection.
Scope of problem:
$ grep --color=none prefix snippets/language-ruby.cson|sort|uniq -c|sort|grep -v 1
2 'prefix': 'Dir'
2 'prefix': 'File'
2 'prefix': 'eac-'
2 'prefix': 'mod'
3 'prefix': 'cla'
Also referenced here: http://discuss.atom.io/t/multiple-snippets-key/2297
So I'm uncertain whether the functionality will be part of Atom, or whether by the time Atom compiles and loads CSON, there's no other way to get at those keys.
I ran into a situation where Auto Indent
results in a wrong indent. I could reduce the example code to the following:
class Example
private
def attribute_and_value(attribute, value)
"%s: %s" % [human_attribute_name(attribute),
value]
end
end
After calling Auto Indent
it will look like this:
class Example
private
def attribute_and_value(attribute, value)
"%s: %s" % [human_attribute_name(attribute),
value]
end
end
When trying to write argument-less blocks, by deleting the |variable|
code that is generated and then pressing tab again, a new |variable|
argument is created and a new end
is inserted.
I am expecting the 2nd tab to result in the cursor dropping into the block. I am 99.9% sure this used to function as expected, and mirror how TextMate 1/2 deals with this:
I am currently using Atom 0.136.0
, atom/language-ruby 0.39.0
and running on OSX 10.9.4
.
I checked the console whilst doing this, but no errors were occuring.
It seems to create multiple nested string syntax highlights... and since my theme uses a semi-transparent background for the string highlights, you can clearly see that they are piling up on top of each other because they get darker and darker throughout the file:
On closer inspection, it looks like it's related to the characters %%-
and %%=
.
And in case it helps, this is a .erb
file, and the <%%
is meant to escape the ERB tag so that it will output the <%
characters for use in an underscore template.
Moved from atom/atom#3940
value1 = value2 / (1.0 - (percentage / 100.0))
Moved over from #47 after releasing it was different that that issue.
FYI: language grammar for regexp in ruby is not ending properly
reg_exp = (/((http|https):\/\/)?[a-z0-9]+([\.\-@]{1}[a-z0-9]+)*\.[a-z]{2,5}(\/([a-z0-9]+[\.\-]?{1})*)*((\#|\:)([a-z0-9_]*[\.\-]?{1})* | \?(([a-z]+[a-z0-9_]*)(=[a-z0-9]*)&?)*)?/ix)
...continues to think the regexp is still going on after the end ')'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.