solargraph 0.59.0 → 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 (54) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/linting.yml +6 -0
  3. data/.github/workflows/plugins.yml +9 -1
  4. data/.github/workflows/typecheck.yml +3 -1
  5. data/CHANGELOG.md +12 -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 +14 -15
  10. data/lib/solargraph/complex_type.rb +2 -1
  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/host.rb +6 -7
  17. data/lib/solargraph/language_server/message/extended/environment.rb +25 -25
  18. data/lib/solargraph/language_server/message/initialized.rb +28 -28
  19. data/lib/solargraph/language_server/message/text_document.rb +28 -28
  20. data/lib/solargraph/language_server/progress.rb +143 -143
  21. data/lib/solargraph/language_server/transport/adapter.rb +68 -68
  22. data/lib/solargraph/language_server.rb +20 -20
  23. data/lib/solargraph/parser/parser_gem/node_chainer.rb +1 -0
  24. data/lib/solargraph/parser/parser_gem/node_methods.rb +91 -4
  25. data/lib/solargraph/parser/parser_gem/node_processors/alias_node.rb +24 -24
  26. data/lib/solargraph/parser/parser_gem/node_processors/casgn_node.rb +36 -36
  27. data/lib/solargraph/parser/parser_gem/node_processors/cvasgn_node.rb +24 -24
  28. data/lib/solargraph/parser/parser_gem/node_processors/gvasgn_node.rb +24 -24
  29. data/lib/solargraph/parser/parser_gem/node_processors/namespace_node.rb +40 -40
  30. data/lib/solargraph/parser/parser_gem/node_processors/sym_node.rb +20 -20
  31. data/lib/solargraph/pin/base.rb +3 -3
  32. data/lib/solargraph/pin/method.rb +2 -0
  33. data/lib/solargraph/pin/parameter.rb +3 -1
  34. data/lib/solargraph/pin/reference/require.rb +14 -14
  35. data/lib/solargraph/pin/search.rb +5 -5
  36. data/lib/solargraph/pin/singleton.rb +11 -11
  37. data/lib/solargraph/rbs_map/conversions.rb +15 -8
  38. data/lib/solargraph/shell.rb +1 -1
  39. data/lib/solargraph/source/chain/array.rb +1 -12
  40. data/lib/solargraph/source/chain/block_symbol.rb +13 -13
  41. data/lib/solargraph/source/chain/block_variable.rb +13 -13
  42. data/lib/solargraph/source/chain/head.rb +19 -19
  43. data/lib/solargraph/source/chain/literal.rb +18 -14
  44. data/lib/solargraph/source/cursor.rb +11 -2
  45. data/lib/solargraph/source/source_chainer.rb +4 -4
  46. data/lib/solargraph/source_map/clip.rb +6 -1
  47. data/lib/solargraph/type_checker.rb +4 -4
  48. data/lib/solargraph/version.rb +1 -1
  49. data/lib/solargraph/yard_map/cache.rb +25 -25
  50. data/lib/solargraph/yard_map/mapper/to_constant.rb +28 -28
  51. data/lib/solargraph/yard_map/mapper/to_method.rb +1 -1
  52. data/lib/solargraph.rb +2 -2
  53. metadata +1 -2
  54. data/rbs/fills/tuple/tuple.rbs +0 -177
