solargraph 0.33.2 → 0.34.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (191) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +0 -1
  3. data/README.md +1 -1
  4. data/lib/solargraph.rb +5 -0
  5. data/lib/solargraph/api_map.rb +36 -18
  6. data/lib/solargraph/api_map/cache.rb +2 -0
  7. data/lib/solargraph/api_map/source_to_yard.rb +14 -5
  8. data/lib/solargraph/api_map/store.rb +17 -19
  9. data/lib/solargraph/bundle.rb +2 -0
  10. data/lib/solargraph/complex_type.rb +18 -4
  11. data/lib/solargraph/complex_type/type_methods.rb +2 -0
  12. data/lib/solargraph/complex_type/unique_type.rb +2 -0
  13. data/lib/solargraph/convention.rb +38 -0
  14. data/lib/solargraph/convention/base.rb +28 -0
  15. data/lib/solargraph/convention/gemfile.rb +18 -0
  16. data/lib/solargraph/convention/gemspec.rb +25 -0
  17. data/lib/solargraph/convention/rspec.rb +23 -0
  18. data/lib/solargraph/core_fills.rb +66 -42
  19. data/lib/solargraph/diagnostics.rb +2 -0
  20. data/lib/solargraph/diagnostics/base.rb +2 -0
  21. data/lib/solargraph/diagnostics/require_not_found.rb +2 -0
  22. data/lib/solargraph/diagnostics/rubocop.rb +2 -0
  23. data/lib/solargraph/diagnostics/rubocop_helpers.rb +2 -0
  24. data/lib/solargraph/diagnostics/severities.rb +15 -13
  25. data/lib/solargraph/diagnostics/type_check.rb +2 -0
  26. data/lib/solargraph/diagnostics/update_errors.rb +2 -0
  27. data/lib/solargraph/documentor.rb +42 -0
  28. data/lib/solargraph/environ.rb +40 -0
  29. data/lib/solargraph/language_server.rb +19 -17
  30. data/lib/solargraph/language_server/completion_item_kinds.rb +2 -0
  31. data/lib/solargraph/language_server/error_codes.rb +2 -0
  32. data/lib/solargraph/language_server/host.rb +3 -1
  33. data/lib/solargraph/language_server/host/cataloger.rb +2 -0
  34. data/lib/solargraph/language_server/host/diagnoser.rb +2 -0
  35. data/lib/solargraph/language_server/host/dispatch.rb +2 -0
  36. data/lib/solargraph/language_server/host/sources.rb +2 -0
  37. data/lib/solargraph/language_server/message.rb +2 -0
  38. data/lib/solargraph/language_server/message/base.rb +2 -0
  39. data/lib/solargraph/language_server/message/cancel_request.rb +13 -11
  40. data/lib/solargraph/language_server/message/client.rb +11 -9
  41. data/lib/solargraph/language_server/message/client/register_capability.rb +15 -13
  42. data/lib/solargraph/language_server/message/completion_item.rb +11 -9
  43. data/lib/solargraph/language_server/message/completion_item/resolve.rb +2 -0
  44. data/lib/solargraph/language_server/message/exit_notification.rb +2 -0
  45. data/lib/solargraph/language_server/message/extended.rb +2 -0
  46. data/lib/solargraph/language_server/message/extended/check_gem_version.rb +2 -0
  47. data/lib/solargraph/language_server/message/extended/document.rb +2 -0
  48. data/lib/solargraph/language_server/message/extended/document_gems.rb +2 -0
  49. data/lib/solargraph/language_server/message/extended/download_core.rb +27 -25
  50. data/lib/solargraph/language_server/message/extended/environment.rb +5 -0
  51. data/lib/solargraph/language_server/message/extended/search.rb +2 -0
  52. data/lib/solargraph/language_server/message/initialize.rb +2 -0
  53. data/lib/solargraph/language_server/message/initialized.rb +2 -0
  54. data/lib/solargraph/language_server/message/method_not_found.rb +16 -14
  55. data/lib/solargraph/language_server/message/method_not_implemented.rb +14 -12
  56. data/lib/solargraph/language_server/message/shutdown.rb +2 -0
  57. data/lib/solargraph/language_server/message/text_document.rb +2 -0
  58. data/lib/solargraph/language_server/message/text_document/base.rb +19 -17
  59. data/lib/solargraph/language_server/message/text_document/code_action.rb +2 -0
  60. data/lib/solargraph/language_server/message/text_document/completion.rb +3 -1
  61. data/lib/solargraph/language_server/message/text_document/definition.rb +2 -0
  62. data/lib/solargraph/language_server/message/text_document/did_change.rb +2 -0
  63. data/lib/solargraph/language_server/message/text_document/did_close.rb +15 -13
  64. data/lib/solargraph/language_server/message/text_document/did_open.rb +15 -13
  65. data/lib/solargraph/language_server/message/text_document/did_save.rb +17 -15
  66. data/lib/solargraph/language_server/message/text_document/document_symbol.rb +2 -0
  67. data/lib/solargraph/language_server/message/text_document/folding_range.rb +2 -0
  68. data/lib/solargraph/language_server/message/text_document/formatting.rb +8 -1
  69. data/lib/solargraph/language_server/message/text_document/hover.rb +3 -1
  70. data/lib/solargraph/language_server/message/text_document/on_type_formatting.rb +2 -0
  71. data/lib/solargraph/language_server/message/text_document/prepare_rename.rb +2 -0
  72. data/lib/solargraph/language_server/message/text_document/references.rb +2 -0
  73. data/lib/solargraph/language_server/message/text_document/rename.rb +2 -0
  74. data/lib/solargraph/language_server/message/text_document/signature_help.rb +7 -1
  75. data/lib/solargraph/language_server/message/workspace.rb +2 -0
  76. data/lib/solargraph/language_server/message/workspace/did_change_configuration.rb +2 -0
  77. data/lib/solargraph/language_server/message/workspace/did_change_watched_files.rb +2 -0
  78. data/lib/solargraph/language_server/message/workspace/did_change_workspace_folders.rb +2 -0
  79. data/lib/solargraph/language_server/message/workspace/workspace_symbol.rb +2 -0
  80. data/lib/solargraph/language_server/message_types.rb +14 -12
  81. data/lib/solargraph/language_server/request.rb +2 -0
  82. data/lib/solargraph/language_server/symbol_kinds.rb +2 -0
  83. data/lib/solargraph/language_server/transport.rb +2 -0
  84. data/lib/solargraph/language_server/transport/adapter.rb +2 -0
  85. data/lib/solargraph/language_server/transport/data_reader.rb +3 -1
  86. data/lib/solargraph/language_server/uri_helpers.rb +2 -0
  87. data/lib/solargraph/library.rb +2 -0
  88. data/lib/solargraph/location.rb +2 -0
  89. data/lib/solargraph/logging.rb +2 -0
  90. data/lib/solargraph/page.rb +2 -0
  91. data/lib/solargraph/pin.rb +3 -20
  92. data/lib/solargraph/pin/attribute.rb +2 -4
  93. data/lib/solargraph/pin/base.rb +3 -5
  94. data/lib/solargraph/pin/base_method.rb +2 -4
  95. data/lib/solargraph/pin/base_variable.rb +2 -0
  96. data/lib/solargraph/pin/block.rb +2 -4
  97. data/lib/solargraph/pin/class_variable.rb +2 -3
  98. data/lib/solargraph/pin/closure.rb +9 -0
  99. data/lib/solargraph/pin/common.rb +3 -5
  100. data/lib/solargraph/pin/constant.rb +2 -4
  101. data/lib/solargraph/pin/conversions.rb +4 -2
  102. data/lib/solargraph/pin/documenting.rb +2 -0
  103. data/lib/solargraph/pin/duck_method.rb +2 -0
  104. data/lib/solargraph/pin/global_variable.rb +2 -3
  105. data/lib/solargraph/pin/instance_variable.rb +2 -4
  106. data/lib/solargraph/pin/keyword.rb +2 -4
  107. data/lib/solargraph/pin/keyword_param.rb +8 -0
  108. data/lib/solargraph/pin/local_variable.rb +2 -4
  109. data/lib/solargraph/pin/localized.rb +2 -0
  110. data/lib/solargraph/pin/method.rb +14 -4
  111. data/lib/solargraph/pin/method_alias.rb +2 -4
  112. data/lib/solargraph/pin/namespace.rb +22 -14
  113. data/lib/solargraph/pin/parameter.rb +4 -6
  114. data/lib/solargraph/pin/proxy_type.rb +2 -0
  115. data/lib/solargraph/pin/reference.rb +2 -0
  116. data/lib/solargraph/pin/reference/extend.rb +2 -3
  117. data/lib/solargraph/pin/reference/include.rb +2 -3
  118. data/lib/solargraph/pin/reference/override.rb +12 -3
  119. data/lib/solargraph/pin/reference/require.rb +2 -4
  120. data/lib/solargraph/pin/reference/superclass.rb +2 -3
  121. data/lib/solargraph/pin/singleton.rb +2 -0
  122. data/lib/solargraph/pin/symbol.rb +2 -4
  123. data/lib/solargraph/pin/yard_pin.rb +2 -0
  124. data/lib/solargraph/pin/yard_pin/constant.rb +7 -3
  125. data/lib/solargraph/pin/yard_pin/method.rb +12 -10
  126. data/lib/solargraph/pin/yard_pin/namespace.rb +9 -4
  127. data/lib/solargraph/pin/yard_pin/yard_mixin.rb +30 -3
  128. data/lib/solargraph/position.rb +2 -0
  129. data/lib/solargraph/range.rb +2 -0
  130. data/lib/solargraph/server_methods.rb +2 -0
  131. data/lib/solargraph/shell.rb +33 -2
  132. data/lib/solargraph/source.rb +2 -0
  133. data/lib/solargraph/source/chain.rb +2 -0
  134. data/lib/solargraph/source/chain/call.rb +63 -14
  135. data/lib/solargraph/source/chain/class_variable.rb +2 -0
  136. data/lib/solargraph/source/chain/constant.rb +18 -11
  137. data/lib/solargraph/source/chain/global_variable.rb +2 -0
  138. data/lib/solargraph/source/chain/head.rb +2 -0
  139. data/lib/solargraph/source/chain/instance_variable.rb +2 -0
  140. data/lib/solargraph/source/chain/link.rb +2 -0
  141. data/lib/solargraph/source/chain/literal.rb +2 -0
  142. data/lib/solargraph/source/chain/or.rb +2 -0
  143. data/lib/solargraph/source/chain/variable.rb +2 -0
  144. data/lib/solargraph/source/change.rb +2 -0
  145. data/lib/solargraph/source/cursor.rb +4 -1
  146. data/lib/solargraph/source/encoding_fixes.rb +2 -0
  147. data/lib/solargraph/source/flawed_builder.rb +15 -13
  148. data/lib/solargraph/source/node_chainer.rb +2 -0
  149. data/lib/solargraph/source/node_methods.rb +9 -5
  150. data/lib/solargraph/source/source_chainer.rb +2 -0
  151. data/lib/solargraph/source/updater.rb +52 -50
  152. data/lib/solargraph/source_map.rb +15 -7
  153. data/lib/solargraph/source_map/clip.rb +35 -3
  154. data/lib/solargraph/source_map/completion.rb +2 -0
  155. data/lib/solargraph/source_map/mapper.rb +2 -0
  156. data/lib/solargraph/source_map/node_processor.rb +2 -0
  157. data/lib/solargraph/source_map/node_processor/alias_node.rb +2 -0
  158. data/lib/solargraph/source_map/node_processor/args_node.rb +2 -0
  159. data/lib/solargraph/source_map/node_processor/base.rb +5 -3
  160. data/lib/solargraph/source_map/node_processor/begin_node.rb +2 -0
  161. data/lib/solargraph/source_map/node_processor/block_node.rb +2 -0
  162. data/lib/solargraph/source_map/node_processor/casgn_node.rb +2 -0
  163. data/lib/solargraph/source_map/node_processor/cvasgn_node.rb +2 -0
  164. data/lib/solargraph/source_map/node_processor/def_node.rb +2 -0
  165. data/lib/solargraph/source_map/node_processor/defs_node.rb +2 -0
  166. data/lib/solargraph/source_map/node_processor/gvasgn_node.rb +2 -0
  167. data/lib/solargraph/source_map/node_processor/ivasgn_node.rb +3 -1
  168. data/lib/solargraph/source_map/node_processor/lvasgn_node.rb +2 -0
  169. data/lib/solargraph/source_map/node_processor/namespace_node.rb +4 -1
  170. data/lib/solargraph/source_map/node_processor/orasgn_node.rb +2 -0
  171. data/lib/solargraph/source_map/node_processor/resbody_node.rb +2 -0
  172. data/lib/solargraph/source_map/node_processor/sclass_node.rb +2 -0
  173. data/lib/solargraph/source_map/node_processor/send_node.rb +11 -6
  174. data/lib/solargraph/source_map/node_processor/sym_node.rb +2 -0
  175. data/lib/solargraph/source_map/region.rb +2 -0
  176. data/lib/solargraph/type_checker.rb +35 -17
  177. data/lib/solargraph/type_checker/param_def.rb +2 -0
  178. data/lib/solargraph/type_checker/problem.rb +2 -0
  179. data/lib/solargraph/version.rb +3 -1
  180. data/lib/solargraph/views/document.erb +3 -3
  181. data/lib/solargraph/views/environment.erb +3 -0
  182. data/lib/solargraph/workspace.rb +5 -1
  183. data/lib/solargraph/workspace/config.rb +14 -0
  184. data/lib/solargraph/yard_map.rb +64 -5
  185. data/lib/solargraph/yard_map/cache.rb +2 -0
  186. data/lib/solargraph/yard_map/core_docs.rb +2 -0
  187. data/lib/solargraph/yard_map/core_gen.rb +2 -0
  188. data/lib/solargraph/yard_map/mapper.rb +15 -14
  189. data/lib/solargraph/yard_map/rdoc_to_yard.rb +129 -0
  190. data/lib/yard-solargraph.rb +8 -0
  191. metadata +11 -2
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Solargraph
4
+ module Convention
5
+ class Base
6
+ EMPTY_ENVIRON = Environ.new
7
+
8
+ # True if the source qualifies for this convention.
9
+ # Subclasses should override this method.
10
+ def match? source
11
+ false
12
+ end
13
+
14
+ # @return [Environ]
15
+ def process
16
+ match? ? EMPTY_ENVIRON : environ
17
+ end
18
+
19
+ # The Environ for this convention.
20
+ # Subclasses should override this method.
21
+ #
22
+ # @return [Environ]
23
+ def environ
24
+ EMPTY_ENVIRON
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Solargraph
4
+ module Convention
5
+ class Gemfile < Base
6
+ def match? source
7
+ File.basename(source.filename) == 'Gemfile'
8
+ end
9
+
10
+ def environ
11
+ @environ ||= Environ.new(
12
+ requires: ['bundler'],
13
+ domains: ['Bundler::Dsl']
14
+ )
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Solargraph
4
+ module Convention
5
+ class Gemspec < Base
6
+ def match? source
7
+ File.basename(source.filename).end_with?('.gemspec')
8
+ end
9
+
10
+ def environ
11
+ @environ ||= Environ.new(
12
+ requires: ['rubygems'],
13
+ overrides: [
14
+ Solargraph::Pin::Reference::Override.from_comment(
15
+ 'Gem::Specification.new',
16
+ %(
17
+ @yieldparam [self]
18
+ )
19
+ )
20
+ ]
21
+ )
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Solargraph
4
+ module Convention
5
+ class Rspec < Base
6
+ def match? source
7
+ File.basename(source.filename) =~ /_spec\.rb$/
8
+ end
9
+
10
+ def environ
11
+ @environ ||= Environ.new(
12
+ requires: ['rspec'],
13
+ domains: ['RSpec::Matchers', 'RSpec::ExpectationGroups'],
14
+ # This override is necessary due to an erroneous @return tag in
15
+ # rspec's YARD documentation.
16
+ overrides: [
17
+ Solargraph::Pin::Reference::Override.method_return('RSpec::Matchers#expect', 'RSpec::Expectations::ExpectationTarget')
18
+ ]
19
+ )
20
+ end
21
+ end
22
+ end
23
+ end
@@ -1,5 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Solargraph
2
4
  module CoreFills
