solargraph 0.26.1 → 0.27.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/lib/solargraph.rb +5 -2
- data/lib/solargraph/api_map.rb +236 -234
- data/lib/solargraph/api_map/store.rb +18 -53
- data/lib/solargraph/bundle.rb +22 -0
- data/lib/solargraph/complex_type.rb +9 -5
- data/lib/solargraph/complex_type/type_methods.rb +113 -0
- data/lib/solargraph/complex_type/unique_type.rb +35 -0
- data/lib/solargraph/core_fills.rb +1 -0
- data/lib/solargraph/diagnostics.rb +6 -4
- data/lib/solargraph/diagnostics/base.rb +3 -0
- data/lib/solargraph/diagnostics/require_not_found.rb +2 -1
- data/lib/solargraph/diagnostics/rubocop.rb +21 -6
- data/lib/solargraph/diagnostics/type_not_defined.rb +4 -3
- data/lib/solargraph/diagnostics/update_errors.rb +18 -0
- data/lib/solargraph/language_server/host.rb +90 -222
- data/lib/solargraph/language_server/host/cataloger.rb +68 -0
- data/lib/solargraph/language_server/host/diagnoser.rb +85 -0
- data/lib/solargraph/language_server/message/extended/check_gem_version.rb +35 -24
- data/lib/solargraph/language_server/message/text_document/completion.rb +6 -8
- data/lib/solargraph/language_server/message/text_document/document_symbol.rb +1 -1
- data/lib/solargraph/language_server/message/workspace/did_change_watched_files.rb +0 -1
- data/lib/solargraph/language_server/transport/socket.rb +4 -6
- data/lib/solargraph/language_server/transport/stdio.rb +4 -6
- data/lib/solargraph/library.rb +152 -99
- data/lib/solargraph/live_map.rb +1 -1
- data/lib/solargraph/location.rb +28 -0
- data/lib/solargraph/pin.rb +2 -0
- data/lib/solargraph/pin/attribute.rb +26 -12
- data/lib/solargraph/pin/base.rb +15 -35
- data/lib/solargraph/pin/base_variable.rb +7 -15
- data/lib/solargraph/pin/block.rb +5 -9
- data/lib/solargraph/pin/block_parameter.rb +9 -7
- data/lib/solargraph/pin/conversions.rb +5 -5
- data/lib/solargraph/pin/duck_method.rb +1 -1
- data/lib/solargraph/pin/instance_variable.rb +0 -4
- data/lib/solargraph/pin/keyword.rb +4 -0
- data/lib/solargraph/pin/localized.rb +5 -3
- data/lib/solargraph/pin/method.rb +11 -0
- data/lib/solargraph/pin/namespace.rb +7 -3
- data/lib/solargraph/pin/proxy_type.rb +3 -7
- data/lib/solargraph/pin/reference.rb +2 -2
- data/lib/solargraph/pin/symbol.rb +1 -1
- data/lib/solargraph/pin/yard_pin/method.rb +2 -2
- data/lib/solargraph/pin/yard_pin/namespace.rb +16 -7
- data/lib/solargraph/position.rb +103 -0
- data/lib/solargraph/range.rb +70 -0
- data/lib/solargraph/source.rb +159 -328
- data/lib/solargraph/source/chain.rb +38 -55
- data/lib/solargraph/source/chain/call.rb +47 -29
- data/lib/solargraph/source/chain/class_variable.rb +2 -2
- data/lib/solargraph/source/chain/constant.rb +3 -3
- data/lib/solargraph/source/chain/definition.rb +7 -3
- data/lib/solargraph/source/chain/global_variable.rb +1 -1
- data/lib/solargraph/source/chain/head.rb +22 -9
- data/lib/solargraph/source/chain/instance_variable.rb +2 -2
- data/lib/solargraph/source/chain/link.rb +4 -4
- data/lib/solargraph/source/chain/literal.rb +1 -1
- data/lib/solargraph/source/chain/variable.rb +2 -2
- data/lib/solargraph/source/change.rb +0 -6
- data/lib/solargraph/source/cursor.rb +161 -0
- data/lib/solargraph/source/encoding_fixes.rb +1 -1
- data/lib/solargraph/source/node_chainer.rb +28 -21
- data/lib/solargraph/source/node_methods.rb +1 -1
- data/lib/solargraph/source/source_chainer.rb +217 -0
- data/lib/solargraph/source_map.rb +138 -0
- data/lib/solargraph/source_map/clip.rb +123 -0
- data/lib/solargraph/{source → source_map}/completion.rb +3 -3
- data/lib/solargraph/{source → source_map}/mapper.rb +143 -41
- data/lib/solargraph/version.rb +1 -1
- data/lib/solargraph/workspace.rb +13 -20
- data/lib/solargraph/yard_map.rb +77 -48
- metadata +17 -11
- data/lib/solargraph/basic_type.rb +0 -33
- data/lib/solargraph/basic_type_methods.rb +0 -111
- data/lib/solargraph/source/call_chainer.rb +0 -273
- data/lib/solargraph/source/fragment.rb +0 -342
- data/lib/solargraph/source/location.rb +0 -23
- data/lib/solargraph/source/position.rb +0 -95
- data/lib/solargraph/source/range.rb +0 -64
@@ -1,23 +0,0 @@
|
|
1
|
-
module Solargraph
|
2
|
-
class Source
|
3
|
-
class Location
|
4
|
-
# @return [String]
|
5
|
-
attr_reader :filename
|
6
|
-
|
7
|
-
# @return [Solargraph::Source::Range]
|
8
|
-
attr_reader :range
|
9
|
-
|
10
|
-
# @param filename [String]
|
11
|
-
# @param range [Solargraph::Source::Range]
|
12
|
-
def initialize filename, range
|
13
|
-
@filename = filename
|
14
|
-
@range = range
|
15
|
-
end
|
16
|
-
|
17
|
-
def == other
|
18
|
-
return false unless other.is_a?(Location)
|
19
|
-
filename == other.filename and range == other.range
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
@@ -1,95 +0,0 @@
|
|
1
|
-
module Solargraph
|
2
|
-
|
3
|
-
class Source
|
4
|
-
class Position
|
5
|
-
# @return [Integer]
|
6
|
-
attr_reader :line
|
7
|
-
|
8
|
-
# @return [Integer]
|
9
|
-
attr_reader :character
|
10
|
-
|
11
|
-
def initialize line, character
|
12
|
-
@line = line
|
13
|
-
@character = character
|
14
|
-
end
|
15
|
-
|
16
|
-
def column
|
17
|
-
character
|
18
|
-
end
|
19
|
-
|
20
|
-
# Get a hash of the position. This representation is suitable for use in
|
21
|
-
# the language server protocol.
|
22
|
-
#
|
23
|
-
# @return [Hash]
|
24
|
-
def to_hash
|
25
|
-
{
|
26
|
-
line: line,
|
27
|
-
character: character
|
28
|
-
}
|
29
|
-
end
|
30
|
-
|
31
|
-
# Get a numeric offset for the specified text and position.
|
32
|
-
#
|
33
|
-
# @param text [String]
|
34
|
-
# @param position [Position]
|
35
|
-
# @return [Integer]
|
36
|
-
def self.to_offset text, position
|
37
|
-
result = 0
|
38
|
-
feed = 0
|
39
|
-
line = position.line
|
40
|
-
column = position.character
|
41
|
-
text.lines.each do |l|
|
42
|
-
line_length = l.length
|
43
|
-
char_length = l.chomp.length
|
44
|
-
if feed == line
|
45
|
-
result += column
|
46
|
-
break
|
47
|
-
end
|
48
|
-
result += line_length
|
49
|
-
feed += 1
|
50
|
-
end
|
51
|
-
result
|
52
|
-
end
|
53
|
-
|
54
|
-
# Get a numeric offset for the specified text and a position identified
|
55
|
-
# by its line and character.
|
56
|
-
#
|
57
|
-
# @param text [String]
|
58
|
-
# @param line [Integer]
|
59
|
-
# @param character [Integer]
|
60
|
-
# @return [Integer]
|
61
|
-
def self.line_char_to_offset text, line, character
|
62
|
-
to_offset(text, Position.new(line, character))
|
63
|
-
end
|
64
|
-
|
65
|
-
# Get a position for the specified text and offset.
|
66
|
-
#
|
67
|
-
# @param text [String]
|
68
|
-
# @param offset [Integer]
|
69
|
-
# @return [Position]
|
70
|
-
def self.from_offset text, offset
|
71
|
-
cursor = 0
|
72
|
-
line = 0
|
73
|
-
character = nil
|
74
|
-
text.lines.each do |l|
|
75
|
-
line_length = l.length
|
76
|
-
char_length = l.chomp.length
|
77
|
-
if cursor + char_length >= offset
|
78
|
-
character = offset - cursor
|
79
|
-
break
|
80
|
-
end
|
81
|
-
cursor += line_length
|
82
|
-
line += 1
|
83
|
-
end
|
84
|
-
character = 0 if character.nil? and offset == cursor
|
85
|
-
raise InvalidOffsetError if character.nil?
|
86
|
-
Position.new(line, character)
|
87
|
-
end
|
88
|
-
|
89
|
-
def == other
|
90
|
-
return false unless other.is_a?(Position)
|
91
|
-
line == other.line and character == other.character
|
92
|
-
end
|
93
|
-
end
|
94
|
-
end
|
95
|
-
end
|
@@ -1,64 +0,0 @@
|
|
1
|
-
module Solargraph
|
2
|
-
class Source
|
3
|
-
class Range
|
4
|
-
# @return [Position]
|
5
|
-
attr_reader :start
|
6
|
-
|
7
|
-
# @return [Position]
|
8
|
-
attr_reader :ending
|
9
|
-
|
10
|
-
# @param start [Position]
|
11
|
-
# @param ending [Position]
|
12
|
-
def initialize start, ending
|
13
|
-
@start = start
|
14
|
-
@ending = ending
|
15
|
-
end
|
16
|
-
|
17
|
-
# Get a hash of the range. This representation is suitable for use in
|
18
|
-
# the language server protocol.
|
19
|
-
#
|
20
|
-
# @return [Hash<Symbol, Position>]
|
21
|
-
def to_hash
|
22
|
-
{
|
23
|
-
start: start.to_hash,
|
24
|
-
end: ending.to_hash
|
25
|
-
}
|
26
|
-
end
|
27
|
-
|
28
|
-
# True if the specified position is inside the range.
|
29
|
-
#
|
30
|
-
# @param position [Solargraph::Source::Position]
|
31
|
-
# @return [Boolean]
|
32
|
-
def contain? position
|
33
|
-
return false if position.line < start.line or position.line > ending.line
|
34
|
-
return false if position.line == start.line and position.character < start.character
|
35
|
-
return false if position.line == ending.line and position.character > ending.character
|
36
|
-
true
|
37
|
-
end
|
38
|
-
|
39
|
-
# True if the range contains the specified position and the position does not precede it.
|
40
|
-
#
|
41
|
-
# @param position [Source::Position]
|
42
|
-
# @return [Boolean]
|
43
|
-
def include? position
|
44
|
-
contain?(position) and !(position.line == start.line and position.character == start.character)
|
45
|
-
end
|
46
|
-
|
47
|
-
# Create a range from a pair of lines and characters.
|
48
|
-
#
|
49
|
-
# @param l1 [Integer] Starting line
|
50
|
-
# @param c1 [Integer] Starting character
|
51
|
-
# @param l2 [Integer] Ending line
|
52
|
-
# @param c2 [Integer] Ending character
|
53
|
-
# @return [Range]
|
54
|
-
def self.from_to l1, c1, l2, c2
|
55
|
-
Range.new(Position.new(l1, c1), Position.new(l2, c2))
|
56
|
-
end
|
57
|
-
|
58
|
-
def == other
|
59
|
-
return false unless other.is_a?(Range)
|
60
|
-
start == other.start and ending == other.ending
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|