@@ -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
@@ -1,52 +1,52 @@
1
- # frozen_string_literal: true
2
-
3
- module Solargraph
4
- # A collection of additional data, such as map pins and required paths, that
5
- # can be added to an ApiMap.
6
- #
7
- # Conventions are used to add Environs.
8
- #
9
- class Environ
10
- # @return [Array<String>]
11
- attr_reader :requires
12
-
13
- # @return [Array<String>]
14
- attr_reader :domains
15
-
16
- # @return [Array<Pin::Base>]
17
- attr_reader :pins
18
-
19
- # @return [Array<String>]
20
- attr_reader :yard_plugins
21
-
22
- # @param requires [Array<String>]
23
- # @param domains [Array<String>]
24
- # @param pins [Array<Pin::Base>]
25
- # @param yard_plugins [Array<String>]
26
- def initialize requires: [], domains: [], pins: [], yard_plugins: []
27
- @requires = requires
28
- @domains = domains
29
- @pins = pins
30
- @yard_plugins = yard_plugins
31
- end
32
-
33
- # @return [self]
34
- def clear
35
- domains.clear
36
- requires.clear
37
- pins.clear
38
- yard_plugins.clear
39
- self
40
- end
41
-
42
- # @param other [Environ]
43
- # @return [self]
44
- def merge other
45
- domains.concat other.domains
46
- requires.concat other.requires
47
- pins.concat other.pins
48
- yard_plugins.concat other.yard_plugins
49
- self
50
- end
51
- end
52
- end
1
+ # frozen_string_literal: true
2
+
3
+ module Solargraph
4
+ # A collection of additional data, such as map pins and required paths, that
5
+ # can be added to an ApiMap.
6
+ #
7
+ # Conventions are used to add Environs.
8
+ #
9
+ class Environ
10
+ # @return [Array<String>]
11
+ attr_reader :requires
12
+
13
+ # @return [Array<String>]
14
+ attr_reader :domains
15
+
16
+ # @return [Array<Pin::Base>]
17
+ attr_reader :pins
18
+
19
+ # @return [Array<String>]
20
+ attr_reader :yard_plugins
21
+
22
+ # @param requires [Array<String>]
23
+ # @param domains [Array<String>]
24
+ # @param pins [Array<Pin::Base>]
25
+ # @param yard_plugins [Array<String>]
26
+ def initialize requires: [], domains: [], pins: [], yard_plugins: []
27
+ @requires = requires
28
+ @domains = domains
29
+ @pins = pins
30
+ @yard_plugins = yard_plugins
31
+ end
32
+
33
+ # @return [self]
34
+ def clear
35
+ domains.clear
36
+ requires.clear
37
+ pins.clear
38
+ yard_plugins.clear
39
+ self
40
+ end
41
+
42
+ # @param other [Environ]
43
+ # @return [self]
44
+ def merge other
45
+ domains.concat other.domains
46
+ requires.concat other.requires
47
+ pins.concat other.pins
48
+ yard_plugins.concat other.yard_plugins
49
+ self
50
+ end
51
+ end
52
+ end
@@ -11,17 +11,6 @@ module Solargraph
11
11
  include Logging
12
12
  end
13
13
 
14
- # @param pins [Array<Pin::Base>]
15
- # @return [Array<Pin::Base>]
16
- def self.combine_method_pins_by_path pins
17
- method_pins, alias_pins = pins.partition { |pin| pin.instance_of?(Pin::Method) }
18
- by_path = method_pins.group_by(&:path)
19
- by_path.transform_values! do |pins|
20
- GemPins.combine_method_pins(*pins)
21
- end
22
- by_path.values + alias_pins
23
- end
24
-
25
14
  # @param pins [Array<Pin::Method>]
26
15
  # @return [Pin::Method, nil]
27
16
  def self.combine_method_pins(*pins)
@@ -648,15 +648,14 @@ module Solargraph
648
648
  # @param text [String]
649
649
  # @param type [Integer] A MessageType constant
650
650
  # @param actions [Array<String>] Response options for the client
651
- # @param block [Proc] The block that processes the response
652
651
  # @yieldparam [String] The action received from the client
653
652
  # @return [void]
654
- def show_message_request text, type, actions, &block
655
- send_request 'window/showMessageRequest', {
656
- type: type,
657
- message: text,
658
- actions: actions
659
- }, &block
653
+ def show_message_request(text, type, actions, &)
654
+ send_request('window/showMessageRequest', {
655
+ type: type,
656
+ message: text,
657
+ actions: actions
658
+ }, &)
660
659
  end
661
660
 
662
661
  # Get a list of IDs for server requests that are waiting for responses
