solargraph 0.59.1 → 0.59.2

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.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/linting.yml +6 -0
  3. data/.github/workflows/plugins.yml +8 -0
  4. data/.github/workflows/typecheck.yml +2 -0
  5. data/CHANGELOG.md +7 -0
  6. data/lib/solargraph/api_map/store.rb +1 -2
  7. data/lib/solargraph/api_map.rb +4 -6
  8. data/lib/solargraph/complex_type/type_methods.rb +1 -0
  9. data/lib/solargraph/complex_type/unique_type.rb +12 -13
  10. data/lib/solargraph/complex_type.rb +1 -0
  11. data/lib/solargraph/convention/active_support_concern.rb +111 -111
  12. data/lib/solargraph/convention/base.rb +50 -50
  13. data/lib/solargraph/diagnostics.rb +55 -55
  14. data/lib/solargraph/environ.rb +52 -52
  15. data/lib/solargraph/gem_pins.rb +0 -11
  16. data/lib/solargraph/language_server/message/extended/environment.rb +25 -25
  17. data/lib/solargraph/language_server/message/initialized.rb +28 -28
  18. data/lib/solargraph/language_server/message/text_document.rb +28 -28
  19. data/lib/solargraph/language_server/progress.rb +143 -143
  20. data/lib/solargraph/language_server/transport/adapter.rb +68 -68
  21. data/lib/solargraph/language_server.rb +20 -20
  22. data/lib/solargraph/parser/parser_gem/node_chainer.rb +1 -0
  23. data/lib/solargraph/parser/parser_gem/node_processors/alias_node.rb +24 -24
  24. data/lib/solargraph/parser/parser_gem/node_processors/casgn_node.rb +36 -36
  25. data/lib/solargraph/parser/parser_gem/node_processors/cvasgn_node.rb +24 -24
  26. data/lib/solargraph/parser/parser_gem/node_processors/gvasgn_node.rb +24 -24
  27. data/lib/solargraph/parser/parser_gem/node_processors/sym_node.rb +20 -20
  28. data/lib/solargraph/pin/reference/require.rb +14 -14
  29. data/lib/solargraph/pin/singleton.rb +11 -11
  30. data/lib/solargraph/rbs_map/conversions.rb +14 -7
  31. data/lib/solargraph/shell.rb +1 -1
  32. data/lib/solargraph/source/chain/array.rb +1 -12
  33. data/lib/solargraph/source/chain/block_symbol.rb +13 -13
  34. data/lib/solargraph/source/chain/block_variable.rb +13 -13
  35. data/lib/solargraph/source/chain/head.rb +19 -19
  36. data/lib/solargraph/source/chain/literal.rb +18 -14
  37. data/lib/solargraph/source/source_chainer.rb +4 -4
  38. data/lib/solargraph/version.rb +1 -1
  39. data/lib/solargraph/yard_map/cache.rb +25 -25
  40. data/lib/solargraph/yard_map/mapper/to_constant.rb +28 -28
  41. metadata +1 -2
  42. data/rbs/fills/tuple/tuple.rbs +0 -177
@@ -1,19 +1,19 @@
1
- # frozen_string_literal: true
2
-
3
- module Solargraph
4
- class Source
5
- class Chain
6
- # Chain::Head is a link for ambiguous words, e.g.; `String` can refer to
7
- # either a class (`String`) or a function (`Kernel#String`).
8
- #
9
- # @note Chain::Head is only intended to handle `self` and `super`.
10
- class Head < Link
11
- def resolve api_map, name_pin, locals
12
- return [Pin::ProxyType.anonymous(name_pin.binder, source: :chain)] if word == 'self'
13
- # return super_pins(api_map, name_pin) if word == 'super'
14
- []
15
- end
16
- end
17
- end
18
- end
19
- end
1
+ # frozen_string_literal: true
2
+
3
+ module Solargraph
4
+ class Source
5
+ class Chain
6
+ # Chain::Head is a link for ambiguous words, e.g.; `String` can refer to
7
+ # either a class (`String`) or a function (`Kernel#String`).
8
+ #
9
+ # @note Chain::Head is only intended to handle `self` and `super`.
10
+ class Head < Link
11
+ def resolve api_map, name_pin, locals
12
+ return [Pin::ProxyType.anonymous(name_pin.binder, source: :chain)] if word == 'self'
13
+ # return super_pins(api_map, name_pin) if word == 'super'
14
+ []
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -13,21 +13,25 @@ module Solargraph
13
13
  def initialize type, node
14
14
  super("<#{type}>")
15
15
 
