File tree Expand file tree Collapse file tree 2 files changed +50
-0
lines changed Expand file tree Collapse file tree 2 files changed +50
-0
lines changed Original file line number Diff line number Diff line change 66
77module Phlex
88 Loader = Zeitwerk ::Loader . for_gem . tap do |loader |
9+ loader . ignore ( "#{ __dir__ } /ruby_lsp" )
10+
911 loader . inflector . inflect (
1012 "csv" => "CSV" ,
1113 "fifo" => "FIFO" ,
Original file line number Diff line number Diff line change 1+ # frozen_string_literal: true
2+
3+ require "ruby_lsp/addon"
4+
5+ module RubyLsp
6+ module Phlex
7+ class Addon < ::RubyLsp ::Addon
8+ def activate ( global_state , message_queue )
9+ end
10+
11+ def deactivate
12+ end
13+
14+ def name
15+ "Phlex"
16+ end
17+
18+ def version
19+ "0.1.0"
20+ end
21+ end
22+
23+ class IndexingEnhancement < RubyIndexer ::Enhancement
24+ def on_call_node_enter ( node )
25+ name = node . name
26+ owner = @listener . current_owner
27+ location = node . location
28+ arguments = node . arguments &.arguments
29+
30+ return unless owner
31+ return unless :register_element == name
32+
33+ case arguments
34+ in [ Prism ::SymbolNode [ unescaped : String => method_name ] , *]
35+ tag_name = method_name . tr ( "_" , "-" )
36+ arguments [ 1 ] in Prism ::StringNode [ unescaped : String => tag_name ]
37+
38+ @listener . add_method ( method_name , location , [
39+ RubyIndexer ::Entry ::Signature . new ( [
40+ RubyIndexer ::Entry ::KeywordRestParameter . new ( name : :attributes ) ,
41+ RubyIndexer ::Entry ::BlockParameter . new ( name : :content ) ,
42+ ] ) ,
43+ ] , visibility : :public , comments : "Outputs a `<#{ tag_name } >` tag." )
44+ end
45+ end
46+ end
47+ end
48+ end
You can’t perform that action at this time.
0 commit comments