rucoa 0.11.0 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +12 -3
- data/Gemfile.lock +3 -3
- data/README.md +6 -1
- data/images/document-highlight.gif +0 -0
- data/lib/rucoa/configuration.rb +22 -12
- data/lib/rucoa/definition_store.rb +131 -131
- data/lib/rucoa/definitions/method_definition.rb +11 -11
- data/lib/rucoa/handler_concerns/configuration_requestable.rb +7 -7
- data/lib/rucoa/handler_concerns/diagnostics_publishable.rb +11 -11
- data/lib/rucoa/handler_concerns/text_document_position_parameters.rb +29 -0
- data/lib/rucoa/handler_concerns/text_document_uri_parameters.rb +21 -0
- data/lib/rucoa/handler_concerns.rb +2 -0
- data/lib/rucoa/handlers/base.rb +9 -9
- data/lib/rucoa/handlers/initialize_handler.rb +1 -0
- data/lib/rucoa/handlers/initialized_handler.rb +16 -16
- data/lib/rucoa/handlers/text_document_code_action_handler.rb +12 -12
- data/lib/rucoa/handlers/text_document_completion_handler.rb +85 -99
- data/lib/rucoa/handlers/text_document_definition_handler.rb +11 -30
- data/lib/rucoa/handlers/text_document_did_close_handler.rb +2 -8
- data/lib/rucoa/handlers/text_document_did_open_handler.rb +3 -7
- data/lib/rucoa/handlers/text_document_document_highlight_handler.rb +531 -0
- data/lib/rucoa/handlers/text_document_document_symbol_handler.rb +47 -76
- data/lib/rucoa/handlers/text_document_formatting_handler.rb +16 -24
- data/lib/rucoa/handlers/text_document_hover_handler.rb +24 -43
- data/lib/rucoa/handlers/text_document_range_formatting_handler.rb +17 -25
- data/lib/rucoa/handlers/text_document_selection_range_handler.rb +11 -19
- data/lib/rucoa/handlers/text_document_signature_help_handler.rb +17 -36
- data/lib/rucoa/handlers.rb +1 -0
- data/lib/rucoa/node_concerns/body.rb +1 -1
- data/lib/rucoa/node_concerns/modifier.rb +35 -0
- data/lib/rucoa/node_concerns/qualified_name.rb +5 -5
- data/lib/rucoa/node_concerns/rescue.rb +21 -0
- data/lib/rucoa/node_concerns/variable.rb +26 -0
- data/lib/rucoa/node_concerns.rb +3 -0
- data/lib/rucoa/node_inspector.rb +5 -5
- data/lib/rucoa/nodes/arg_node.rb +26 -0
- data/lib/rucoa/nodes/args_node.rb +14 -0
- data/lib/rucoa/nodes/base.rb +111 -47
- data/lib/rucoa/nodes/begin_node.rb +2 -0
- data/lib/rucoa/nodes/block_node.rb +38 -0
- data/lib/rucoa/nodes/case_node.rb +24 -0
- data/lib/rucoa/nodes/const_node.rb +26 -26
- data/lib/rucoa/nodes/cvar_node.rb +9 -0
- data/lib/rucoa/nodes/cvasgn_node.rb +9 -0
- data/lib/rucoa/nodes/def_node.rb +28 -13
- data/lib/rucoa/nodes/ensure_node.rb +19 -0
- data/lib/rucoa/nodes/for_node.rb +8 -0
- data/lib/rucoa/nodes/gvar_node.rb +9 -0
- data/lib/rucoa/nodes/gvasgn_node.rb +9 -0
- data/lib/rucoa/nodes/if_node.rb +34 -0
- data/lib/rucoa/nodes/ivar_node.rb +9 -0
- data/lib/rucoa/nodes/ivasgn_node.rb +9 -0
- data/lib/rucoa/nodes/lvar_node.rb +1 -18
- data/lib/rucoa/nodes/lvasgn_node.rb +9 -0
- data/lib/rucoa/nodes/resbody_node.rb +8 -0
- data/lib/rucoa/nodes/rescue_node.rb +17 -0
- data/lib/rucoa/nodes/send_node.rb +40 -0
- data/lib/rucoa/nodes/until_node.rb +9 -0
- data/lib/rucoa/nodes/when_node.rb +8 -0
- data/lib/rucoa/nodes/while_node.rb +9 -0
- data/lib/rucoa/nodes.rb +19 -1
- data/lib/rucoa/parser_builder.rb +26 -2
- data/lib/rucoa/range.rb +9 -3
- data/lib/rucoa/rbs/constant_definition_mapper.rb +5 -5
- data/lib/rucoa/rbs/method_definition_mapper.rb +18 -18
- data/lib/rucoa/rbs/module_definition_mapper.rb +13 -13
- data/lib/rucoa/rbs/ruby_definitions_loader.rb +5 -5
- data/lib/rucoa/rubocop/configuration_checker.rb +7 -7
- data/lib/rucoa/server.rb +24 -23
- data/lib/rucoa/source.rb +6 -6
- data/lib/rucoa/source_store.rb +8 -8
- data/lib/rucoa/version.rb +1 -1
- data/lib/rucoa/yard/definition_generators/method_definition_generator.rb +1 -1
- data/lib/rucoa/yard/definitions_loader.rb +1 -1
- data/rucoa.gemspec +0 -1
- metadata +28 -4
- data/lib/rucoa/nodes/defs_node.rb +0 -33
data/lib/rucoa/nodes.rb
CHANGED
@@ -2,19 +2,37 @@
|
|
2
2
|
|
3
3
|
module Rucoa
|
4
4
|
module Nodes
|
5
|
+
autoload :ArgNode, 'rucoa/nodes/arg_node'
|
6
|
+
autoload :ArgsNode, 'rucoa/nodes/args_node'
|
5
7
|
autoload :Base, 'rucoa/nodes/base'
|
6
8
|
autoload :BeginNode, 'rucoa/nodes/begin_node'
|
9
|
+
autoload :BlockNode, 'rucoa/nodes/block_node'
|
10
|
+
autoload :CaseNode, 'rucoa/nodes/case_node'
|
7
11
|
autoload :CasgnNode, 'rucoa/nodes/casgn_node'
|
8
12
|
autoload :CbaseNode, 'rucoa/nodes/cbase_node'
|
9
13
|
autoload :ClassNode, 'rucoa/nodes/class_node'
|
10
14
|
autoload :ConstNode, 'rucoa/nodes/const_node'
|
15
|
+
autoload :CvarNode, 'rucoa/nodes/cvar_node'
|
16
|
+
autoload :CvasgnNode, 'rucoa/nodes/cvasgn_node'
|
11
17
|
autoload :DefNode, 'rucoa/nodes/def_node'
|
12
|
-
autoload :
|
18
|
+
autoload :EnsureNode, 'rucoa/nodes/ensure_node'
|
19
|
+
autoload :ForNode, 'rucoa/nodes/for_node'
|
20
|
+
autoload :GvarNode, 'rucoa/nodes/gvar_node'
|
21
|
+
autoload :GvasgnNode, 'rucoa/nodes/gvasgn_node'
|
22
|
+
autoload :IfNode, 'rucoa/nodes/if_node'
|
23
|
+
autoload :IvarNode, 'rucoa/nodes/ivar_node'
|
24
|
+
autoload :IvasgnNode, 'rucoa/nodes/ivasgn_node'
|
13
25
|
autoload :LvarNode, 'rucoa/nodes/lvar_node'
|
26
|
+
autoload :LvasgnNode, 'rucoa/nodes/lvasgn_node'
|
14
27
|
autoload :ModuleNode, 'rucoa/nodes/module_node'
|
28
|
+
autoload :ResbodyNode, 'rucoa/nodes/resbody_node'
|
29
|
+
autoload :RescueNode, 'rucoa/nodes/rescue_node'
|
15
30
|
autoload :SclassNode, 'rucoa/nodes/sclass_node'
|
16
31
|
autoload :SendNode, 'rucoa/nodes/send_node'
|
17
32
|
autoload :StrNode, 'rucoa/nodes/str_node'
|
18
33
|
autoload :SymNode, 'rucoa/nodes/sym_node'
|
34
|
+
autoload :UntilNode, 'rucoa/nodes/until_node'
|
35
|
+
autoload :WhenNode, 'rucoa/nodes/when_node'
|
36
|
+
autoload :WhileNode, 'rucoa/nodes/while_node'
|
19
37
|
end
|
20
38
|
end
|
data/lib/rucoa/parser_builder.rb
CHANGED
@@ -5,19 +5,43 @@ require 'parser/current'
|
|
5
5
|
module Rucoa
|
6
6
|
class ParserBuilder < ::Parser::Builders::Default
|
7
7
|
NODE_CLASS_BY_TYPE = {
|
8
|
+
arg: Nodes::ArgNode,
|
9
|
+
args: Nodes::ArgsNode,
|
8
10
|
begin: Nodes::BeginNode,
|
11
|
+
block: Nodes::BlockNode,
|
12
|
+
case: Nodes::CaseNode,
|
9
13
|
casgn: Nodes::CasgnNode,
|
10
14
|
cbase: Nodes::CbaseNode,
|
11
15
|
class: Nodes::ClassNode,
|
12
16
|
const: Nodes::ConstNode,
|
17
|
+
csend: Nodes::SendNode,
|
18
|
+
cvar: Nodes::CvarNode,
|
19
|
+
cvasgn: Nodes::CvasgnNode,
|
13
20
|
def: Nodes::DefNode,
|
14
|
-
defs: Nodes::
|
21
|
+
defs: Nodes::DefNode,
|
22
|
+
ensure: Nodes::EnsureNode,
|
23
|
+
for: Nodes::ForNode,
|
24
|
+
gvar: Nodes::GvarNode,
|
25
|
+
gvasgn: Nodes::GvasgnNode,
|
26
|
+
if: Nodes::IfNode,
|
27
|
+
ivar: Nodes::IvarNode,
|
28
|
+
ivasgn: Nodes::IvasgnNode,
|
29
|
+
kwarg: Nodes::ArgNode,
|
30
|
+
kwbegin: Nodes::BeginNode,
|
15
31
|
lvar: Nodes::LvarNode,
|
32
|
+
lvasgn: Nodes::LvasgnNode,
|
16
33
|
module: Nodes::ModuleNode,
|
34
|
+
resbody: Nodes::ResbodyNode,
|
35
|
+
rescue: Nodes::RescueNode,
|
17
36
|
sclass: Nodes::SclassNode,
|
18
37
|
send: Nodes::SendNode,
|
19
38
|
str: Nodes::StrNode,
|
20
|
-
|
39
|
+
super: Nodes::SendNode,
|
40
|
+
sym: Nodes::SymNode,
|
41
|
+
until: Nodes::UntilNode,
|
42
|
+
when: Nodes::WhenNode,
|
43
|
+
while: Nodes::WhileNode,
|
44
|
+
zsuper: Nodes::SendNode
|
21
45
|
}.freeze
|
22
46
|
|
23
47
|
class << self
|
data/lib/rucoa/range.rb
CHANGED
@@ -103,6 +103,12 @@ module Rucoa
|
|
103
103
|
# )
|
104
104
|
# expect(range).to include(
|
105
105
|
# Rucoa::Position.new(
|
106
|
+
# column: 1,
|
107
|
+
# line: 1
|
108
|
+
# )
|
109
|
+
# )
|
110
|
+
# expect(range).to include(
|
111
|
+
# Rucoa::Position.new(
|
106
112
|
# column: 0,
|
107
113
|
# line: 2
|
108
114
|
# )
|
@@ -116,9 +122,9 @@ module Rucoa
|
|
116
122
|
def include?(position)
|
117
123
|
return false if position.line > @ending.line
|
118
124
|
return false if position.line < @beginning.line
|
119
|
-
return false if position.column < @beginning.column
|
120
|
-
return false if position.column > @ending.column
|
121
|
-
return false if position.column == @ending.column && !@including_ending
|
125
|
+
return false if position.line == @beginning.line && position.column < @beginning.column
|
126
|
+
return false if position.line == @ending.line && position.column > @ending.column
|
127
|
+
return false if position.line == @ending.line && position.column == @ending.column && !@including_ending
|
122
128
|
|
123
129
|
true
|
124
130
|
end
|
@@ -32,15 +32,15 @@ module Rucoa
|
|
32
32
|
@declaration.comment&.string&.sub(/\A\s*<!--.*-->\s*/m, '')
|
33
33
|
end
|
34
34
|
|
35
|
-
# @return [String]
|
36
|
-
def qualified_name
|
37
|
-
@declaration.name.to_s.delete_prefix('::')
|
38
|
-
end
|
39
|
-
|
40
35
|
# @return [Rucoa::Location]
|
41
36
|
def location
|
42
37
|
Location.from_rbs_location(@declaration.location)
|
43
38
|
end
|
39
|
+
|
40
|
+
# @return [String]
|
41
|
+
def qualified_name
|
42
|
+
@declaration.name.to_s.delete_prefix('::')
|
43
|
+
end
|
44
44
|
end
|
45
45
|
end
|
46
46
|
end
|
@@ -42,23 +42,19 @@ module Rucoa
|
|
42
42
|
|
43
43
|
private
|
44
44
|
|
45
|
-
# @return [Array<Rucoa::Types::MethodType>]
|
46
|
-
def types
|
47
|
-
@method_definition.types.map do |method_type|
|
48
|
-
MethodTypeMapper.call(
|
49
|
-
method_type: method_type
|
50
|
-
)
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
45
|
# @return [String, nil]
|
55
46
|
def description
|
56
47
|
@method_definition.comment&.string&.sub(/\A\s*<!--.*-->\s*/m, '')
|
57
48
|
end
|
58
49
|
|
59
|
-
# @return [
|
60
|
-
def
|
61
|
-
@
|
50
|
+
# @return [Symbol]
|
51
|
+
def kind
|
52
|
+
@method_definition.kind
|
53
|
+
end
|
54
|
+
|
55
|
+
# @return [Rucoa::Location]
|
56
|
+
def location
|
57
|
+
Location.from_rbs_location(@method_definition.location)
|
62
58
|
end
|
63
59
|
|
64
60
|
# @return [String]
|
@@ -66,14 +62,18 @@ module Rucoa
|
|
66
62
|
@method_definition.name.to_s
|
67
63
|
end
|
68
64
|
|
69
|
-
# @return [
|
70
|
-
def
|
71
|
-
@
|
65
|
+
# @return [String]
|
66
|
+
def namespace
|
67
|
+
@declaration.name.to_s.delete_prefix('::')
|
72
68
|
end
|
73
69
|
|
74
|
-
# @return [Rucoa::
|
75
|
-
def
|
76
|
-
|
70
|
+
# @return [Array<Rucoa::Types::MethodType>]
|
71
|
+
def types
|
72
|
+
@method_definition.types.map do |method_type|
|
73
|
+
MethodTypeMapper.call(
|
74
|
+
method_type: method_type
|
75
|
+
)
|
76
|
+
end
|
77
77
|
end
|
78
78
|
|
79
79
|
class MethodTypeMapper
|
@@ -35,16 +35,6 @@ module Rucoa
|
|
35
35
|
@declaration.comment&.string&.sub(/\A\s*<!--.*-->\s*/m, '')
|
36
36
|
end
|
37
37
|
|
38
|
-
# @return [String]
|
39
|
-
def qualified_name
|
40
|
-
@declaration.name.to_s.delete_prefix('::')
|
41
|
-
end
|
42
|
-
|
43
|
-
# @return [Rucoa::Location]
|
44
|
-
def location
|
45
|
-
Location.from_rbs_location(@declaration.location)
|
46
|
-
end
|
47
|
-
|
48
38
|
# @return [Array<String>]
|
49
39
|
def extended_module_qualified_names
|
50
40
|
module_qualified_names_for(::RBS::AST::Members::Extend)
|
@@ -55,9 +45,9 @@ module Rucoa
|
|
55
45
|
module_qualified_names_for(::RBS::AST::Members::Include)
|
56
46
|
end
|
57
47
|
|
58
|
-
# @return [
|
59
|
-
def
|
60
|
-
|
48
|
+
# @return [Rucoa::Location]
|
49
|
+
def location
|
50
|
+
Location.from_rbs_location(@declaration.location)
|
61
51
|
end
|
62
52
|
|
63
53
|
def module_qualified_names_for(member_class)
|
@@ -68,6 +58,16 @@ module Rucoa
|
|
68
58
|
end
|
69
59
|
end
|
70
60
|
end
|
61
|
+
|
62
|
+
# @return [Array<String>]
|
63
|
+
def prepended_module_qualified_names
|
64
|
+
module_qualified_names_for(::RBS::AST::Members::Prepend)
|
65
|
+
end
|
66
|
+
|
67
|
+
# @return [String]
|
68
|
+
def qualified_name
|
69
|
+
@declaration.name.to_s.delete_prefix('::')
|
70
|
+
end
|
71
71
|
end
|
72
72
|
end
|
73
73
|
end
|
@@ -43,11 +43,6 @@ module Rucoa
|
|
43
43
|
|
44
44
|
private
|
45
45
|
|
46
|
-
# @return [Array<RBS::AST::Declarations::Base>]
|
47
|
-
def declarations
|
48
|
-
class_declarations + constant_declarations
|
49
|
-
end
|
50
|
-
|
51
46
|
# @return [Array<RBS::AST::Declarations::Class>]
|
52
47
|
def class_declarations
|
53
48
|
environment.class_decls.values.flat_map do |multi_entry|
|
@@ -60,6 +55,11 @@ module Rucoa
|
|
60
55
|
environment.constant_decls.values.map(&:decl)
|
61
56
|
end
|
62
57
|
|
58
|
+
# @return [Array<RBS::AST::Declarations::Base>]
|
59
|
+
def declarations
|
60
|
+
class_declarations + constant_declarations
|
61
|
+
end
|
62
|
+
|
63
63
|
# @return [RBS::Environment]
|
64
64
|
def environment
|
65
65
|
@environment ||= ::RBS::Environment.from_loader(
|
@@ -19,13 +19,6 @@ module Rucoa
|
|
19
19
|
|
20
20
|
private
|
21
21
|
|
22
|
-
# @return [Boolean]
|
23
|
-
def rubocop_configured_for_current_directory?
|
24
|
-
each_current_and_ancestor_pathname.any? do |pathname|
|
25
|
-
pathname.join('.rubocop.yml').exist?
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
22
|
# @return [Enumerable<Pathname>]
|
30
23
|
def each_current_and_ancestor_pathname
|
31
24
|
return to_enum(__method__) unless block_given?
|
@@ -39,6 +32,13 @@ module Rucoa
|
|
39
32
|
end
|
40
33
|
self
|
41
34
|
end
|
35
|
+
|
36
|
+
# @return [Boolean]
|
37
|
+
def rubocop_configured_for_current_directory?
|
38
|
+
each_current_and_ancestor_pathname.any? do |pathname|
|
39
|
+
pathname.join('.rubocop.yml').exist?
|
40
|
+
end
|
41
|
+
end
|
42
42
|
end
|
43
43
|
end
|
44
44
|
end
|
data/lib/rucoa/server.rb
CHANGED
@@ -17,6 +17,7 @@ module Rucoa
|
|
17
17
|
'textDocument/didChange' => Handlers::TextDocumentDidChangeHandler,
|
18
18
|
'textDocument/didClose' => Handlers::TextDocumentDidCloseHandler,
|
19
19
|
'textDocument/didOpen' => Handlers::TextDocumentDidOpenHandler,
|
20
|
+
'textDocument/documentHighlight' => Handlers::TextDocumentDocumentHighlightHandler,
|
20
21
|
'textDocument/documentSymbol' => Handlers::TextDocumentDocumentSymbolHandler,
|
21
22
|
'textDocument/formatting' => Handlers::TextDocumentFormattingHandler,
|
22
23
|
'textDocument/hover' => Handlers::TextDocumentHoverHandler,
|
@@ -62,6 +63,19 @@ module Rucoa
|
|
62
63
|
@definition_store.bulk_add(DefinitionArchiver.load)
|
63
64
|
end
|
64
65
|
|
66
|
+
# @return [void]
|
67
|
+
def finish
|
68
|
+
exit(0)
|
69
|
+
end
|
70
|
+
|
71
|
+
# @note This method is for testing.
|
72
|
+
# @return [Array<Hash>]
|
73
|
+
def responses
|
74
|
+
io = @writer.io
|
75
|
+
io.rewind
|
76
|
+
MessageReader.new(io).read.to_a
|
77
|
+
end
|
78
|
+
|
65
79
|
# @return [void]
|
66
80
|
def start
|
67
81
|
@reader.read do |message|
|
@@ -75,11 +89,6 @@ module Rucoa
|
|
75
89
|
end
|
76
90
|
end
|
77
91
|
|
78
|
-
# @return [void]
|
79
|
-
def finish
|
80
|
-
exit(0)
|
81
|
-
end
|
82
|
-
|
83
92
|
# @yieldparam response [Hash]
|
84
93
|
# @param message [Hash]
|
85
94
|
# @return [void]
|
@@ -94,15 +103,18 @@ module Rucoa
|
|
94
103
|
end
|
95
104
|
end
|
96
105
|
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
MessageReader.new(io).read.to_a
|
106
|
+
private
|
107
|
+
|
108
|
+
# @yieldparam log [String]
|
109
|
+
def debug(&block)
|
110
|
+
@logger.debug(&block) if configuration.enables_debug?
|
103
111
|
end
|
104
112
|
|
105
|
-
|
113
|
+
# @param request_method [String]
|
114
|
+
# @return [Class, nil]
|
115
|
+
def find_client_request_handler(request_method)
|
116
|
+
METHOD_TO_HANDLER_MAP[request_method]
|
117
|
+
end
|
106
118
|
|
107
119
|
# @param request [Hash]
|
108
120
|
# @return [void]
|
@@ -114,11 +126,6 @@ module Rucoa
|
|
114
126
|
end
|
115
127
|
end
|
116
128
|
|
117
|
-
# @yieldparam log [String]
|
118
|
-
def debug(&block)
|
119
|
-
@logger.debug(&block) if configuration.enables_debug?
|
120
|
-
end
|
121
|
-
|
122
129
|
# @param request [Hash]
|
123
130
|
# @return [void]
|
124
131
|
def handle_client_request(request)
|
@@ -134,12 +141,6 @@ module Rucoa
|
|
134
141
|
@client_response_handlers.delete(response['id'])&.call(response)
|
135
142
|
end
|
136
143
|
|
137
|
-
# @param request_method [String]
|
138
|
-
# @return [Class, nil]
|
139
|
-
def find_client_request_handler(request_method)
|
140
|
-
METHOD_TO_HANDLER_MAP[request_method]
|
141
|
-
end
|
142
|
-
|
143
144
|
# @param message [Hash]
|
144
145
|
# @return [void]
|
145
146
|
def write_server_request(
|
data/lib/rucoa/source.rb
CHANGED
@@ -62,6 +62,11 @@ module Rucoa
|
|
62
62
|
end
|
63
63
|
end
|
64
64
|
|
65
|
+
# @return [Boolean]
|
66
|
+
def failed_to_parse?
|
67
|
+
parse_result.failed?
|
68
|
+
end
|
69
|
+
|
65
70
|
# @return [String, nil]
|
66
71
|
# @example returns path for file URI
|
67
72
|
# source = Rucoa::Source.new(
|
@@ -96,11 +101,6 @@ module Rucoa
|
|
96
101
|
parse_result.root_node
|
97
102
|
end
|
98
103
|
|
99
|
-
# @return [Boolean]
|
100
|
-
def failed_to_parse?
|
101
|
-
parse_result.failed?
|
102
|
-
end
|
103
|
-
|
104
104
|
# @return [Boolean]
|
105
105
|
def untitled?
|
106
106
|
uri_object.scheme == 'untitled'
|
@@ -122,7 +122,7 @@ module Rucoa
|
|
122
122
|
def root_and_descendant_nodes
|
123
123
|
return [] unless root_node
|
124
124
|
|
125
|
-
[root_node, *root_node.
|
125
|
+
[root_node, *root_node.descendant_nodes]
|
126
126
|
end
|
127
127
|
|
128
128
|
# @return [URI]
|
data/lib/rucoa/source_store.rb
CHANGED
@@ -6,10 +6,10 @@ module Rucoa
|
|
6
6
|
@data = {}
|
7
7
|
end
|
8
8
|
|
9
|
-
# @
|
10
|
-
# @return [
|
11
|
-
def
|
12
|
-
@data
|
9
|
+
# @yieldparam uri [String]
|
10
|
+
# @return [Enumerable<String>]
|
11
|
+
def each_uri(&block)
|
12
|
+
@data.each_key(&block)
|
13
13
|
end
|
14
14
|
|
15
15
|
# @param uri [String]
|
@@ -18,10 +18,10 @@ module Rucoa
|
|
18
18
|
@data[uri]
|
19
19
|
end
|
20
20
|
|
21
|
-
# @
|
22
|
-
# @return [
|
23
|
-
def
|
24
|
-
@data.
|
21
|
+
# @param source [Rucoa::Source]
|
22
|
+
# @return [void]
|
23
|
+
def update(source)
|
24
|
+
@data[source.uri] = source
|
25
25
|
end
|
26
26
|
end
|
27
27
|
end
|
data/lib/rucoa/version.rb
CHANGED
@@ -36,7 +36,7 @@ module Rucoa
|
|
36
36
|
# ).definitions
|
37
37
|
# expect(definitions[1].qualified_name).to eq('Foo.bar')
|
38
38
|
def call
|
39
|
-
return [] unless @node.is_a?(Nodes::DefNode)
|
39
|
+
return [] unless @node.is_a?(Nodes::DefNode)
|
40
40
|
|
41
41
|
[
|
42
42
|
Definitions::MethodDefinition.new(
|
data/rucoa.gemspec
CHANGED
@@ -16,7 +16,6 @@ Gem::Specification.new do |spec|
|
|
16
16
|
spec.metadata['homepage_uri'] = spec.homepage
|
17
17
|
spec.metadata['source_code_uri'] = spec.homepage
|
18
18
|
spec.metadata['changelog_uri'] = "#{spec.homepage}/releases"
|
19
|
-
spec.metadata['rubygems_mfa_required'] = 'true'
|
20
19
|
|
21
20
|
spec.files = Dir.chdir(__dir__) do
|
22
21
|
`git ls-files -z`.split("\x0").reject do |f|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rucoa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.13.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryo Nakamura
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-10-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: parser
|
@@ -86,6 +86,7 @@ files:
|
|
86
86
|
- exe/rucoa
|
87
87
|
- images/diagnostics.gif
|
88
88
|
- images/document-formatting.gif
|
89
|
+
- images/document-highlight.gif
|
89
90
|
- images/document-symbol.gif
|
90
91
|
- images/selection-ranges.gif
|
91
92
|
- lib/rucoa.rb
|
@@ -104,6 +105,8 @@ files:
|
|
104
105
|
- lib/rucoa/handler_concerns.rb
|
105
106
|
- lib/rucoa/handler_concerns/configuration_requestable.rb
|
106
107
|
- lib/rucoa/handler_concerns/diagnostics_publishable.rb
|
108
|
+
- lib/rucoa/handler_concerns/text_document_position_parameters.rb
|
109
|
+
- lib/rucoa/handler_concerns/text_document_uri_parameters.rb
|
107
110
|
- lib/rucoa/handlers.rb
|
108
111
|
- lib/rucoa/handlers/base.rb
|
109
112
|
- lib/rucoa/handlers/exit_handler.rb
|
@@ -116,6 +119,7 @@ files:
|
|
116
119
|
- lib/rucoa/handlers/text_document_did_change_handler.rb
|
117
120
|
- lib/rucoa/handlers/text_document_did_close_handler.rb
|
118
121
|
- lib/rucoa/handlers/text_document_did_open_handler.rb
|
122
|
+
- lib/rucoa/handlers/text_document_document_highlight_handler.rb
|
119
123
|
- lib/rucoa/handlers/text_document_document_symbol_handler.rb
|
120
124
|
- lib/rucoa/handlers/text_document_formatting_handler.rb
|
121
125
|
- lib/rucoa/handlers/text_document_hover_handler.rb
|
@@ -128,23 +132,44 @@ files:
|
|
128
132
|
- lib/rucoa/message_writer.rb
|
129
133
|
- lib/rucoa/node_concerns.rb
|
130
134
|
- lib/rucoa/node_concerns/body.rb
|
135
|
+
- lib/rucoa/node_concerns/modifier.rb
|
131
136
|
- lib/rucoa/node_concerns/qualified_name.rb
|
137
|
+
- lib/rucoa/node_concerns/rescue.rb
|
138
|
+
- lib/rucoa/node_concerns/variable.rb
|
132
139
|
- lib/rucoa/node_inspector.rb
|
133
140
|
- lib/rucoa/nodes.rb
|
141
|
+
- lib/rucoa/nodes/arg_node.rb
|
142
|
+
- lib/rucoa/nodes/args_node.rb
|
134
143
|
- lib/rucoa/nodes/base.rb
|
135
144
|
- lib/rucoa/nodes/begin_node.rb
|
145
|
+
- lib/rucoa/nodes/block_node.rb
|
146
|
+
- lib/rucoa/nodes/case_node.rb
|
136
147
|
- lib/rucoa/nodes/casgn_node.rb
|
137
148
|
- lib/rucoa/nodes/cbase_node.rb
|
138
149
|
- lib/rucoa/nodes/class_node.rb
|
139
150
|
- lib/rucoa/nodes/const_node.rb
|
151
|
+
- lib/rucoa/nodes/cvar_node.rb
|
152
|
+
- lib/rucoa/nodes/cvasgn_node.rb
|
140
153
|
- lib/rucoa/nodes/def_node.rb
|
141
|
-
- lib/rucoa/nodes/
|
154
|
+
- lib/rucoa/nodes/ensure_node.rb
|
155
|
+
- lib/rucoa/nodes/for_node.rb
|
156
|
+
- lib/rucoa/nodes/gvar_node.rb
|
157
|
+
- lib/rucoa/nodes/gvasgn_node.rb
|
158
|
+
- lib/rucoa/nodes/if_node.rb
|
159
|
+
- lib/rucoa/nodes/ivar_node.rb
|
160
|
+
- lib/rucoa/nodes/ivasgn_node.rb
|
142
161
|
- lib/rucoa/nodes/lvar_node.rb
|
162
|
+
- lib/rucoa/nodes/lvasgn_node.rb
|
143
163
|
- lib/rucoa/nodes/module_node.rb
|
164
|
+
- lib/rucoa/nodes/resbody_node.rb
|
165
|
+
- lib/rucoa/nodes/rescue_node.rb
|
144
166
|
- lib/rucoa/nodes/sclass_node.rb
|
145
167
|
- lib/rucoa/nodes/send_node.rb
|
146
168
|
- lib/rucoa/nodes/str_node.rb
|
147
169
|
- lib/rucoa/nodes/sym_node.rb
|
170
|
+
- lib/rucoa/nodes/until_node.rb
|
171
|
+
- lib/rucoa/nodes/when_node.rb
|
172
|
+
- lib/rucoa/nodes/while_node.rb
|
148
173
|
- lib/rucoa/parse_result.rb
|
149
174
|
- lib/rucoa/parser.rb
|
150
175
|
- lib/rucoa/parser_builder.rb
|
@@ -186,7 +211,6 @@ metadata:
|
|
186
211
|
homepage_uri: https://github.com/r7kamura/rucoa
|
187
212
|
source_code_uri: https://github.com/r7kamura/rucoa
|
188
213
|
changelog_uri: https://github.com/r7kamura/rucoa/releases
|
189
|
-
rubygems_mfa_required: 'true'
|
190
214
|
post_install_message:
|
191
215
|
rdoc_options: []
|
192
216
|
require_paths:
|
@@ -1,33 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Rucoa
|
4
|
-
module Nodes
|
5
|
-
class DefsNode < Base
|
6
|
-
# @return [String]
|
7
|
-
def qualified_name
|
8
|
-
[
|
9
|
-
namespace,
|
10
|
-
method_marker,
|
11
|
-
name
|
12
|
-
].join
|
13
|
-
end
|
14
|
-
|
15
|
-
# @return [String]
|
16
|
-
def name
|
17
|
-
children[1].to_s
|
18
|
-
end
|
19
|
-
|
20
|
-
# @return [Boolean]
|
21
|
-
def singleton?
|
22
|
-
true
|
23
|
-
end
|
24
|
-
|
25
|
-
private
|
26
|
-
|
27
|
-
# @return [String]
|
28
|
-
def method_marker
|
29
|
-
'.'
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|