TextMate-style syntax highlighting in PHP
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

196 lines
8.9 KiB

{
"scopeName": "source.ruby.rails",
"name": "Ruby on Rails",
"fileTypes": [
"rb",
"rxml",
"builder",
"Gemfile",
"jbuilder",
"json_builder"
],
"foldingStartMarker": "(?x)^\n\t (\\s*+\n\t (module|class|def\n\t |unless|if\n\t |case\n\t |begin\n\t |for|while|until\n\t |( \"(\\\\.|[^\"])*+\" # eat a double quoted string\n\t | '(\\\\.|[^'])*+' # eat a single quoted string\n\t | [^#\"'] # eat all but comments and strings\n\t )*\n\t ( \\s (do|begin|case)\n\t | [-+=&|*/~%^<>~] \\s*+ (if|unless)\n\t )\n\t )\\b\n\t (?! [^;]*+ ; .*? \\bend\\b )\n\t |( \"(\\\\.|[^\"])*+\" # eat a double quoted string\n\t | '(\\\\.|[^'])*+' # eat a single quoted string\n\t | [^#\"'] # eat all but comments and strings\n\t )*\n\t ( \\{ (?! [^}]*+ \\} )\n\t | \\[ (?! [^\\]]*+ \\] )\n\t )\n\t ).*$\n\t| [#] .*? \\(fold\\) \\s*+ $ # Sune’s special marker\n\t",
"foldingStopMarker": "(?x)\n\t\t( (^|;) \\s*+ end \\s*+ ([#].*)? $\n\t\t| ^ \\s*+ [}\\]] \\s*+ ([#].*)? $\n\t\t| [#] .*? \\(end\\) \\s*+ $ # Sune’s special marker\n\t\t)",
"patterns": [
{
"begin": "(^\\s*)(?=class\\s+(([.a-zA-Z0-9_:]+ControllerTest(\\s*<\\s*[.a-zA-Z0-9_:]+)?)))",
"comment": "Uses lookahead to match classes with the ControllerTest suffix; includes 'source.ruby' to avoid infinite recursion",
"end": "^\\1(?=end)\\b",
"name": "meta.rails.functional_test",
"patterns": [
{
"include": "source.ruby"
},
{
"include": "$self"
}
]
},
{
"begin": "(^\\s*)(?=class\\s+(([.a-zA-Z0-9_:]+Controller\\b(\\s*<\\s*[.a-zA-Z0-9_:]+)?)|(<<\\s*[.a-zA-Z0-9_:]+)))(?!.+\\bend\\b)",
"comment": "Uses lookahead to match classes with the Controller suffix; includes 'source.ruby' to avoid infinite recursion",
"end": "^\\1(?=end)\\b",
"name": "meta.rails.controller",
"patterns": [
{
"include": "source.ruby"
},
{
"include": "$self"
}
]
},
{
"begin": "(^\\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",
"end": "^\\1(?=end)\\b",
"name": "meta.rails.helper",
"patterns": [
{
"include": "source.ruby"
},
{
"include": "$self"
}
]
},
{
"begin": "(^\\s*)(?=class\\s+(([.a-zA-Z0-9_:]+(\\s*<\\s*(ActionMailer::Base|ApplicationMailer)))))",
"comment": "Uses lookahead to match classes that inherit from ActionMailer::Base or ApplicationMailer; includes 'source.ruby' to avoid infinite recursion",
"end": "^\\1(?=end)\\b",
"name": "meta.rails.mailer",
"patterns": [
{
"include": "source.ruby"
},
{
"include": "$self"
}
]
},
{
"begin": "(^\\s*)(?=class\\s+.+(ActiveRecord::Base|ApplicationRecord))",
"comment": "Uses lookahead to match classes that (may) inherit from ActiveRecord::Base or ApplicationRecord; includes 'source.ruby' to avoid infinite recursion",
"end": "^\\1(?=end)\\b",
"name": "meta.rails.model",
"patterns": [
{
"include": "source.ruby"
},
{
"include": "$self"
}
]
},
{
"begin": "(^\\s*)(?=class\\s+.+ActiveRecord::Migration)",
"comment": "Uses lookahead to match classes that (may) inherit from ActiveRecord::Migration; includes 'source.ruby' to avoid infinite recursion",
"end": "^\\1(?=end)\\b",
"name": "meta.rails.migration",
"patterns": [
{
"begin": "(^\\s*)(?=change_table)\\b",
"comment": "Uses lookahead to match methods change_table; includes 'source.ruby' to avoid infinite recursion",
"contentName": "meta.rails.migration.change_table",
"end": "^\\1(?=end)\\b",
"patterns": [
{
"include": "source.ruby"
},
{
"include": "$self"
}
]
},
{
"begin": "(^\\s*)(?=create_table)\\b",
"comment": "Uses lookahead to match methods create_table; includes 'source.ruby' to avoid infinite recursion",
"contentName": "meta.rails.migration.create_table",
"end": "^\\1(?=end)\\b",
"patterns": [
{
"include": "source.ruby"
},
{
"include": "$self"
}
]
},
{
"include": "source.ruby"
},
{
"include": "$self"
}
]
},
{
"begin": "(^\\s*)(?=ActiveRecord::Schema.define)",
"end": "^\\1(?=end)\\b",
"name": "meta.rails.schema",
"patterns": [
{
"begin": "(^\\s*)(?=create_table)\\b",
"comment": "Uses lookahead to match methods create_table; includes 'source.ruby' to avoid infinite recursion",
"contentName": "meta.rails.migration.create_table",
"end": "^\\1(?=end)\\b",
"patterns": [
{
"include": "source.ruby"
},
{
"include": "$self"
}
]
}
]
},
{
"begin": "(^\\s*)(?=class\\s+(?![.a-zA-Z0-9_:]+ControllerTest)(([.a-zA-Z0-9_:]+Test(\\s*<\\s*[.a-zA-Z0-9_:]+)?)|(<<\\s*[.a-zA-Z0-9_:]+)))",
"comment": "Uses lookahead to match classes with the Test suffix; includes 'source.ruby' to avoid infinite recursion",
"end": "^\\1(?=end)\\b",
"name": "meta.rails.unit_test",
"patterns": [
{
"include": "source.ruby"
},
{
"include": "$self"
}
]
},
{
"begin": "(^\\s*)\\w*::Application.routes.draw|(^\\s*)ActionController::Routing::Routes|(^\\s*)Rails.application.routes.draw",
"comment": "Uses ::Application.routes.draw to determine it is a routes file; includes 'source.ruby' to avoid infinite recursion",
"end": "^\\1(?=end)\\b",
"name": "meta.rails.routes",
"patterns": [
{
"include": "source.ruby"
},
{
"include": "$self"
}
]
},
{
"match": "\\b(after_action|after_filter|append_after_action|append_after_filter|append_around_action|append_around_filter|append_before_action|append_before_filter|around_action|around_filter|before_action|before_filter|prepend_after_action|prepend_after_filter|prepend_around_action|prepend_around_filter|prepend_before_action|prepend_before_filter|skip_action_callback|skip_after_action|skip_after_filter|skip_around_action|skip_around_filter|skip_before_action|skip_before_filter|skip_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|head|model|service|observer|serialize|scaffold|verify|hide_action)\\b",
"name": "support.function.actionpack.rails"
},
{
"match": "\\b(check_box|color_field|content_for|date_field|datetime_field|datetime_local_field|email_field|error_messages_for|fields_for|file_field|form_for|hidden_field|image_submit_tag|image_tag|label|link_to|month_field|number_field|password_field|radio_button|range_field|search_field|submit|telephone_field|text_area|text_field|time_field|url_field|week_field)\\b",
"name": "support.function.viewhelpers.rails"
},
{
"match": "\\b(after_commit|after_create|after_destroy|after_find|after_initialize|after_rollback|after_save|after_touch|after_update|after_validation|after_validation_on_create|after_validation_on_update|around_create|around_destroy|around_save|around_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|store_accessor|validate|validates|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|enum|attr_protected|attr_accessible|attr_readonly|accepts_nested_attributes_for|default_scope|scope)\\b",
"name": "support.function.activerecord.rails"
},
{
"match": "\\b(alias_method_chain|alias_attribute|delegate|cattr_accessor|mattr_accessor|returning|memoize)\\b",
"name": "support.function.activesupport.rails"
},
{
"include": "source.ruby"
}
]
}