forked from fnando/sublime-better-rails
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRuby on Rails.sublime-syntax
72 lines (72 loc) · 4.21 KB
/
Ruby on Rails.sublime-syntax
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
%YAML 1.2
---
name: Ruby on Rails
file_extensions:
- rxml
- builder
scope: source.ruby.rails
contexts:
main:
- match: '(^\s*)(?=module\s+((([A-Z]\w*::)*)[A-Z]\w*)Helper)'
comment: Uses lookahead to match modules with the Helper suffix; includes 'source.ruby' to avoid infinite recursion
push:
- meta_scope: meta.rails.helper
- match: ^\1(?=end)\b
pop: true
- include: 'scope:source.ruby'
- include: main
- match: '(^\s*)(?=class\s+(([.a-zA-Z0-9_:]+(\s*<\s*(ActionMailer::Base|ApplicationMailer)))))'
comment: Uses lookahead to match classes that inherit from ActionMailer::Base; includes 'source.ruby' to avoid infinite recursion
push:
- meta_scope: meta.rails.mailer
- match: ^\1(?=end)\b
pop: true
- include: 'scope:source.ruby'
- include: main
- match: (^\s*)(?=class\s+.+(?:ActiveRecord::Base|ApplicationModel))
comment: Uses lookahead to match classes that (may) inherit from ActiveRecord::Base; includes 'source.ruby' to avoid infinite recursion
push:
- meta_scope: meta.rails.model
- match: ^\1(?=end)\b
pop: true
- include: 'scope:source.ruby'
- include: main
- match: (^\s*)(?=class\s+.+ActiveRecord::Migration)
comment: Uses lookahead to match classes that (may) inherit from ActiveRecord::Migration; includes 'source.ruby' to avoid infinite recursion
push:
- meta_scope: meta.rails.migration
- match: ^\1(?=end)\b
pop: true
- match: (^\s*)(?=change_table)\b
comment: Uses lookahead to match methods change_table; includes 'source.ruby' to avoid infinite recursion
push:
- meta_content_scope: meta.rails.migration.change_table
- match: ^\1(?=end)\b
pop: true
- include: 'scope:source.ruby'
- include: main
- match: (^\s*)(?=create_table)\b
comment: Uses lookahead to match methods create_table; includes 'source.ruby' to avoid infinite recursion
push:
- meta_content_scope: meta.rails.migration.create_table
- match: ^\1(?=end)\b
pop: true
- include: 'scope:source.ruby'
- include: main
- include: 'scope:source.ruby'
- include: main
- match: (^\s*)(?=Rails\.application\.routes\.draw do)
comment: Uses Rails.application.routes.draw to determine it is a routes file; includes 'source.ruby' to avoid infinite recursion
push:
- meta_scope: meta.rails.routes
- match: ^\1(?=end)\b
pop: true
- include: 'scope:source.ruby'
- include: main
- match: \b(before_action|skip_before_action|after_action|skip_after_action|around_action|before_filter|skip_before_filter|skip_after_filter|after_filter|around_filter|filter|filter_parameter_logging|layout|require_dependency|render|render_action|render_text|render_file|render_template|render_nothing|render_component|render_without_layout|rescue_from|url_for|redirect_to|redirect_to_path|redirect_to_url|respond_to|helper|helper_method|model|service|observer|serialize|scaffold|verify|hide_action|append_view_path|prepend_view_path|view_paths|protect_from_forgery)\b
scope: support.function.actionpack.rails
- match: \b(default_scope|named_scope|after_create|after_destroy|after_save|after_update|after_validation|after_validation_on_create|after_validation_on_update|before_create|before_destroy|before_save|before_update|before_validation|before_validation_on_create|before_validation_on_update|composed_of|belongs_to|has_one|has_many|has_and_belongs_to_many|validates?|scope|validate_on_create|validates_numericality_of|validate_on_update|validates_acceptance_of|validates_associated|validates_confirmation_of|validates_each|validates_format_of|validates_inclusion_of|validates_exclusion_of|validates_length_of|validates_presence_of|validates_size_of|validates_uniqueness_of|attr_protected|attr_accessible|attr_readonly|validates_with)\b
scope: support.function.activerecord.rails
- match: \b(alias_method_chain|alias_attribute|delegate|cattr_accessor|mattr_accessor|returning)\b
scope: support.function.activesupport.rails
- include: 'scope:source.ruby'