5
+ Override = Pin::Reference::Override
6
+
3
7
  KEYWORDS = [
4
8
  '__ENCODING__', '__LINE__', '__FILE__', 'BEGIN', 'END', 'alias', 'and',
5
9
  'begin', 'break', 'case', 'class', 'def', 'defined?', 'do', 'else',
@@ -8,58 +12,78 @@ module Solargraph
8
12
  'then', 'true', 'undef', 'unless', 'until', 'when', 'while', 'yield'
9
13
  ].freeze
10
14
 
11
- METHODS_RETURNING_SUBTYPES = %w[
12
- Array#[] Array#first Array#last
13
- ].freeze
14
-
15
- METHODS_RETURNING_VALUE_TYPES = %w[
16
- Hash#[]
17
- ].freeze
18
-
19
- METHODS_WITH_YIELDPARAM_SELF = %w[
20
- Object#tap
21
- ].freeze
22
-
23
- METHODS_WITH_YIELDPARAM_SUBTYPES = %w[
15
+ methods_with_yieldparam_subtypes = %w[
24
16
  Array#each Array#map Array#any? Array#all? Array#index Array#keep_if
25
17
  Array#delete_if
26
18
  Enumerable#each_entry Enumerable#map Enumerable#any? Enumerable#all?
27
19
  Enumerable#select Enumerable#reject
28
20
  Set#each
29
- ].freeze
30
-
31
- class << self
32
- private
33
-
34
- def override path, *tags
35
- Solargraph::Pin::Reference::Override.new(nil, path, [YARD::Tags::Tag.new('return', nil, tags)])
36
- end
37
- end
21
+ ]
38
22
 
