Class: RubyLsp::Ree::ReeIndexingEnhancement
- Inherits:
-
RubyIndexer::Enhancement
- Object
- RubyIndexer::Enhancement
- RubyLsp::Ree::ReeIndexingEnhancement
- Includes:
- ReeLspUtils
- Defined in:
- lib/ruby_lsp/ruby_lsp_ree/ree_indexing_enhancement.rb
Constant Summary collapse
- REE_INDEXED_OBJECTS =
[:fn, :enum, :action, :dao, :bean, :mapper, :aggregate, :async_bean]
- SCHEMA_NODE_NAME =
:schema
Constants included from ReeLspUtils
RubyLsp::Ree::ReeLspUtils::Entry
Instance Method Summary collapse
Methods included from ReeLspUtils
#camelize, #find_local_file_path, #get_range_for_fn_insert, #get_ree_type, #get_uri_path, #package_name_from_spec_uri, #package_name_from_uri, #package_path_from_uri, #parameter_name, #path_from_package_folder, #signature_params_from_node, #spec_relative_file_path_from_uri, #underscore
Instance Method Details
#on_call_node_enter(node) ⇒ Object
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 |
# File 'lib/ruby_lsp/ruby_lsp_ree/ree_indexing_enhancement.rb', line 12 def on_call_node_enter(node) return unless @listener.current_owner # remove for now as it breaks go-to-definition for entities # if node.name == SCHEMA_NODE_NAME # return index_ree_schema(node) # end return unless REE_INDEXED_OBJECTS.include?(node.name) return unless node.arguments return unless node.arguments.child_nodes.first.is_a?(Prism::SymbolNode) obj_name = node.arguments.child_nodes.first.unescaped return unless current_filename == obj_name source = @listener.instance_variable_get(:@source_lines).join ast = Prism.parse(source).value # TODO use doc builder location = node.location signatures = parse_signatures(obj_name, ast) documentation = parse_documentation(obj_name, ast) comments = "ree_object\ntype: :#{node.name}\n#{documentation}" @listener.add_method( obj_name, location, signatures, comments: comments ) end |