solargraph 0.25.1 → 0.26.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/solargraph.rb +18 -16
- data/lib/solargraph/api_map.rb +100 -161
- data/lib/solargraph/api_map/source_to_yard.rb +9 -9
- data/lib/solargraph/api_map/store.rb +50 -13
- data/lib/solargraph/basic_type.rb +33 -0
- data/lib/solargraph/basic_type_methods.rb +111 -0
- data/lib/solargraph/complex_type.rb +51 -89
- data/lib/solargraph/core_fills.rb +12 -8
- data/lib/solargraph/diagnostics/type_not_defined.rb +2 -2
- data/lib/solargraph/language_server.rb +3 -0
- data/lib/solargraph/language_server/completion_item_kinds.rb +2 -0
- data/lib/solargraph/language_server/error_codes.rb +2 -0
- data/lib/solargraph/language_server/host.rb +53 -6
- data/lib/solargraph/language_server/message.rb +13 -0
- data/lib/solargraph/language_server/message/text_document/definition.rb +4 -6
- data/lib/solargraph/language_server/message/text_document/document_symbol.rb +2 -1
- data/lib/solargraph/language_server/message/workspace/workspace_symbol.rb +2 -1
- data/lib/solargraph/language_server/message_types.rb +2 -0
- data/lib/solargraph/language_server/request.rb +4 -0
- data/lib/solargraph/language_server/symbol_kinds.rb +28 -26
- data/lib/solargraph/language_server/transport.rb +3 -0
- data/lib/solargraph/language_server/uri_helpers.rb +2 -0
- data/lib/solargraph/library.rb +12 -7
- data/lib/solargraph/pin.rb +1 -1
- data/lib/solargraph/pin/attribute.rb +5 -5
- data/lib/solargraph/pin/base.rb +51 -16
- data/lib/solargraph/pin/base_variable.rb +25 -7
- data/lib/solargraph/pin/block.rb +18 -1
- data/lib/solargraph/pin/block_parameter.rb +42 -5
- data/lib/solargraph/pin/conversions.rb +4 -2
- data/lib/solargraph/pin/method.rb +6 -6
- data/lib/solargraph/pin/method_parameter.rb +6 -6
- data/lib/solargraph/pin/namespace.rb +7 -2
- data/lib/solargraph/pin/proxy_type.rb +39 -0
- data/lib/solargraph/pin/symbol.rb +20 -12
- data/lib/solargraph/pin/yard_pin/method.rb +2 -2
- data/lib/solargraph/source.rb +89 -38
- data/lib/solargraph/source/call_chainer.rb +273 -0
- data/lib/solargraph/source/chain.rb +104 -0
- data/lib/solargraph/source/chain/call.rb +72 -0
- data/lib/solargraph/source/chain/class_variable.rb +11 -0
- data/lib/solargraph/source/chain/constant.rb +17 -0
- data/lib/solargraph/source/chain/definition.rb +16 -0
- data/lib/solargraph/source/chain/global_variable.rb +11 -0
- data/lib/solargraph/source/chain/head.rb +20 -0
- data/lib/solargraph/source/chain/instance_variable.rb +11 -0
- data/lib/solargraph/source/chain/link.rb +33 -0
- data/lib/solargraph/source/chain/literal.rb +21 -0
- data/lib/solargraph/source/chain/variable.rb +11 -0
- data/lib/solargraph/source/change.rb +3 -1
- data/lib/solargraph/{api_map → source}/completion.rb +3 -1
- data/lib/solargraph/source/encoding_fixes.rb +21 -0
- data/lib/solargraph/source/fragment.rb +139 -284
- data/lib/solargraph/source/mapper.rb +27 -16
- data/lib/solargraph/source/node_chainer.rb +94 -0
- data/lib/solargraph/source/node_methods.rb +2 -2
- data/lib/solargraph/source/position.rb +4 -0
- data/lib/solargraph/source/range.rb +10 -2
- data/lib/solargraph/version.rb +1 -1
- data/lib/solargraph/yard_map.rb +13 -2
- metadata +20 -6
- data/lib/solargraph/api_map/probe.rb +0 -251
- data/lib/solargraph/api_map/type_methods.rb +0 -40
- data/lib/solargraph/pin/proxy_method.rb +0 -30
@@ -1,40 +0,0 @@
|
|
1
|
-
module Solargraph
|
2
|
-
class ApiMap
|
3
|
-
# Module functions for processing YARD types.
|
4
|
-
#
|
5
|
-
module TypeMethods
|
6
|
-
module_function
|
7
|
-
|
8
|
-
# Extract a namespace from a type.
|
9
|
-
#
|
10
|
-
# @example
|
11
|
-
# extract_namespace('String') => 'String'
|
12
|
-
# extract_namespace('Class<String>') => 'String'
|
13
|
-
#
|
14
|
-
# @param type [String]
|
15
|
-
# @return [String]
|
16
|
-
def extract_namespace type
|
17
|
-
extract_namespace_and_scope(type)[0]
|
18
|
-
end
|
19
|
-
|
20
|
-
# Extract a namespace and a scope (:instance or :class) from a type.
|
21
|
-
#
|
22
|
-
# @example
|
23
|
-
# extract_namespace('String') #=> ['String', :instance]
|
24
|
-
# extract_namespace('Class<String>') #=> ['String', :class]
|
25
|
-
# extract_namespace('Module<Enumerable') #=> ['Enumberable', :class]
|
26
|
-
#
|
27
|
-
# @param type [String]
|
28
|
-
# @return [Array] The namespace (String) and scope (Symbol).
|
29
|
-
def extract_namespace_and_scope type
|
30
|
-
scope = :instance
|
31
|
-
result = type.to_s.gsub(/<.*$/, '')
|
32
|
-
if (result == 'Class' or result == 'Module') and type.include?('<')
|
33
|
-
result = type.match(/<([a-z0-9:_]*)/i)[1]
|
34
|
-
scope = :class
|
35
|
-
end
|
36
|
-
[result, scope]
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
@@ -1,30 +0,0 @@
|
|
1
|
-
module Solargraph
|
2
|
-
module Pin
|
3
|
-
# ProxyMethod serves as a quick, disposable shortcut for providing context
|
4
|
-
# to type inference methods. ApiMap::Probe can treat it as an anonymous
|
5
|
-
# method while analyzing signatures.
|
6
|
-
#
|
7
|
-
class ProxyMethod < Base
|
8
|
-
def initialize *return_types
|
9
|
-
@return_complex_types = ComplexType.parse(*return_types.reject(&:nil?))
|
10
|
-
end
|
11
|
-
|
12
|
-
# @return [String]
|
13
|
-
def namespace
|
14
|
-
# @namespace ||= ApiMap::TypeMethods.extract_namespace(return_type)
|
15
|
-
return nil if @return_complex_types.empty?
|
16
|
-
@namespace ||= @return_complex_types.first.namespace
|
17
|
-
end
|
18
|
-
|
19
|
-
# @return [Integer]
|
20
|
-
def kind
|
21
|
-
Pin::METHOD
|
22
|
-
end
|
23
|
-
|
24
|
-
# @return [Symbol]
|
25
|
-
def scope
|
26
|
-
:instance
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|