39
23
  OVERRIDES = [
40
- override('Array#select', 'self'),
41
- override('Array#reject', 'self'),
42
- override('Array#keep_if', 'self'),
43
- override('Array#delete_if', 'self'),
24
+ Override.method_return('Array#select', 'self'),
25
+ Override.method_return('Array#reject', 'self'),
26
+ Override.method_return('Array#keep_if', 'self'),
27
+ Override.method_return('Array#delete_if', 'self'),
28
+ Override.from_comment('Array#[]', %(
29
+ @overload [](range)
30
+ @param range [Range]
31
+ @return [self]
32
+ @overload [](num1, num2)
33
+ @param num1 [Integer]
34
+ @param num2 [Integer]
35
+ @return [self]
36
+ @overload [](num)
37
+ @param num [Integer]
38
+ @return_single_parameter
39
+ @return_single_parameter
40
+ )),
41
+ Override.from_comment('Array#first', %(
42
+ @overload first(num)
43
+ @param num [Integer]
44
+ @return [self]
45
+ @return_single_parameter
46
+ )),
47
+ Override.from_comment('Array#last', %(
48
+ @overload last(num)
49
+ @param num [Integer]
50
+ @return [self]
51
+ @return_single_parameter
52
+ )),
53
+
54
+ Override.method_return('Class#new', 'self'),
55
+ Override.method_return('Class.new', 'Class<Object>'),
56
+ Override.method_return('Class#allocate', 'self'),
57
+ Override.method_return('Class.allocate', 'Class<Object>'),
44
58
 
45
- override('Class#new', 'self'),
46
- override('Class.new', 'Class<Object>'),
47
- override('Class#allocate', 'self'),
48
- override('Class.allocate', 'Class<Object>'),
59
+ Override.method_return('Enumerable#select', 'self'),
49
60
 
50
- override('Enumerable#select', 'self'),
61
+ Override.method_return('File.dirname', 'String'),
51
62
 
52
- override('Object#!', 'Boolean'),
53
- override('Object#clone', 'self'),
54
- override('Object#dup', 'self'),
55
- override('Object#freeze', 'self'),
56
- override('Object#taint', 'self'),
57
- override('Object#untaint', 'self'),
58
- override('Object#tap', 'self'),
63
+ Override.from_comment('Hash#[]', %(
64
+ @return_value_parameter
65
+ )),
66
+
67
+ Override.method_return('Object#!', 'Boolean'),
68
+ Override.method_return('Object#clone', 'self', delete: [:overload]),
69
+ Override.method_return('Object#dup', 'self'),
70
+ Override.method_return('Object#freeze', 'self'),
71
+ Override.method_return('Object#taint', 'self'),
72
+ Override.method_return('Object#untaint', 'self'),
73
+ Override.from_comment('Object#tap', %(
74
+ @return [self]
75
+ @yieldparam [self]
76
+ )),
59
77
 
60
- override('String#freeze', 'self'),
61
- override('String#split', 'Array<String>'),
62
- override('String#lines', 'Array<String>')
63
- ]
78
+ Override.method_return('String#freeze', 'self'),
79
+ Override.method_return('String#split', 'Array<String>'),
80
+ Override.method_return('String#lines', 'Array<String>')
81
+ ].concat(
82
+ methods_with_yieldparam_subtypes.map do |path|
83
+ Override.from_comment(path, %(
84
+ @yieldparam_single_parameter
85
+ ))
86
+ end
87
+ )
64
88
  end
