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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9346852d9ba48c677a63c6ac2dd3bf6b7cb536309f28569c256bc8654c19c865
4
- data.tar.gz: 9fd017aedc2b705156999d93f5bc8f5f6b99cd7cc3716565ef42ab26936336eb
3
+ metadata.gz: d71c58a0d918c5c6c034e7011a8bf543e0bc4adc5046936fa57cc4f698ccda05
4
+ data.tar.gz: c16b441272fb5aa6f908fdf643d524ff3e5f955dc8b636fd7bf7927836085047
5
5
  SHA512:
6
- metadata.gz: 5b8d3c627dec8757b70444e444a66dd024818f3e62e7c8d9ea57a638182de64524cca532c7b8ae9c5944d373cfdb2e0f3a1ede46e1e8b3e4e728d02b2f9db0e0
7
- data.tar.gz: 41321b8ad277092a434241bc099488c99c721fb7bf593cb3c41f703329ba2d90e2416b5f407ed858db69776d02eb9bb3c93025d094de6f4413fd368f933a7398
6
+ metadata.gz: e7f83cd6982410d73623b44dd7b69bb5513266f778aeb33574b30155ccea7a4f53d9649150df2685efee70bdc5ae8227bd02ccdabbf9b633b66809be7c838307
7
+ data.tar.gz: 83b5822ecf5528f3196e1fbd283ac474d27cbc603f2bb81b8d8bff1b0b99d32023fec6e50b691bb390e5c8873875376d28f182ccb12498513f34a0fa4cb575e8
@@ -59,6 +59,8 @@ jobs:
59
59
  run: |
60
60
  bundle exec overcommit --sign
61
61
  SOLARGRAPH_ASSERTS=on bundle exec overcommit --run --diff origin/master
62
+ # @todo Temporary, expect to revert in 0.60
63
+ continue-on-error: true
62
64
  rubocop:
63
65
  name: rubocop
64
66
  runs-on: ubuntu-latest
@@ -95,6 +97,8 @@ jobs:
95
97
 
96
98
  - name: Run rbs validate
97
99
  run: bundle exec rbs validate
100
+ # @todo Temporary, expect to revert in 0.60
101
+ continue-on-error: true
98
102
  rubocop_todo:
99
103
  name: .rubocop_todo.yml
100
104
  runs-on: ubuntu-latest
@@ -112,6 +116,8 @@ jobs:
112
116
 
113
117
  - name: Run RuboCop
114
118
  run: bundle exec rubocop -c .rubocop.yml
119
+ # @todo Temporary, expect to revert in 0.60
120
+ continue-on-error: true
115
121
 
116
122
  - name: Run RuboCop against todo file
117
123
  continue-on-error: true
@@ -45,6 +45,8 @@ jobs:
45
45
  run: bundle exec rbs collection update
46
46
  - name: Ensure typechecking still works
47
47
  run: bundle exec solargraph typecheck --level strong
48
+ # @todo Temporary, expect to revert in 0.60
49
+ continue-on-error: true
48
50
  - name: Ensure specs still run
49
51
  run: bundle exec rake spec
50
52
  rails:
@@ -78,6 +80,8 @@ jobs:
78
80
  run: bundle exec rbs collection update
79
81
  - name: Ensure typechecking still works
80
82
  run: bundle exec solargraph typecheck --level strong
83
+ # @todo Temporary, expect to revert in 0.60
84
+ continue-on-error: true
81
85
  - name: Ensure specs still run
82
86
  run: bundle exec rake spec
83
87
  rspec:
@@ -109,6 +113,8 @@ jobs:
109
113
  run: bundle exec rbs collection update
110
114
  - name: Ensure typechecking still works
111
115
  run: bundle exec solargraph typecheck --level strong
116
+ # @todo Temporary, expect to revert in 0.60
117
+ continue-on-error: true
112
118
  - name: Ensure specs still run
113
119
  run: bundle exec rake spec
114
120
 
@@ -229,3 +235,5 @@ jobs:
229
235
  ALLOW_IMPROVEMENTS=true bundle exec rake spec