@@ -1,25 +1,25 @@
1
- # frozen_string_literal: true
2
-
3
- module Solargraph
4
- module LanguageServer
5
- module Message
6
- module Extended
7
- # Update YARD documentation for installed gems. If the `rebuild`
8
- # parameter is true, rebuild existing yardocs.
9
- #
10
- class Environment < Base
11
- def process
12
- # Make sure the environment page can report RuboCop's version
13
- require 'rubocop'
14
-
15
- page = Solargraph::Page.new(host.options['viewsPath'])
16
- content = page.render('environment', layout: true, locals: { config: host.options, folders: host.folders })
17
- set_result(
18
- content: content
19
- )
20
- end
21
- end
22
- end
23
- end
24
- end
25
- end
1
+ # frozen_string_literal: true
2
+
3
+ module Solargraph
4
+ module LanguageServer
5
+ module Message
6
+ module Extended
7
+ # Update YARD documentation for installed gems. If the `rebuild`
8
+ # parameter is true, rebuild existing yardocs.
9
+ #
10
+ class Environment < Base
11
+ def process
12
+ # Make sure the environment page can report RuboCop's version
13
+ require 'rubocop'
14
+
15
+ page = Solargraph::Page.new(host.options['viewsPath'])
16
+ content = page.render('environment', layout: true, locals: { config: host.options, folders: host.folders })
17
+ set_result(
18
+ content: content
19
+ )
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -1,28 +1,28 @@
1
- # frozen_string_literal: true
2
-
3
- module Solargraph
4
- module LanguageServer
5
- module Message
6
- class Initialized < Base
7
- def process
8
- # @todo Temporarily removed textDocument/codeAction
9
- host.register_capabilities %w[
10
- textDocument/completion
11
- textDocument/hover
12
- textDocument/signatureHelp
13
- textDocument/formatting
14
- textDocument/documentSymbol
15
- textDocument/definition
16
- textDocument/typeDefinition
17
- textDocument/references
18
- textDocument/rename
19
- textDocument/prepareRename
20
- textDocument/foldingRange
21
- textDocument/documentHighlight
22
- workspace/symbol
23
- ]
24
- end
25
- end
26
- end
27
- end
28
- end
1
+ # frozen_string_literal: true
2
+
3
+ module Solargraph
4
+ module LanguageServer
5
+ module Message
6
+ class Initialized < Base
7
+ def process
8
+ # @todo Temporarily removed textDocument/codeAction
9
+ host.register_capabilities %w[
10
+ textDocument/completion
11
+ textDocument/hover
12
+ textDocument/signatureHelp
13
+ textDocument/formatting
14
+ textDocument/documentSymbol
15
+ textDocument/definition
16
+ textDocument/typeDefinition
17
+ textDocument/references
18
+ textDocument/rename
19
+ textDocument/prepareRename
20
+ textDocument/foldingRange
21
+ textDocument/documentHighlight
22
+ workspace/symbol
23
+ ]
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -1,28 +1,28 @@
1
- # frozen_string_literal: true
2
-
3
- module Solargraph
4
- module LanguageServer
5
- module Message
6
- module TextDocument
7
- autoload :Base, 'solargraph/language_server/message/text_document/base'
8
- autoload :Completion, 'solargraph/language_server/message/text_document/completion'
9
- autoload :DidOpen, 'solargraph/language_server/message/text_document/did_open'
10
- autoload :DidChange, 'solargraph/language_server/message/text_document/did_change'
11
- autoload :DidClose, 'solargraph/language_server/message/text_document/did_close'
12
- autoload :DidSave, 'solargraph/language_server/message/text_document/did_save'
13
- autoload :Hover, 'solargraph/language_server/message/text_document/hover'
14
- autoload :SignatureHelp, 'solargraph/language_server/message/text_document/signature_help'
15
- autoload :OnTypeFormatting, 'solargraph/language_server/message/text_document/on_type_formatting'
16
- autoload :Definition, 'solargraph/language_server/message/text_document/definition'
17
- autoload :TypeDefinition, 'solargraph/language_server/message/text_document/type_definition'
18
- autoload :DocumentSymbol, 'solargraph/language_server/message/text_document/document_symbol'
19
- autoload :Formatting, 'solargraph/language_server/message/text_document/formatting'
20
- autoload :References, 'solargraph/language_server/message/text_document/references'
21
- autoload :Rename, 'solargraph/language_server/message/text_document/rename'
22
- autoload :PrepareRename, 'solargraph/language_server/message/text_document/prepare_rename'
23
- autoload :FoldingRange, 'solargraph/language_server/message/text_document/folding_range'
24
- autoload :DocumentHighlight, 'solargraph/language_server/message/text_document/document_highlight'
25
- end
26
- end
27
- end
28
- end
1
+ # frozen_string_literal: true
2
+
3
+ module Solargraph
4
+ module LanguageServer
5
+ module Message
6
+ module TextDocument
7
+ autoload :Base, 'solargraph/language_server/message/text_document/base'
8
+ autoload :Completion, 'solargraph/language_server/message/text_document/completion'
9
+ autoload :DidOpen, 'solargraph/language_server/message/text_document/did_open'
10
+ autoload :DidChange, 'solargraph/language_server/message/text_document/did_change'
11
+ autoload :DidClose, 'solargraph/language_server/message/text_document/did_close'
12
+ autoload :DidSave, 'solargraph/language_server/message/text_document/did_save'
13
+ autoload :Hover, 'solargraph/language_server/message/text_document/hover'
14
+ autoload :SignatureHelp, 'solargraph/language_server/message/text_document/signature_help'
15
+ autoload :OnTypeFormatting, 'solargraph/language_server/message/text_document/on_type_formatting'
16
+ autoload :Definition, 'solargraph/language_server/message/text_document/definition'
17
+ autoload :TypeDefinition, 'solargraph/language_server/message/text_document/type_definition'
18
+ autoload :DocumentSymbol, 'solargraph/language_server/message/text_document/document_symbol'
19
+ autoload :Formatting, 'solargraph/language_server/message/text_document/formatting'
20
+ autoload :References, 'solargraph/language_server/message/text_document/references'
21
+ autoload :Rename, 'solargraph/language_server/message/text_document/rename'
22
+ autoload :PrepareRename, 'solargraph/language_server/message/text_document/prepare_rename'
23
+ autoload :FoldingRange, 'solargraph/language_server/message/text_document/folding_range'
24
+ autoload :DocumentHighlight, 'solargraph/language_server/message/text_document/document_highlight'
25
+ end
26
+ end
27
+ end
28
+ end