16
- if node.is_a?(::Parser::AST::Node)
17
- # @sg-ignore flow sensitive typing needs to narrow down type with an if is_a? check
18
- if node.type == :true
19
- @value = true
20
- # @sg-ignore flow sensitive typing needs to narrow down type with an if is_a? check
21
- elsif node.type == :false
22
- @value = false
23
- # @sg-ignore flow sensitive typing needs to narrow down type with an if is_a? check
24
- elsif %i[int sym].include?(node.type)
25
- # @sg-ignore flow sensitive typing needs to narrow down type with an if is_a? check
26
- @value = node.children.first
27
- end
28
- end
16
+ # @todo We might be able to do some light inference from literals and
17
+ # tuples as long as literal values are intransitive.
18
+
19
+ # if node.is_a?(::Parser::AST::Node)
20
+ # # @sg-ignore flow sensitive typing needs to narrow down type with an if is_a? check
21
+ # if node.type == :true
22
+ # @value = true
23
+ # # @sg-ignore flow sensitive typing needs to narrow down type with an if is_a? check
24
+ # elsif node.type == :false
25
+ # @value = false
26
+ # # @sg-ignore flow sensitive typing needs to narrow down type with an if is_a? check
27
+ # elsif %i[int sym].include?(node.type)
28
+ # # @sg-ignore flow sensitive typing needs to narrow down type with an if is_a? check
29
+ # @value = node.children.first
30
+ # end
31
+ # end
29
32
  @type = type
30
- @literal_type = ComplexType.try_parse(@value.inspect)
33
+ # @literal_type = ComplexType.try_parse(@value.inspect)
34
+ @literal_type = ComplexType::UNDEFINED
31
35
  @complex_type = ComplexType.try_parse(type)
32
36
  end
33
37
 
@@ -32,10 +32,10 @@ module Solargraph
32
32
  # @return [Source::Chain]
33
33
  def chain
34
34
  # Special handling for files that end with an integer and a period
35
- if phrase =~ /^[0-9]+\.$/
36
- return Chain.new([Chain::Literal.new('Integer', Integer(phrase[0..-2])),
37
- Chain::UNDEFINED_CALL])
38
- end
35
+ # if phrase =~ /^[0-9]+\.$/
36
+ # return Chain.new([Chain::Literal.new('Integer', Integer(phrase[0..-2])),
37
+ # Chain::UNDEFINED_CALL])
38
+ # end
39
39
  if phrase.start_with?(':') && !phrase.start_with?('::')
