Skip to content

Commit d244a8e

Browse files
committed
GUI - improve syntax indentation
Previously if a map contained the key do: it would indent the subsequent lines as if the do was a keyword. This is now fixed. {do: 54, foo: 3} # this line is now correctly indented
1 parent 483947f commit d244a8e

File tree

1 file changed

+2
-1
lines changed
  • app/server/ruby/vendor/ruby-beautify/lib/ruby-beautify/config

1 file changed

+2
-1
lines changed

app/server/ruby/vendor/ruby-beautify/lib/ruby-beautify/config/ruby.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
ruby = RBeautify::Language.add_language(:ruby)
66

77
pre_keyword_boundary = '(^|[^a-z0-9A-Z:._])' # like \b but with : , . _ all added to list of exceptions
8+
post_keyword_boundary = '([^a-z0-9A-Z:_]|$)' # like \b but with : _ added to list of exceptions
89
start_statement_boundary = '(^|(;|=)\s*)'
910
continue_statement_boundary = '(^|;\s*)'
1011
ruby.indent_size = 2
@@ -51,7 +52,7 @@
5152
:nest_except => [:double_quote, :single_quote, :regex, :back_tick])
5253

5354
ruby.add_matcher(:standard,
54-
/((#{start_statement_boundary}(module|class|def))|#{pre_keyword_boundary}do)\b/,
55+
/((#{start_statement_boundary}(module|class|def))|#{pre_keyword_boundary}do#{post_keyword_boundary})/,
5556
/(((^|;|\s)end)|#{continue_statement_boundary}(rescue|ensure))\b/,
5657
:nest_except => [:double_quote, :regex, :backtick])
5758

0 commit comments

Comments
 (0)