65
89
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Solargraph
2
4
  # The Diagnostics library provides reporters for analyzing problems in code
3
5
  # and providing the results to language server clients.
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Solargraph
2
4
  module Diagnostics
3
5
  # The base class for diagnostics reporters.
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Solargraph
2
4
  module Diagnostics
3
5
  # RequireNotFound reports required paths that could not be resolved to
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'rubocop'
2
4
  require 'stringio'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Solargraph
2
4
  module Diagnostics
3
5
  # Utility methods for the RuboCop diagnostics reporter.
@@ -1,13 +1,15 @@
1
- module Solargraph
2
- module Diagnostics
3
- # These severity constants match the DiagnosticSeverity constants in the
4
- # language server protocol.
5
- #
6
- module Severities
7
- ERROR = 1
8
- WARNING = 2
9
- INFORMATION = 3
10
- HINT = 4
11
- end
12
- end
13
- end
1
+ # frozen_string_literal: true
2
+
3
+ module Solargraph
4
+ module Diagnostics
5
+ # These severity constants match the DiagnosticSeverity constants in the
6
+ # language server protocol.
7
+ #
8
+ module Severities
9
+ ERROR = 1
10
+ WARNING = 2
11
+ INFORMATION = 3
12
+ HINT = 4
13
+ end
14
+ end
15
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Solargraph
2
4
  module Diagnostics