40
40
  return Chain.new([Chain::Literal.new('Symbol',
41
41
  # @sg-ignore Need to add nil check here
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Solargraph
4
- VERSION = ENV.fetch('SOLARGRAPH_FORCE_VERSION', '0.59.1')
4
+ VERSION = ENV.fetch('SOLARGRAPH_FORCE_VERSION', '0.59.2')
5
5
  end
@@ -1,25 +1,25 @@
1
- # frozen_string_literal: true
2
-
3
- module Solargraph
4
- class YardMap
5
- class Cache
6
- def initialize
7
- # @type [Hash{String => Array<Solargraph::Pin::Base>}]
8
- @path_pins = {}
9
- end
10
-
11
- # @param path [String]
12
- # @param pins [Array<Solargraph::Pin::Base>]
13
- # @return [Array<Solargraph::Pin::Base>]
14
- def set_path_pins path, pins
15
- @path_pins[path] = pins
16
- end
17
-
18
- # @param path [String]
19
- # @return [Array<Solargraph::Pin::Base>]
20
- def get_path_pins path
21
- @path_pins[path]
22
- end
23
- end
24
- end
25
- end
1
+ # frozen_string_literal: true
2
+
3
+ module Solargraph
4
+ class YardMap
5
+ class Cache
6
+ def initialize
7
+ # @type [Hash{String => Array<Solargraph::Pin::Base>}]
8
+ @path_pins = {}
9
+ end
10
+
11
+ # @param path [String]
12
+ # @param pins [Array<Solargraph::Pin::Base>]
13
+ # @return [Array<Solargraph::Pin::Base>]
14
+ def set_path_pins path, pins
15
+ @path_pins[path] = pins
16
+ end
17
+
18
+ # @param path [String]
19
+ # @return [Array<Solargraph::Pin::Base>]
20
+ def get_path_pins path
21
+ @path_pins[path]
22
+ end
23
+ end
24
+ end
25
+ end
@@ -1,28 +1,28 @@
1
- # frozen_string_literal: true
2
-
3
- module Solargraph
4
- class YardMap
5
- class Mapper
6
- module ToConstant
7
- extend YardMap::Helpers
8
-
9
- # @param code_object [YARD::CodeObjects::Base]
10
- # @param closure [Pin::Closure, nil]
11
- # @param spec [Gem::Specification, nil]
12
- # @return [Pin::Constant]
13
- def self.make code_object, closure = nil, spec = nil
14
- closure ||= create_closure_namespace_for(code_object, spec)
15
-
16
- Pin::Constant.new(
17
- location: object_location(code_object, spec),
18
- closure: closure,
19
- name: code_object.name.to_s,
20
- comments: code_object.docstring ? code_object.docstring.all.to_s : '',
21
- visibility: code_object.visibility,
22
- source: :yardoc
23
- )
24
- end
25
- end
26
- end
27
- end
28
- end
1
+ # frozen_string_literal: true
2
+
3
+ module Solargraph
4
+ class YardMap
5
+ class Mapper
6
+ module ToConstant
7
+ extend YardMap::Helpers
8
+
9
+ # @param code_object [YARD::CodeObjects::Base]
10
+ # @param closure [Pin::Closure, nil]
11
+ # @param spec [Gem::Specification, nil]
12
+ # @return [Pin::Constant]
13
+ def self.make code_object, closure = nil, spec = nil
14
+ closure ||= create_closure_namespace_for(code_object, spec)
15
+
16
+ Pin::Constant.new(
17
+ location: object_location(code_object, spec),
18
+ closure: closure,
19
+ name: code_object.name.to_s,
20
+ comments: code_object.docstring ? code_object.docstring.all.to_s : '',
21
+ visibility: code_object.visibility,
22
+ source: :yardoc
23
+ )
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solargraph
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.59.1
4
+ version: 0.59.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fred Snyder
@@ -804,7 +804,6 @@ files:
804
804
  - rbs/fills/rubygems/0/errors.rbs
805
805
  - rbs/fills/rubygems/0/spec_fetcher.rbs
806
806
  - rbs/fills/rubygems/0/specification.rbs
807
- - rbs/fills/tuple/tuple.rbs
808
807
  - rbs/shims/ast/0/node.rbs
809
808
  - rbs/shims/ast/2.4/.rbs_meta.yaml
810
809
  - rbs/shims/ast/2.4/ast.rbs
@@ -1,177 +0,0 @@
1
- # <-- liberally borrowed from
2
- # https://github.com/ruby/rbs/blob/master/core/array.rbs, which
3
- # was generated from
4
- # https://github.com/ruby/ruby/blob/master/array.c
5
- # -->
6
- module Solargraph
7
- module Fills
8
- class Tuple[unchecked out A,
9
- unchecked out B = A,
10
- unchecked out C = A | B,
11
- unchecked out D = A | B | C,
12
- unchecked out E = A | B | C | D,
13
- unchecked out F = A | B | C | D | E,
14
- unchecked out G = A | B | C | D | E | F,
15
- unchecked out H = A | B | C | D | E | F | G,
16
- unchecked out I = A | B | C | D | E | F | G | H,
17
- unchecked out J = A | B | C | D | E | F | G | H | I] < Array[A | B | C | D | E | F | G | H | I | J]
18
- # <!--
19
- # rdoc-file=array.c
20
- # - self[index] -> object or nil
21
- # -->
22
- # Returns elements from `self`; does not modify `self`.
23
- #
24
- # In brief:
25
- #
26
- # a = [:foo, 'bar', 2]
27
- #
28
- # # Single argument index: returns one element.
29
- # a[0] # => :foo # Zero-based index.
30
- #
31
- # When a single integer argument `index` is given, returns the element at offset
32
- # `index`:
33
- #
34
- # a = [:foo, 'bar', 2]
35
- # a[0] # => :foo
36
- # a[2] # => 2
37
- # a # => [:foo, "bar", 2]
38
- def []: (0 index) -> A
39
- | (1 index) -> B
40
- | (2 index) -> C
41
- | (3 index) -> D
42
- | (4 index) -> E
43
- | (5 index) -> F
44
- | (6 index) -> G
45
- | (7 index) -> H
46
- | (8 index) -> I
47
- | (9 index) -> J
48
- | (int index) -> nil
49
-
50
- # <!--
51
- # rdoc-file=array.c
52
- # - at(index) -> object or nil
53
- # -->
54
- # Returns the element of `self` specified by the given `index` or `nil` if there
55
- # is no such element; `index` must be an [integer-convertible
56
- # object](rdoc-ref:implicit_conversion.rdoc@Integer-Convertible+Objects).
57
- #
58
- # For non-negative `index`, returns the element of `self` at offset `index`:
59
- #
60
- # a = [:foo, 'bar', 2]
61
- # a.at(0) # => :foo
62
- # a.at(2) # => 2
63
- # a.at(2.0) # => 2
64
- #
65
- # Related: Array#[]; see also [Methods for
66
- # Fetching](rdoc-ref:Array@Methods+for+Fetching).
67
- #
68
- def at: (0 index) -> A
69
- | (1 index) -> B
70
- | (2 index) -> C
71
- | (3 index) -> D
72
- | (4 index) -> E
73
- | (5 index) -> F
74
- | (6 index) -> G
75
- | (7 index) -> H
76
- | (8 index) -> I
77
- | (9 index) -> J
78
- | (int index) -> nil
79
-
80
- # <!--
81
- # rdoc-file=array.c
82
- # - fetch(index) -> element
83
- # - fetch(index, default_value) -> element or default_value
84
- # - fetch(index) {|index| ... } -> element or block_return_value
85
- # -->
86
- # Returns the element of `self` at offset `index` if `index` is in range;
87
- # `index` must be an [integer-convertible
88
- # object](rdoc-ref:implicit_conversion.rdoc@Integer-Convertible+Objects).
89
- #
90
- # With the single argument `index` and no block, returns the element at offset
91
- # `index`:
92
- #
93
- # a = [:foo, 'bar', 2]
94
- # a.fetch(1) # => "bar"
95
- # a.fetch(1.1) # => "bar"
96
- #
97
- # With arguments `index` and `default_value` (which may be any object) and no
98
- # block, returns `default_value` if `index` is out-of-range:
99
- #
100
- # a = [:foo, 'bar', 2]
101
- # a.fetch(1, nil) # => "bar"
102
- # a.fetch(3, :foo) # => :foo
103
- #
104
- # With argument `index` and a block, returns the element at offset `index` if
105
- # index is in range (and the block is not called); otherwise calls the block
106
- # with index and returns its return value:
107
- #
108
- # a = [:foo, 'bar', 2]
109
- # a.fetch(1) {|index| raise 'Cannot happen' } # => "bar"
110
- # a.fetch(50) {|index| "Value for #{index}" } # => "Value for 50"
111
- #
112
- # Related: see [Methods for Fetching](rdoc-ref:Array@Methods+for+Fetching).
113
- #
114
- def fetch: (0 index) -> A
115
- | (1 index) -> B
116
- | (2 index) -> C
117
- | (3 index) -> D
118
- | (4 index) -> E
119
- | (5 index) -> F
120
- | (6 index) -> G
121
- | (7 index) -> H
122
- | (8 index) -> I
123
- | (9 index) -> J
124
- | (int index) -> void
125
- | [T] (0 index, T default) -> (A | T)
126
- | [T] (1 index, T default) -> (B | T)
127
- | [T] (2 index, T default) -> (C | T)
128
- | [T] (3 index, T default) -> (D | T)
129
- | [T] (4 index, T default) -> (E | T)
130
- | [T] (5 index, T default) -> (F | T)
131
- | [T] (6 index, T default) -> (G | T)
132
- | [T] (7 index, T default) -> (H | T)
133
- | [T] (8 index, T default) -> (I | T)
134
- | [T] (9 index, T default) -> (J | T)
135
- | [T] (int index, T default) -> (A | B | C | D | E | F | G | H | I | J | T)
136
- | [T] (0 index) { (int index) -> T } -> (A | T)
137
- | [T] (1 index) { (int index) -> T } -> (B | T)
138
- | [T] (2 index) { (int index) -> T } -> (C | T)
139
- | [T] (3 index) { (int index) -> T } -> (D | T)
140
- | [T] (4 index) { (int index) -> T } -> (E | T)
141
- | [T] (5 index) { (int index) -> T } -> (F | T)
142
- | [T] (6 index) { (int index) -> T } -> (G | T)
143
- | [T] (7 index) { (int index) -> T } -> (H | T)
144
- | [T] (8 index) { (int index) -> T } -> (I | T)
145
- | [T] (9 index) { (int index) -> T } -> (J | T)
146
- | [T] (int index) { (int index) -> T } -> (A | B | C | D | E | F | G | H | I | J | T)
147
-
148
- # <!--
149
- # rdoc-file=array.rb
150
- # - first -> object or nil
151
- # - first(count) -> new_array
152
- # -->
153
- # Returns elements from `self`, or `nil`; does not modify `self`.
154
- #
155
- # With no argument given, returns the first element (if available):
156
- #
157
- # a = [:foo, 'bar', 2]
158
- # a.first # => :foo
159
- # a # => [:foo, "bar", 2]
160
- #
161
- # If `self` is empty, returns `nil`.
162
- #
163
- # [].first # => nil
164
- #
165
- # With a non-negative integer argument `count` given, returns the first `count`
166
- # elements (as available) in a new array:
167
- #
168
- # a.first(0) # => []
169
- # a.first(2) # => [:foo, "bar"]
170
- # a.first(50) # => [:foo, "bar", 2]
171
- #
172
- # Related: see [Methods for Querying](rdoc-ref:Array@Methods+for+Querying).
173
- #
174
- def first: %a{implicitly-returns-nil} () -> A
175
- end
176
- end
177
- end