diff --git a/config/action_view_helpers/actioncable/action_cable_helper/action_cable_meta_tag.yml b/config/action_view_helpers/actioncable/action_cable_helper/action_cable_meta_tag.yml index 5560620b5..c03e43a12 100644 --- a/config/action_view_helpers/actioncable/action_cable_helper/action_cable_meta_tag.yml +++ b/config/action_view_helpers/actioncable/action_cable_helper/action_cable_meta_tag.yml @@ -4,6 +4,7 @@ source: "ActionCable::Helpers::ActionCableHelper#action_cable_meta_tag" gem: "actioncable" output: "html" visibility: "public" +context: "head" supported: false supports_block: false signature: "action_cable_meta_tag" diff --git a/config/action_view_helpers/actionview/asset_tag_helper/auto_discovery_link_tag.yml b/config/action_view_helpers/actionview/asset_tag_helper/auto_discovery_link_tag.yml index a74f85a84..30a7b5828 100644 --- a/config/action_view_helpers/actionview/asset_tag_helper/auto_discovery_link_tag.yml +++ b/config/action_view_helpers/actionview/asset_tag_helper/auto_discovery_link_tag.yml @@ -4,6 +4,7 @@ source: "ActionView::Helpers::AssetTagHelper#auto_discovery_link_tag" gem: "actionview" output: "html" visibility: "public" +context: "head" supported: false supports_block: false signature: "auto_discovery_link_tag(type = :rss, url_options = {}, tag_options = {})" diff --git a/config/action_view_helpers/actionview/asset_tag_helper/favicon_link_tag.yml b/config/action_view_helpers/actionview/asset_tag_helper/favicon_link_tag.yml index fcd7dac25..921a0780b 100644 --- a/config/action_view_helpers/actionview/asset_tag_helper/favicon_link_tag.yml +++ b/config/action_view_helpers/actionview/asset_tag_helper/favicon_link_tag.yml @@ -4,6 +4,7 @@ source: "ActionView::Helpers::AssetTagHelper#favicon_link_tag" gem: "actionview" output: "html" visibility: "public" +context: "head" supported: false supports_block: false signature: "favicon_link_tag(source = \"favicon.ico\", options = {})" diff --git a/config/action_view_helpers/actionview/asset_tag_helper/javascript_include_tag.yml b/config/action_view_helpers/actionview/asset_tag_helper/javascript_include_tag.yml index 0dd7d13ee..9515c6e01 100644 --- a/config/action_view_helpers/actionview/asset_tag_helper/javascript_include_tag.yml +++ b/config/action_view_helpers/actionview/asset_tag_helper/javascript_include_tag.yml @@ -4,6 +4,7 @@ source: "ActionView::Helpers::AssetTagHelper#javascript_include_tag" gem: "actionview" output: "html" visibility: "public" +context: "head" supported: true supports_block: false signature: "javascript_include_tag(*sources)" diff --git a/config/action_view_helpers/actionview/asset_tag_helper/preload_link_tag.yml b/config/action_view_helpers/actionview/asset_tag_helper/preload_link_tag.yml index 965382dee..4de6f3004 100644 --- a/config/action_view_helpers/actionview/asset_tag_helper/preload_link_tag.yml +++ b/config/action_view_helpers/actionview/asset_tag_helper/preload_link_tag.yml @@ -4,6 +4,7 @@ source: "ActionView::Helpers::AssetTagHelper#preload_link_tag" gem: "actionview" output: "html" visibility: "public" +context: "head" supported: false supports_block: false signature: "preload_link_tag(source, options = {})" diff --git a/config/action_view_helpers/actionview/asset_tag_helper/stylesheet_link_tag.yml b/config/action_view_helpers/actionview/asset_tag_helper/stylesheet_link_tag.yml index ca9a0ade9..2e37e6d8b 100644 --- a/config/action_view_helpers/actionview/asset_tag_helper/stylesheet_link_tag.yml +++ b/config/action_view_helpers/actionview/asset_tag_helper/stylesheet_link_tag.yml @@ -4,6 +4,7 @@ source: "ActionView::Helpers::AssetTagHelper#stylesheet_link_tag" gem: "actionview" output: "html" visibility: "public" +context: "head" supported: false supports_block: false signature: "stylesheet_link_tag(*sources)" diff --git a/config/action_view_helpers/actionview/csp_helper/csp_meta_tag.yml b/config/action_view_helpers/actionview/csp_helper/csp_meta_tag.yml index 79737e02f..689d81bd5 100644 --- a/config/action_view_helpers/actionview/csp_helper/csp_meta_tag.yml +++ b/config/action_view_helpers/actionview/csp_helper/csp_meta_tag.yml @@ -4,6 +4,7 @@ source: "ActionView::Helpers::CspHelper#csp_meta_tag" gem: "actionview" output: "html" visibility: "public" +context: "head" supported: false supports_block: false signature: "csp_meta_tag(**options)" diff --git a/config/action_view_helpers/actionview/csrf_helper/csrf_meta_tags.yml b/config/action_view_helpers/actionview/csrf_helper/csrf_meta_tags.yml index f8ab958a8..e7569d57d 100644 --- a/config/action_view_helpers/actionview/csrf_helper/csrf_meta_tags.yml +++ b/config/action_view_helpers/actionview/csrf_helper/csrf_meta_tags.yml @@ -4,6 +4,7 @@ source: "ActionView::Helpers::CsrfHelper#csrf_meta_tags" gem: "actionview" output: "html" visibility: "public" +context: "head" supported: false supports_block: false signature: "csrf_meta_tags" diff --git a/config/action_view_helpers/importmap-rails/importmap_tags_helper/javascript_import_module_tag.yml b/config/action_view_helpers/importmap-rails/importmap_tags_helper/javascript_import_module_tag.yml index 40d9a4535..5b315af46 100644 --- a/config/action_view_helpers/importmap-rails/importmap_tags_helper/javascript_import_module_tag.yml +++ b/config/action_view_helpers/importmap-rails/importmap_tags_helper/javascript_import_module_tag.yml @@ -4,6 +4,7 @@ source: "Importmap::ImportmapTagsHelper#javascript_import_module_tag" gem: "importmap-rails" output: "html" visibility: "public" +context: "head" supported: false supports_block: false signature: "javascript_import_module_tag(*module_names)" diff --git a/config/action_view_helpers/importmap-rails/importmap_tags_helper/javascript_importmap_module_preload_tags.yml b/config/action_view_helpers/importmap-rails/importmap_tags_helper/javascript_importmap_module_preload_tags.yml index 7c8ef9d94..598e63c92 100644 --- a/config/action_view_helpers/importmap-rails/importmap_tags_helper/javascript_importmap_module_preload_tags.yml +++ b/config/action_view_helpers/importmap-rails/importmap_tags_helper/javascript_importmap_module_preload_tags.yml @@ -4,6 +4,7 @@ source: "Importmap::ImportmapTagsHelper#javascript_importmap_module_preload_tags gem: "importmap-rails" output: "html" visibility: "public" +context: "head" supported: false supports_block: false signature: "javascript_importmap_module_preload_tags(importmap = Rails.application.importmap, entry_point: \"application\")" diff --git a/config/action_view_helpers/importmap-rails/importmap_tags_helper/javascript_importmap_tags.yml b/config/action_view_helpers/importmap-rails/importmap_tags_helper/javascript_importmap_tags.yml index 5544fcbbe..b85054b5e 100644 --- a/config/action_view_helpers/importmap-rails/importmap_tags_helper/javascript_importmap_tags.yml +++ b/config/action_view_helpers/importmap-rails/importmap_tags_helper/javascript_importmap_tags.yml @@ -4,6 +4,7 @@ source: "Importmap::ImportmapTagsHelper#javascript_importmap_tags" gem: "importmap-rails" output: "html" visibility: "public" +context: "head" supported: false supports_block: false signature: "javascript_importmap_tags(entry_point = \"application\", importmap: Rails.application.importmap)" diff --git a/config/action_view_helpers/importmap-rails/importmap_tags_helper/javascript_inline_importmap_tag.yml b/config/action_view_helpers/importmap-rails/importmap_tags_helper/javascript_inline_importmap_tag.yml index e9164e15b..99d1cc0df 100644 --- a/config/action_view_helpers/importmap-rails/importmap_tags_helper/javascript_inline_importmap_tag.yml +++ b/config/action_view_helpers/importmap-rails/importmap_tags_helper/javascript_inline_importmap_tag.yml @@ -4,6 +4,7 @@ source: "Importmap::ImportmapTagsHelper#javascript_inline_importmap_tag" gem: "importmap-rails" output: "html" visibility: "public" +context: "head" supported: false supports_block: false signature: "javascript_inline_importmap_tag(importmap_json = Rails.application.importmap.to_json(resolver: self))" diff --git a/config/action_view_helpers/importmap-rails/importmap_tags_helper/javascript_module_preload_tag.yml b/config/action_view_helpers/importmap-rails/importmap_tags_helper/javascript_module_preload_tag.yml index 508e33145..d43bc60e0 100644 --- a/config/action_view_helpers/importmap-rails/importmap_tags_helper/javascript_module_preload_tag.yml +++ b/config/action_view_helpers/importmap-rails/importmap_tags_helper/javascript_module_preload_tag.yml @@ -4,6 +4,7 @@ source: "Importmap::ImportmapTagsHelper#javascript_module_preload_tag" gem: "importmap-rails" output: "html" visibility: "public" +context: "head" supported: false supports_block: false signature: "javascript_module_preload_tag(*paths)" diff --git a/config/action_view_helpers/turbo-rails/drive_helper/turbo_exempts_page_from_cache_tag.yml b/config/action_view_helpers/turbo-rails/drive_helper/turbo_exempts_page_from_cache_tag.yml index c3e415521..27e6b5724 100644 --- a/config/action_view_helpers/turbo-rails/drive_helper/turbo_exempts_page_from_cache_tag.yml +++ b/config/action_view_helpers/turbo-rails/drive_helper/turbo_exempts_page_from_cache_tag.yml @@ -4,6 +4,7 @@ source: "Turbo::DriveHelper#turbo_exempts_page_from_cache_tag" gem: "turbo-rails" output: "html" visibility: "public" +context: "head" supported: false supports_block: false signature: "turbo_exempts_page_from_cache_tag" diff --git a/config/action_view_helpers/turbo-rails/drive_helper/turbo_exempts_page_from_preview_tag.yml b/config/action_view_helpers/turbo-rails/drive_helper/turbo_exempts_page_from_preview_tag.yml index a3e01e2e5..3e5bd5dd7 100644 --- a/config/action_view_helpers/turbo-rails/drive_helper/turbo_exempts_page_from_preview_tag.yml +++ b/config/action_view_helpers/turbo-rails/drive_helper/turbo_exempts_page_from_preview_tag.yml @@ -4,6 +4,7 @@ source: "Turbo::DriveHelper#turbo_exempts_page_from_preview_tag" gem: "turbo-rails" output: "html" visibility: "public" +context: "head" supported: false supports_block: false signature: "turbo_exempts_page_from_preview_tag" diff --git a/config/action_view_helpers/turbo-rails/drive_helper/turbo_page_requires_reload_tag.yml b/config/action_view_helpers/turbo-rails/drive_helper/turbo_page_requires_reload_tag.yml index cd214305c..7c83b7bf7 100644 --- a/config/action_view_helpers/turbo-rails/drive_helper/turbo_page_requires_reload_tag.yml +++ b/config/action_view_helpers/turbo-rails/drive_helper/turbo_page_requires_reload_tag.yml @@ -4,6 +4,7 @@ source: "Turbo::DriveHelper#turbo_page_requires_reload_tag" gem: "turbo-rails" output: "html" visibility: "public" +context: "head" supported: false supports_block: false signature: "turbo_page_requires_reload_tag" diff --git a/config/action_view_helpers/turbo-rails/drive_helper/turbo_refresh_method_tag.yml b/config/action_view_helpers/turbo-rails/drive_helper/turbo_refresh_method_tag.yml index 29bb9663e..4b41f7dd6 100644 --- a/config/action_view_helpers/turbo-rails/drive_helper/turbo_refresh_method_tag.yml +++ b/config/action_view_helpers/turbo-rails/drive_helper/turbo_refresh_method_tag.yml @@ -4,6 +4,7 @@ source: "Turbo::DriveHelper#turbo_refresh_method_tag" gem: "turbo-rails" output: "html" visibility: "public" +context: "head" supported: false supports_block: false signature: "turbo_refresh_method_tag(method = :replace)" diff --git a/config/action_view_helpers/turbo-rails/drive_helper/turbo_refresh_scroll_tag.yml b/config/action_view_helpers/turbo-rails/drive_helper/turbo_refresh_scroll_tag.yml index d45f3b5e4..1bc5de585 100644 --- a/config/action_view_helpers/turbo-rails/drive_helper/turbo_refresh_scroll_tag.yml +++ b/config/action_view_helpers/turbo-rails/drive_helper/turbo_refresh_scroll_tag.yml @@ -4,6 +4,7 @@ source: "Turbo::DriveHelper#turbo_refresh_scroll_tag" gem: "turbo-rails" output: "html" visibility: "public" +context: "head" supported: false supports_block: false signature: "turbo_refresh_scroll_tag(scroll = :reset)" diff --git a/config/action_view_helpers/turbo-rails/drive_helper/turbo_refreshes_with.yml b/config/action_view_helpers/turbo-rails/drive_helper/turbo_refreshes_with.yml index efc4db805..ab9a2012a 100644 --- a/config/action_view_helpers/turbo-rails/drive_helper/turbo_refreshes_with.yml +++ b/config/action_view_helpers/turbo-rails/drive_helper/turbo_refreshes_with.yml @@ -4,6 +4,7 @@ source: "Turbo::DriveHelper#turbo_refreshes_with" gem: "turbo-rails" output: "void" visibility: "public" +context: "head" supported: false supports_block: false signature: "turbo_refreshes_with(method: :replace, scroll: :reset)" diff --git a/config/action_view_helpers/turbo-rails/includes_helper/turbo_include_tags.yml b/config/action_view_helpers/turbo-rails/includes_helper/turbo_include_tags.yml index 595aa9311..892a08979 100644 --- a/config/action_view_helpers/turbo-rails/includes_helper/turbo_include_tags.yml +++ b/config/action_view_helpers/turbo-rails/includes_helper/turbo_include_tags.yml @@ -4,6 +4,7 @@ source: "Turbo::IncludesHelper#turbo_include_tags" gem: "turbo-rails" output: "html" visibility: "public" +context: "head" supported: false supports_block: false signature: "turbo_include_tags" diff --git a/lib/herb/engine/debug_visitor.rb b/lib/herb/engine/debug_visitor.rb index 946749f29..79c4c9240 100644 --- a/lib/herb/engine/debug_visitor.rb +++ b/lib/herb/engine/debug_visitor.rb @@ -1,9 +1,14 @@ # frozen_string_literal: true # typed: false +require_relative "../action_view/helper_registry" + module Herb class Engine class DebugVisitor < Herb::Visitor + HEAD_CONTENT_HELPER_PATTERN = /\b(?:#{Herb::ActionView::HelperRegistry.by_context("head").map { |helper| Regexp.escape(helper.name) }.join("|")})\b/ #: Regexp + private_constant :HEAD_CONTENT_HELPER_PATTERN + def initialize(file_path: nil, project_path: nil) super() @@ -76,7 +81,7 @@ def visit_erb_content_node(node) if !@in_attribute && !@in_html_comment && !@in_html_doctype && !in_excluded_context? && erb_output?(node.tag_opening.value) code = node.content.value.strip - @erb_nodes_to_wrap << node unless complex_rails_helper?(code) + @erb_nodes_to_wrap << node unless complex_rails_helper?(code) || head_content_helper?(code) end super @@ -210,7 +215,7 @@ def create_debug_span_for_erb(erb_node) code = erb_node.content.value.strip erb_code = "#{opening} #{code} %>" - return erb_node if complex_rails_helper?(code) + return erb_node if complex_rails_helper?(code) || head_content_helper?(code) line = erb_node.location&.start&.line column = erb_node.location&.start&.column @@ -329,7 +334,7 @@ def in_script_or_style_context? end def in_excluded_context? - excluded_tags = ["script", "style", "head", "title", "textarea", "pre", "svg", "math"] + excluded_tags = ["script", "style", "head", "title", "meta", "link", "base", "textarea", "pre", "svg", "math"] return true if excluded_tags.any? { |tag| @element_stack.include?(tag) } if @erb_block_stack.any? { |node| javascript_tag?(node.content.value.strip) || include_debug_disable_comment?(node.content.value.strip) } @@ -386,6 +391,17 @@ def javascript_tag?(code) false end + # TODO: Rewrite using Prism Nodes once available + def head_content_helper?(code) + cleaned_code = code.strip.gsub(/\s+/, " ") + + return true if cleaned_code.match?(HEAD_CONTENT_HELPER_PATTERN) + + return true if cleaned_code.match?(/\btag\.(?:meta|link|title|base)\b/) + + false + end + def include_debug_disable_comment?(code) cleaned_code = code.strip.gsub(/\s+/, " ") diff --git a/sig/herb/action_view/helper_registry.rbs b/sig/herb/action_view/helper_registry.rbs index 92e49780c..3d95fe1dd 100644 --- a/sig/herb/action_view/helper_registry.rbs +++ b/sig/herb/action_view/helper_registry.rbs @@ -586,6 +586,8 @@ module Herb attr_reader visibility: String + attr_reader context: String? + attr_reader tag_name: String? attr_reader detect_style: Symbol @@ -608,8 +610,8 @@ module Herb attr_reader aliases: Array[String] - # : (name: String, type: Symbol, source: String, gem: String, output: Symbol, visibility: String, tag_name: String?, is_void: bool, supports_block: bool, preferred_for_tag: bool, supported: bool, detect_style: Symbol, description: String, signature: String, documentation_url: String, implicit_attribute: HelperImplicitAttribute?, arguments: Array[HelperArgument], options: Array[HelperOption], block_arguments: Array[HelperBlockArgument], special_behaviors: Array[Symbol], aliases: Array[String]) -> void - def initialize: (name: String, type: Symbol, source: String, gem: String, output: Symbol, visibility: String, tag_name: String?, is_void: bool, supports_block: bool, preferred_for_tag: bool, supported: bool, detect_style: Symbol, description: String, signature: String, documentation_url: String, implicit_attribute: HelperImplicitAttribute?, arguments: Array[HelperArgument], options: Array[HelperOption], block_arguments: Array[HelperBlockArgument], special_behaviors: Array[Symbol], aliases: Array[String]) -> void + # : (name: String, type: Symbol, source: String, gem: String, output: Symbol, visibility: String, context: String?, tag_name: String?, is_void: bool, supports_block: bool, preferred_for_tag: bool, supported: bool, detect_style: Symbol, description: String, signature: String, documentation_url: String, implicit_attribute: HelperImplicitAttribute?, arguments: Array[HelperArgument], options: Array[HelperOption], block_arguments: Array[HelperBlockArgument], special_behaviors: Array[Symbol], aliases: Array[String]) -> void + def initialize: (name: String, type: Symbol, source: String, gem: String, output: Symbol, visibility: String, context: String?, tag_name: String?, is_void: bool, supports_block: bool, preferred_for_tag: bool, supported: bool, detect_style: Symbol, description: String, signature: String, documentation_url: String, implicit_attribute: HelperImplicitAttribute?, arguments: Array[HelperArgument], options: Array[HelperOption], block_arguments: Array[HelperBlockArgument], special_behaviors: Array[Symbol], aliases: Array[String]) -> void # : () -> bool def void?: () -> bool @@ -1139,6 +1141,8 @@ module Herb BY_TAG_NAME: Hash[String, Array[HelperEntry]] + BY_CONTEXT: Hash[String, Array[HelperEntry]] + # : (String) -> HelperEntry? def self.get: (String) -> HelperEntry? @@ -1169,6 +1173,9 @@ module Herb # : () -> Array[HelperEntry] def self.supported: () -> Array[HelperEntry] + # : (String) -> Array[HelperEntry] + def self.by_context: (String) -> Array[HelperEntry] + # : (String) -> Array[HelperEntry] def self.by_gem: (String) -> Array[HelperEntry] diff --git a/sig/herb/engine/debug_visitor.rbs b/sig/herb/engine/debug_visitor.rbs index 77bef2d4e..45abc3294 100644 --- a/sig/herb/engine/debug_visitor.rbs +++ b/sig/herb/engine/debug_visitor.rbs @@ -3,6 +3,8 @@ module Herb class Engine class DebugVisitor < Herb::Visitor + HEAD_CONTENT_HELPER_PATTERN: Regexp + def initialize: (?file_path: untyped, ?project_path: untyped) -> untyped def visit_document_node: (untyped node) -> untyped @@ -69,6 +71,9 @@ module Herb # TODO: Rewrite using Prism Nodes once available def javascript_tag?: (untyped code) -> untyped + # TODO: Rewrite using Prism Nodes once available + def head_content_helper?: (untyped code) -> untyped + def include_debug_disable_comment?: (untyped code) -> untyped end end diff --git a/templates/lib/herb/action_view/helper_registry.rb.erb b/templates/lib/herb/action_view/helper_registry.rb.erb index 136eccff5..2b5726df5 100644 --- a/templates/lib/herb/action_view/helper_registry.rb.erb +++ b/templates/lib/herb/action_view/helper_registry.rb.erb @@ -101,6 +101,7 @@ module Herb attr_reader :gem #: String attr_reader :output #: Symbol attr_reader :visibility #: String + attr_reader :context #: String? attr_reader :tag_name #: String? attr_reader :detect_style #: Symbol attr_reader :description #: String @@ -113,9 +114,9 @@ module Herb attr_reader :special_behaviors #: Array[Symbol] attr_reader :aliases #: Array[String] - #: (name: String, type: Symbol, source: String, gem: String, output: Symbol, visibility: String, tag_name: String?, is_void: bool, supports_block: bool, preferred_for_tag: bool, supported: bool, detect_style: Symbol, description: String, signature: String, documentation_url: String, implicit_attribute: HelperImplicitAttribute?, arguments: Array[HelperArgument], options: Array[HelperOption], block_arguments: Array[HelperBlockArgument], special_behaviors: Array[Symbol], aliases: Array[String]) -> void + #: (name: String, type: Symbol, source: String, gem: String, output: Symbol, visibility: String, context: String?, tag_name: String?, is_void: bool, supports_block: bool, preferred_for_tag: bool, supported: bool, detect_style: Symbol, description: String, signature: String, documentation_url: String, implicit_attribute: HelperImplicitAttribute?, arguments: Array[HelperArgument], options: Array[HelperOption], block_arguments: Array[HelperBlockArgument], special_behaviors: Array[Symbol], aliases: Array[String]) -> void def initialize( # rubocop:disable Metrics/ParameterLists - name:, type:, source:, gem:, output:, visibility:, tag_name:, is_void:, supports_block:, + name:, type:, source:, gem:, output:, visibility:, context:, tag_name:, is_void:, supports_block:, preferred_for_tag:, supported:, detect_style:, description:, signature:, documentation_url:, implicit_attribute:, arguments:, options:, block_arguments:, special_behaviors:, aliases: ) @@ -125,6 +126,7 @@ module Herb @gem = gem @output = output @visibility = visibility + @context = context @tag_name = tag_name @is_void = is_void @supports_block = supports_block @@ -176,6 +178,7 @@ module Herb gem: "<%= helper.gem %>", output: :<%= helper.output %>, visibility: "<%= helper.visibility %>", + context: <%= helper.context ? "\"#{helper.context}\"" : "nil" %>, tag_name: <%= helper.tag_name ? "\"#{helper.tag_name}\"" : "nil" %>, is_void: <%= helper.void? %>, supports_block: <%= helper.supports_block %>, @@ -239,6 +242,14 @@ module Herb <%- end -%> }.freeze #: Hash[String, Array[HelperEntry]] + <%- helpers_by_context = helpers.select(&:context).group_by(&:context) -%> + + BY_CONTEXT = { + <%- helpers_by_context.each do |context, helpers| -%> + "<%= context %>" => [<%= helpers.map(&:constant_name).join(", ") %>].freeze, + <%- end -%> + }.freeze #: Hash[String, Array[HelperEntry]] + class << self #: (String) -> HelperEntry? def get(name) @@ -294,6 +305,11 @@ module Herb entries.select(&:supported?) end + #: (String) -> Array[HelperEntry] + def by_context(context) + BY_CONTEXT[context] || [] + end + #: (String) -> Array[HelperEntry] def by_gem(gem_name) entries.select { |entry| entry.gem == gem_name } diff --git a/templates/template.rb b/templates/template.rb index 37fe1ec96..88d1ca59c 100755 --- a/templates/template.rb +++ b/templates/template.rb @@ -670,7 +670,7 @@ def receiver_call_detect? end class HelperType - attr_reader :name, :source, :gem, :output, :visibility, :supports_block, + attr_reader :name, :source, :gem, :output, :visibility, :context, :supports_block, :supported, :description, :signature, :documentation_url, :tag, :content, :attributes_arg, :attributes_arg_with_block, :transform_style, :custom_transform, @@ -684,6 +684,7 @@ def initialize(config) @visibility = config.fetch("visibility", "public") @supports_block = config.fetch("supports_block", false) @supported = config.fetch("supported", false) + @context = config.fetch("context", nil) @description = config.fetch("description", "").strip @signature = config.fetch("signature") @documentation_url = config.fetch("documentation_url") diff --git a/test/engine/debug_mode_test.rb b/test/engine/debug_mode_test.rb index 4aa8bfab5..1cac3d170 100644 --- a/test/engine/debug_mode_test.rb +++ b/test/engine/debug_mode_test.rb @@ -616,5 +616,68 @@ class DebugModeTest < Minitest::Spec