230
236
  env:
231
237
  MATRIX_RAILS_VERSION: "7.0"
238
+ # @todo Temporary, expect to revert in 0.60
239
+ continue-on-error: true
@@ -38,3 +38,5 @@ jobs:
38
38
  run: bundle exec rbs collection install
39
39
  - name: Typecheck self
40
40
  run: SOLARGRAPH_ASSERTS=on bundle exec solargraph typecheck --level strong
41
+ # @todo Temporary, expect to revert in 0.60
42
+ continue-on-error: true
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## 0.59.2 - May 22, 2026
2
+ - Convert RBS implicit nil annotations (#1197)
3
+ - Temporary job stubs (#1200)
4
+ - Limit pin combination to doc maps (#1195)
5
+ - Ignore literal values in type inference (#1201)
6
+ - Fix for clips with flaky node recipients
7
+
1
8
  ## 0.59.1 - May 18, 2026
2
9
  - Fix signatureHelp bug (#1185)
3
10
  - Linting fixes for Ruby 3.1 (#1193)
@@ -71,10 +71,9 @@ module Solargraph
71
71
  # @param visibility [Array<Symbol>]
72
72
  # @return [Enumerable<Solargraph::Pin::Method>]
73
73
  def get_methods fqns, scope: :instance, visibility: [:public]
74
- all_pins = namespace_children(fqns).select do |pin|
74
+ namespace_children(fqns).select do |pin|
75
75
  pin.is_a?(Pin::Method) && pin.scope == scope && visibility.include?(pin.visibility)
76
76
  end
77
- GemPins.combine_method_pins_by_path(all_pins)
78
77
  end
79
78
 
80
79
  BOOLEAN_SUPERCLASS_PIN = Pin::Reference::Superclass.new(name: 'Boolean', closure: Pin::ROOT_PIN,
@@ -375,6 +375,9 @@ module Solargraph
375
375
  #
376
376
  # @return [Pin::BaseVariable, nil]
377
377
  def var_at_location candidates, name, closure, location
378
+ # @todo Location can be nil if clips have trouble finding node recipients
379
+ return unless location
380
+
378
381
  with_correct_name = candidates.select { |pin| pin.name == name }
379
382
  vars_at_location = with_correct_name.reject do |pin|
380
383
  # visible_at? excludes the starting position, but we want to
@@ -416,11 +419,6 @@ module Solargraph
416
419
  # @param deep [Boolean] True to include superclasses, mixins, etc.
417
420
  # @return [Array<Solargraph::Pin::Method>]
418
421
  def get_methods rooted_tag, scope: :instance, visibility: [:public], deep: true
419
- if rooted_tag.start_with? 'Array('
420
- # Array() are really tuples - use our fill, as the RBS repo
421
- # does not give us definitions for it
422
- rooted_tag = "Solargraph::Fills::Tuple(#{rooted_tag[6..-2]})"
423
- end
424
422
  rooted_type = ComplexType.try_parse(rooted_tag)
425
423
  fqns = rooted_type.namespace
426
424
  namespace_pin = store.get_path_pins(fqns).select { |p| p.is_a?(Pin::Namespace) }.first
@@ -721,7 +719,7 @@ module Solargraph
721
719
  logger.debug do
722
720
  "ApiMap#resolve_method_aliases(pins=#{pins.map(&:name)}, visibility=#{visibility}) => #{with_resolved_aliases.map(&:name)}"
723
721
  end
724
- GemPins.combine_method_pins_by_path(with_resolved_aliases)
722
+ with_resolved_aliases
725
723
  end
726
724
 
727
725
  # @return [Workspace, nil]
@@ -59,6 +59,7 @@ module Solargraph
59
59
  end
60
60
 
61
61
  def tuple?
62
+ return false
62
63
  @tuple ||= (name == 'Tuple') || (name == 'Array' && subtypes.length >= 1 && fixed_parameters?)
63
64
  end
64
65
 
@@ -147,6 +147,7 @@ module Solargraph
147
147
  end
148
148
 
149
149
  def literal?
150
+ return false
150
151
  non_literal_name != name
151
152
  end
152
153
 
@@ -228,11 +229,11 @@ module Solargraph
228
229
  # covariant
229
230
  # contravariant?: Proc - can be changed, so we can pass
230
231
  # in less specific super types
231
- if %w[Hash Tuple Array Set Enumerable].include?(name) && fixed_parameters?
232
- :covariant
233
- else
234
- default
235
- end
232
+ # if %w[Hash Tuple Array Set Enumerable].include?(name) && fixed_parameters?
233
+ # :covariant
234
+ # else
235
+ default
236
+ # end
236
237
  end
237
238
 
238
239
  # Whether this is an RBS interface like _ToAry or Hash::_Key.
@@ -374,6 +375,7 @@ module Solargraph
374
375
 
375
376
  # @return [UniqueType]
376
377
  def downcast_to_literal_if_possible
378
+ return self
377
379
  SINGLE_SUBTYPE.fetch(rooted_tag, self)
378
380
  end
379
381
 
@@ -456,15 +458,12 @@ module Solargraph
456
458
  else
457
459
  next ComplexType::UNDEFINED
458
460
  end
459
- elsif context_type.all?(&:implicit_union?)
460
- if idx.zero? && !context_type.all_params.empty?
461
- ComplexType.new(context_type.all_params)
462
- else
463
- ComplexType::UNDEFINED
464
- end
461
+ # @todo Treating parameterized classes and tuples the same for now
462
+ # elsif context_type.all?(&:implicit_union?) || true
463
+ elsif idx.zero? && !context_type.all_params.empty?
464
+ ComplexType.new(context_type.all_params)
465
465
  else
466
- # @sg-ignore Need to add nil check here
467
- context_type.all_params[idx] || definitions.generic_defaults[generic_name] || ComplexType::UNDEFINED
466
+ ComplexType::UNDEFINED
468
467
  end
469
468
  else
470
469
  t
@@ -189,6 +189,7 @@ module Solargraph
189
189
 
190
190
  # @return [ComplexType]
191
191
  def downcast_to_literal_if_possible
192
+ return self
192
193
  ComplexType.new(items.map(&:downcast_to_literal_if_possible))
193
194
  end
194
195
 
@@ -1,111 +1,111 @@
1
- # frozen_string_literal: true
2
-
3
- module Solargraph
4
- module Convention
5
- # ActiveSupport::Concern is syntactic sugar for a common
6
- # pattern to include class methods while mixing-in a Module
7
- # See https://api.rubyonrails.org/classes/ActiveSupport/Concern.html
8
- class ActiveSupportConcern < Base
9
- include Logging
10
-
11
- # @return [Array<Pin::Base>]
12
- attr_reader :pins
13
-
14
- # @param api_map [ApiMap]
15
- # @param rooted_tag [String]
16
- # @param scope [Symbol] :class or :instance
17
- # @param visibility [Array<Symbol>] :public, :protected, and/or :private
18
- # @param deep [Boolean] whether to include methods from included modules
19
- # @param skip [Set<String>]
20
- # @param _no_core [Boolean]n whether to skip core methods
21
- def object api_map, rooted_tag, scope, visibility, deep, skip, _no_core
22
- moo = ObjectProcessor.new(api_map, rooted_tag, scope, visibility, deep, skip)
23
- moo.environ
24
- end
25
-
26
- # yard-activesupport-concern pulls methods inside
27
- # 'class_methods' blocks into main class visible from YARD
28
- #
29
- # @param _doc_map [DocMap]
30
- def global _doc_map
31
- Environ.new(yard_plugins: ['activesupport-concern'])
32
- end
33
-
34
- # Process an object to add any class methods brought in via
35
- # ActiveSupport::Concern
36
- class ObjectProcessor
37
- include Logging
38
-
39
- attr_reader :environ
40
-
41
- # @param api_map [ApiMap]
42
- # @param rooted_tag [String] the tag of the class or module being processed
43
- # @param scope [Symbol] :class or :instance
44
- # @param visibility [Array<Symbol>] :public, :protected, and/or :private
45
- # @param deep [Boolean] whether to include methods from included modules
46
- # @param skip [Set<String>] a set of tags to skip
47
- def initialize api_map, rooted_tag, scope, visibility, deep, skip
48
- @api_map = api_map
49
- @rooted_tag = rooted_tag
50
- @scope = scope
51
- @visibility = visibility
52
- @deep = deep
53
- @skip = skip
54
-
55
- @environ = Environ.new
56
- return unless scope == :class
57
-
58
- @rooted_type = ComplexType.parse(rooted_tag).force_rooted
59
- @fqns = rooted_type.namespace
60
- @namespace_pin = api_map.get_path_pins(fqns).select { |p| p.is_a?(Pin::Namespace) }.first
61
-
62
- api_map.get_includes(fqns).reverse.each do |include_tag|
63
- process_include include_tag
64
- end
65
- end
66
-
67
- private
68
-
69
- attr_reader :api_map, :rooted_tag, :rooted_type, :scope,
70
- :visibility, :deep, :skip, :namespace_pin,
71
- :fqns
72
-
73
- # @param include_tag [Pin::Reference::Include] the include reference pin
74
- #
75
- # @return [void]
76
- def process_include include_tag
77
- rooted_include_tag = api_map.dereference(include_tag)
78
- return if rooted_include_tag.nil?
79
- logger.debug do
80
- "ActiveSupportConcern#object(#{fqns}, #{scope}, #{visibility}, #{deep}) - " \
81
- "Handling class include include_tag=#{include_tag}"
82
- end
83
- module_extends = api_map.get_extends(rooted_include_tag).map(&:type).map(&:to_s)
84
- logger.debug do
85
- "ActiveSupportConcern#object(#{fqns}, #{scope}, #{visibility}, #{deep}) - " \
86
- "found module extends of #{rooted_include_tag}: #{module_extends}"
87
- end
88
- return unless module_extends.include? 'ActiveSupport::Concern'
89
- included_class_pins = api_map.inner_get_methods_from_reference(rooted_include_tag, namespace_pin, rooted_type,
90
- :class, visibility, deep, skip, true)
91
- logger.debug do
92
- "ActiveSupportConcern#object(#{fqns}, #{scope}, #{visibility}, #{deep}) - " \
93
- "Found #{included_class_pins.length} inluded class methods for #{rooted_include_tag}"
94
- end
95
- environ.pins.concat included_class_pins
96
- # another pattern is to put class methods inside a submodule
97
- classmethods_include_tag = "#{rooted_include_tag}::ClassMethods"
98
- included_classmethods_pins =
99
- api_map.inner_get_methods_from_reference(classmethods_include_tag, namespace_pin, rooted_type,
100
- :instance, visibility, deep, skip, true)
101
- logger.debug do
102
- "ActiveSupportConcern#object(#{fqns}, #{scope}, #{visibility}, #{deep}) - " \
103
- "Found #{included_classmethods_pins.length} included classmethod " \
104
- "class methods for #{classmethods_include_tag}"
105
- end
106
- environ.pins.concat included_classmethods_pins
107
- end
108
- end
109
- end
110
- end
111
- end
1
+ # frozen_string_literal: true
2
+
3
+ module Solargraph
4
+ module Convention
5
+ # ActiveSupport::Concern is syntactic sugar for a common
6
+ # pattern to include class methods while mixing-in a Module
7
+ # See https://api.rubyonrails.org/classes/ActiveSupport/Concern.html
8
+ class ActiveSupportConcern < Base
9
+ include Logging
10
+
11
+ # @return [Array<Pin::Base>]
12
+ attr_reader :pins
13
+
14
+ # @param api_map [ApiMap]
15
+ # @param rooted_tag [String]
16
+ # @param scope [Symbol] :class or :instance
17
+ # @param visibility [Array<Symbol>] :public, :protected, and/or :private
18
+ # @param deep [Boolean] whether to include methods from included modules
19
+ # @param skip [Set<String>]
20
+ # @param _no_core [Boolean]n whether to skip core methods
21
+ def object api_map, rooted_tag, scope, visibility, deep, skip, _no_core
22
+ moo = ObjectProcessor.new(api_map, rooted_tag, scope, visibility, deep, skip)
23
+ moo.environ
24
+ end
25
+
26
+ # yard-activesupport-concern pulls methods inside
27
+ # 'class_methods' blocks into main class visible from YARD
28
+ #
29
+ # @param _doc_map [DocMap]
30
+ def global _doc_map
31
+ Environ.new(yard_plugins: ['activesupport-concern'])
32
+ end
33
+
34
+ # Process an object to add any class methods brought in via
35
+ # ActiveSupport::Concern
36
+ class ObjectProcessor
37
+ include Logging
38
+
39
+ attr_reader :environ
40
+
41
+ # @param api_map [ApiMap]
42
+ # @param rooted_tag [String] the tag of the class or module being processed
43
+ # @param scope [Symbol] :class or :instance
44
+ # @param visibility [Array<Symbol>] :public, :protected, and/or :private
45
+ # @param deep [Boolean] whether to include methods from included modules
46
+ # @param skip [Set<String>] a set of tags to skip
47
+ def initialize api_map, rooted_tag, scope, visibility, deep, skip
48
+ @api_map = api_map
49
+ @rooted_tag = rooted_tag
50
+ @scope = scope
51
+ @visibility = visibility
52
+ @deep = deep
53
+ @skip = skip
54
+
55
+ @environ = Environ.new
56
+ return unless scope == :class
57
+
58
+ @rooted_type = ComplexType.parse(rooted_tag).force_rooted
59
+ @fqns = rooted_type.namespace
60
+ @namespace_pin = api_map.get_path_pins(fqns).select { |p| p.is_a?(Pin::Namespace) }.first
61
+
62
+ api_map.get_includes(fqns).reverse.each do |include_tag|
63
+ process_include include_tag
64
+ end
65
+ end
66
+
67
+ private
68
+
69
+ attr_reader :api_map, :rooted_tag, :rooted_type, :scope,
70
+ :visibility, :deep, :skip, :namespace_pin,
71
+ :fqns
72
+
73
+ # @param include_tag [Pin::Reference::Include] the include reference pin
74
+ #
75
+ # @return [void]
76
+ def process_include include_tag
77
+ rooted_include_tag = api_map.dereference(include_tag)
78
+ return if rooted_include_tag.nil?
79
+ logger.debug do
80
+ "ActiveSupportConcern#object(#{fqns}, #{scope}, #{visibility}, #{deep}) - " \
81
+ "Handling class include include_tag=#{include_tag}"
82
+ end
83
+ module_extends = api_map.get_extends(rooted_include_tag).map(&:type).map(&:to_s)
84
+ logger.debug do
85
+ "ActiveSupportConcern#object(#{fqns}, #{scope}, #{visibility}, #{deep}) - " \
86
+ "found module extends of #{rooted_include_tag}: #{module_extends}"
87
+ end
88
+ return unless module_extends.include? 'ActiveSupport::Concern'
89
+ included_class_pins = api_map.inner_get_methods_from_reference(rooted_include_tag, namespace_pin, rooted_type,
90
+ :class, visibility, deep, skip, true)
91
+ logger.debug do
92
+ "ActiveSupportConcern#object(#{fqns}, #{scope}, #{visibility}, #{deep}) - " \
93
+ "Found #{included_class_pins.length} inluded class methods for #{rooted_include_tag}"
94
+ end
95
+ environ.pins.concat included_class_pins
96
+ # another pattern is to put class methods inside a submodule
97
+ classmethods_include_tag = "#{rooted_include_tag}::ClassMethods"
98
+ included_classmethods_pins =
99
+ api_map.inner_get_methods_from_reference(classmethods_include_tag, namespace_pin, rooted_type,
100
+ :instance, visibility, deep, skip, true)
101
+ logger.debug do
102
+ "ActiveSupportConcern#object(#{fqns}, #{scope}, #{visibility}, #{deep}) - " \
103
+ "Found #{included_classmethods_pins.length} included classmethod " \
104
+ "class methods for #{classmethods_include_tag}"
105
+ end
106
+ environ.pins.concat included_classmethods_pins
107
+ end
108
+ end
109
+ end
110
+ end
111
+ end
@@ -1,50 +1,50 @@
1
- # frozen_string_literal: true
2
-
3
- module Solargraph
4
- module Convention
5
- # The base class for Conventions.
6
- #
7
- # A Convention provides Environs that customize ApiMaps with additional
8
- # pins and other information. Subclasses should implement the `local` and
9
- # `global` methods as necessary.
10
- #
11
- class Base
12
- EMPTY_ENVIRON = Environ.new
13
-
14
- # The Environ for a source map.
15
- # Subclasses can override this method.
16
- #
17
- # @param source_map [SourceMap]
18
- # @return [Environ]
19
- def local source_map
20
- EMPTY_ENVIRON
21
- end
22
-
23
- # The Environ for a DocMap.
24
- # Subclasses can override this method.
25
- #
26
- # @param doc_map [DocMap]
27
- # @return [Environ]
28
- def global doc_map
29
- EMPTY_ENVIRON
30
- end
31
-
32
- # Provides any additional method pins based on e the described object.
33
- #
34
- # @param api_map [ApiMap]
35
- # @param rooted_tag [String] A fully qualified namespace, with
36
- # generic parameter values if applicable
37
- # @param scope [Symbol] :class or :instance
38
- # @param visibility [Array<Symbol>] :public, :protected, and/or :private
39
- # @param deep [Boolean]
40
- # @param skip [Set<String>]
41
- # @param no_core [Boolean] Skip core classes if true
42
- #
43
- # @return [Environ]
44
- def object api_map, rooted_tag, scope, visibility,
45
- deep, skip, no_core
46
- EMPTY_ENVIRON
47
- end
48
- end
49
- end
50
- end
1
+ # frozen_string_literal: true
2
+
3
+ module Solargraph
4
+ module Convention
5
+ # The base class for Conventions.
6
+ #
7
+ # A Convention provides Environs that customize ApiMaps with additional
8
+ # pins and other information. Subclasses should implement the `local` and
9
+ # `global` methods as necessary.
10
+ #
11
+ class Base
12
+ EMPTY_ENVIRON = Environ.new
13
+
14
+ # The Environ for a source map.
15
+ # Subclasses can override this method.
16
+ #
17
+ # @param source_map [SourceMap]
18
+ # @return [Environ]
19
+ def local source_map
20
+ EMPTY_ENVIRON
21
+ end
22
+
23
+ # The Environ for a DocMap.
24
+ # Subclasses can override this method.
25
+ #
26
+ # @param doc_map [DocMap]
27
+ # @return [Environ]
28
+ def global doc_map
29
+ EMPTY_ENVIRON
30
+ end
31
+
32
+ # Provides any additional method pins based on e the described object.
33
+ #
34
+ # @param api_map [ApiMap]
35
+ # @param rooted_tag [String] A fully qualified namespace, with
36
+ # generic parameter values if applicable
37
+ # @param scope [Symbol] :class or :instance
38
+ # @param visibility [Array<Symbol>] :public, :protected, and/or :private
39
+ # @param deep [Boolean]
40
+ # @param skip [Set<String>]
41
+ # @param no_core [Boolean] Skip core classes if true
42
+ #
43
+ # @return [Environ]
44
+ def object api_map, rooted_tag, scope, visibility,
45
+ deep, skip, no_core
46
+ EMPTY_ENVIRON
47
+ end
48
+ end
49
+ end
50
+ end
@@ -1,55 +1,55 @@
1
- # frozen_string_literal: true
2
-
3
- module Solargraph
4
- # The Diagnostics library provides reporters for analyzing problems in code
5
- # and providing the results to language server clients.
6
- #
7
- module Diagnostics
8
- autoload :Base, 'solargraph/diagnostics/base'
9
- autoload :Severities, 'solargraph/diagnostics/severities'
10
- autoload :Rubocop, 'solargraph/diagnostics/rubocop'
11
- autoload :RubocopHelpers, 'solargraph/diagnostics/rubocop_helpers'
12
- autoload :RequireNotFound, 'solargraph/diagnostics/require_not_found'
13
- autoload :UpdateErrors, 'solargraph/diagnostics/update_errors'
14
- autoload :TypeCheck, 'solargraph/diagnostics/type_check'
15
-
16
- class << self
17
- # Add a reporter with a name to identify it in .solargraph.yml files.
18
- #
19
- # @param name [String] The name
20
- # @param klass [Class<Solargraph::Diagnostics::Base>] The class implementation
21
- # @return [void]
22
- def register name, klass
23
- reporter_hash[name] = klass
24
- end
25
-
26
- # Get an array of reporter names.
27
- #
28
- # @return [Array<String>]
29
- def reporters
30
- reporter_hash.keys - ['type_not_defined'] # @todo Hide type_not_defined for now
31
- end
32
-
33
- # Find a reporter by name.
34
- #
35
- # @param name [String] The name with which the reporter was registered
36
- # @return [Class<Solargraph::Diagnostics::Base>, nil]
37
- def reporter name
38
- reporter_hash[name]
39
- end
40
-
41
- private
42
-
43
- # @return [Hash{String => Class<Solargraph::Diagnostics::Base>}]
44
- def reporter_hash
45
- @reporter_hash ||= {}
46
- end
47
- end
48
-
49
- register 'rubocop', Rubocop
50
- register 'require_not_found', RequireNotFound
51
- register 'typecheck', TypeCheck
52
- register 'update_errors', UpdateErrors
53
- register 'type_not_defined', TypeCheck # @todo Retained for backwards compatibility
54
- end
55
- end
1
+ # frozen_string_literal: true
2
+
3
+ module Solargraph
4
+ # The Diagnostics library provides reporters for analyzing problems in code
5
+ # and providing the results to language server clients.
6
+ #
7
+ module Diagnostics
8
+ autoload :Base, 'solargraph/diagnostics/base'
9
+ autoload :Severities, 'solargraph/diagnostics/severities'
10
+ autoload :Rubocop, 'solargraph/diagnostics/rubocop'
11
+ autoload :RubocopHelpers, 'solargraph/diagnostics/rubocop_helpers'
12
+ autoload :RequireNotFound, 'solargraph/diagnostics/require_not_found'
13
+ autoload :UpdateErrors, 'solargraph/diagnostics/update_errors'
14
+ autoload :TypeCheck, 'solargraph/diagnostics/type_check'
15
+
16
+ class << self
17
+ # Add a reporter with a name to identify it in .solargraph.yml files.
18
+ #
19
+ # @param name [String] The name
20
+ # @param klass [Class<Solargraph::Diagnostics::Base>] The class implementation
21
+ # @return [void]
22
+ def register name, klass
23
+ reporter_hash[name] = klass
24
+ end
25
+
26
+ # Get an array of reporter names.
27
+ #
28
+ # @return [Array<String>]
29
+ def reporters
30
+ reporter_hash.keys - ['type_not_defined'] # @todo Hide type_not_defined for now
31
+ end
32
+
33
+ # Find a reporter by name.
34
+ #
35
+ # @param name [String] The name with which the reporter was registered
36
+ # @return [Class<Solargraph::Diagnostics::Base>, nil]
37
+ def reporter name
38
+ reporter_hash[name]
39
+ end
40
+
41
+ private
42
+
43
+ # @return [Hash{String => Class<Solargraph::Diagnostics::Base>}]
44
+ def reporter_hash
45
+ @reporter_hash ||= {}
46
+ end
47
+ end
48
+
49
+ register 'rubocop', Rubocop
50
+ register 'require_not_found', RequireNotFound
51
+ register 'typecheck', TypeCheck
52
+ register 'update_errors', UpdateErrors
53
+ register 'type_not_defined', TypeCheck # @todo Retained for backwards compatibility
54
+ end
55
+ end