3
5
  # TypeCheck reports methods with undefined return types, untagged
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Solargraph
2
4
  module Diagnostics
3
5
  class UpdateErrors < Base
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler'
4
+
5
+ module Solargraph
6
+ class Documentor
7
+ RDOC_GEMS = %w[
8
+ actioncable actionmailbox actionmailer actionpack actiontext actionview
9
+ activejob activemodel activerecord activestorage activesupport railties
10
+ ]
11
+
12
+ def initialize directory, rebuild: false
13
+ @directory = directory
14
+ @rebuild = rebuild
15
+ end
16
+
17
+ def document
18
+ Dir.chdir @directory do
19
+ Bundler.with_clean_env do
20
+ Bundler.reset!
21
+ lockfile = Bundler::LockfileParser.new(Bundler.read_file(Bundler.default_lockfile))
22
+ # @param spec [Gem::Specification]
23
+ lockfile.specs.each do |spec|
24
+ spec = spec.__materialize__
25
+ yd = YARD::Registry.yardoc_file_for_gem(spec.name, spec.version)
26
+ if !yd || @rebuild
27
+ puts "Documenting #{spec.name} #{spec.version}"
28
+ `yard gems #{spec.name} #{spec.version} #{@rebuild ? '--rebuild' : ''}`
29
+ end
30
+ if RDOC_GEMS.include?(spec.name)
31
+ cache = File.join(Solargraph::YardMap::CoreDocs.cache_dir, 'gems', "#{spec.name}-#{spec.version}", 'yardoc')
32
+ next if File.exist?(cache) && !@rebuild
33
+ puts "Caching custom documentation for #{spec.name} #{spec.version}"
34
+ Solargraph::YardMap::RdocToYard.run(spec)
35
+ end
36
+ end
37
+ end
38
+ end
39
+ Bundler.reset!
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Solargraph
4
+ class Environ
5
+ # @return [Array<String>]
6
+ attr_reader :requires
7
+
8
+ # @return [Array<String>]
9
+ attr_reader :domains
10
+
11
+ # @return [Array<Pin::Reference::Override>]
12
+ attr_reader :overrides
13
+
14
+ # @param requires [Array<String>]
15
+ # @param domains [Array<String>]
16
+ # @param overrides [Array<Pin::Reference::Override>]
17
+ def initialize requires: [], domains: [], overrides: []
18
+ @requires = requires
19
+ @domains = domains
20
+ @overrides = overrides
21
+ end
22
+
23
+ # @return [self]
24
+ def clear
25
+ domains.clear
26
+ requires.clear
27
+ overrides.clear
28
+ self
29
+ end
30
+
31
+ # @param other [Environ]
32
+ # @return [self]
33
+ def merge other
34
+ domains.concat other.domains
35
+ requires.concat other.requires
36
+ overrides.concat other.overrides
37
+ self
38
+ end
39
+ end
40
+ end
@@ -1,17 +1,19 @@
1
- require 'solargraph/language_server/error_codes'
2
- require 'solargraph/language_server/completion_item_kinds'
3
- require 'solargraph/language_server/symbol_kinds'
4
-
5
- module Solargraph
6
- # The LanguageServer namespace contains the classes and modules that compose
7
- # concrete implementations of language servers.
8
- #
9
- module LanguageServer
10
- autoload :Host, 'solargraph/language_server/host'
11
- autoload :Message, 'solargraph/language_server/message'
12
- autoload :UriHelpers, 'solargraph/language_server/uri_helpers'
13
- autoload :MessageTypes, 'solargraph/language_server/message_types'
14
- autoload :Request, 'solargraph/language_server/request'
15
- autoload :Transport, 'solargraph/language_server/transport'
16
- end
17
- end
1
+ # frozen_string_literal: true
2
+
3
+ require 'solargraph/language_server/error_codes'
4
+ require 'solargraph/language_server/completion_item_kinds'
5
+ require 'solargraph/language_server/symbol_kinds'
6
+
7
+ module Solargraph
8
+ # The LanguageServer namespace contains the classes and modules that compose
9
+ # concrete implementations of language servers.
10
+ #
11
+ module LanguageServer
12
+ autoload :Host, 'solargraph/language_server/host'
13
+ autoload :Message, 'solargraph/language_server/message'
14
+ autoload :UriHelpers, 'solargraph/language_server/uri_helpers'
15
+ autoload :MessageTypes, 'solargraph/language_server/message_types'
16
+ autoload :Request, 'solargraph/language_server/request'
17
+ autoload :Transport, 'solargraph/language_server/transport'
18
+ end
19
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Solargraph
2
4
  module LanguageServer
3
5
  # The CompletionItemKind constants for the language server protocol.
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Solargraph
2
4
  module LanguageServer
3
5
  # The ErrorCode constants for the language server protocol.