solargraph 0.39.16 → 0.40.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +4 -8
  3. data/CHANGELOG.md +998 -0
  4. data/SPONSORS.md +1 -0
  5. data/lib/solargraph.rb +2 -4
  6. data/lib/solargraph/api_map.rb +61 -63
  7. data/lib/solargraph/api_map/cache.rb +2 -2
  8. data/lib/solargraph/api_map/store.rb +3 -7
  9. data/lib/solargraph/{bundle.rb → bench.rb} +6 -2
  10. data/lib/solargraph/compat.rb +14 -0
  11. data/lib/solargraph/convention.rb +13 -4
  12. data/lib/solargraph/convention/base.rb +16 -8
  13. data/lib/solargraph/convention/gemfile.rb +2 -5
  14. data/lib/solargraph/convention/gemspec.rb +3 -6
  15. data/lib/solargraph/convention/rspec.rb +3 -6
  16. data/lib/solargraph/diagnostics/rubocop_helpers.rb +1 -20
  17. data/lib/solargraph/environ.rb +11 -6
  18. data/lib/solargraph/language_server/host.rb +5 -0
  19. data/lib/solargraph/language_server/message/extended/check_gem_version.rb +6 -1
  20. data/lib/solargraph/language_server/message/text_document/definition.rb +1 -1
  21. data/lib/solargraph/language_server/message/text_document/formatting.rb +47 -20
  22. data/lib/solargraph/library.rb +6 -8
  23. data/lib/solargraph/parser/legacy/node_methods.rb +9 -0
  24. data/lib/solargraph/parser/legacy/node_processors/ivasgn_node.rb +1 -1
  25. data/lib/solargraph/parser/legacy/node_processors/send_node.rb +34 -22
  26. data/lib/solargraph/parser/node_processor/base.rb +3 -0
  27. data/lib/solargraph/parser/rubyvm/node_methods.rb +18 -1
  28. data/lib/solargraph/parser/rubyvm/node_processors/args_node.rb +1 -1
  29. data/lib/solargraph/parser/rubyvm/node_processors/ivasgn_node.rb +1 -1
  30. data/lib/solargraph/parser/rubyvm/node_processors/send_node.rb +38 -28
  31. data/lib/solargraph/pin.rb +0 -3
  32. data/lib/solargraph/pin/common.rb +1 -1
  33. data/lib/solargraph/pin/conversions.rb +1 -1
  34. data/lib/solargraph/pin/documenting.rb +3 -9
  35. data/lib/solargraph/pin/method.rb +141 -7
  36. data/lib/solargraph/pin/method_alias.rb +1 -1
  37. data/lib/solargraph/position.rb +2 -14
  38. data/lib/solargraph/source.rb +10 -6
  39. data/lib/solargraph/source/chain.rb +3 -3
  40. data/lib/solargraph/source_map.rb +4 -1
  41. data/lib/solargraph/source_map/clip.rb +3 -2
  42. data/lib/solargraph/source_map/mapper.rb +10 -6
  43. data/lib/solargraph/type_checker.rb +50 -44
  44. data/lib/solargraph/type_checker/checks.rb +5 -1
  45. data/lib/solargraph/type_checker/param_def.rb +1 -1
  46. data/lib/solargraph/type_checker/rules.rb +5 -1
  47. data/lib/solargraph/version.rb +1 -1
  48. data/lib/solargraph/workspace/config.rb +15 -0
  49. data/lib/solargraph/yard_map.rb +38 -47
  50. data/lib/solargraph/yard_map/core_fills.rb +185 -0
  51. data/lib/solargraph/yard_map/helpers.rb +16 -0
  52. data/lib/solargraph/yard_map/mapper.rb +11 -5
  53. data/lib/solargraph/{pin/yard_pin/constant.rb → yard_map/mapper/to_constant.rb} +6 -6
  54. data/lib/solargraph/yard_map/mapper/to_method.rb +78 -0
  55. data/lib/solargraph/{pin/yard_pin/namespace.rb → yard_map/mapper/to_namespace.rb} +6 -6
  56. data/lib/solargraph/yard_map/rdoc_to_yard.rb +1 -1
  57. data/lib/solargraph/yard_map/stdlib_fills.rb +43 -0
  58. data/lib/solargraph/{pin/yard_pin/method.rb → yard_map/to_method.rb} +29 -30
  59. data/solargraph.gemspec +5 -5
  60. metadata +22 -36
  61. data/lib/solargraph/core_fills.rb +0 -164
  62. data/lib/solargraph/pin/attribute.rb +0 -49
  63. data/lib/solargraph/pin/base_method.rb +0 -149
  64. data/lib/solargraph/pin/yard_pin.rb +0 -12
  65. data/lib/solargraph/pin/yard_pin/yard_mixin.rb +0 -20
  66. data/lib/solargraph/stdlib_fills.rb +0 -40
  67. data/travis-bundler.rb +0 -11
@@ -2,22 +2,30 @@
2
2
 
3
3
  module Solargraph
4
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
+ #
5
11
  class Base
6
12
  EMPTY_ENVIRON = Environ.new
7
13
 
8
- # True if the source qualifies for this convention.
9
- # Subclasses should override this method.
14
+ # The Environ for a source map.
15
+ # Subclasses can override this method.
10
16
  #
11
- # @param source [Source]
12
- def match? source
13
- false
17
+ # @param source_map [SourceMap]
18
+ # @return [Environ]
19
+ def local source_map
20
+ EMPTY_ENVIRON
14
21
  end
15
22
 
16
- # The Environ for this convention.
17
- # Subclasses should override this method.
23
+ # The Environ for a YARD map.
24
+ # Subclasses can override this method.
18
25
  #
26
+ # @param yard_map [YardMap]
19
27
  # @return [Environ]
20
- def environ
28
+ def global yard_map
21
29
  EMPTY_ENVIRON
22
30
  end
23
31
  end
@@ -3,11 +3,8 @@
3
3
  module Solargraph
4
4
  module Convention
5
5
  class Gemfile < Base
6
- def match? source
7
- File.basename(source.filename) == 'Gemfile'
8
- end
9
-
10
- def environ
6
+ def local source_map
7
+ return EMPTY_ENVIRON unless File.basename(source_map.filename) == 'Gemfile'
11
8
  @environ ||= Environ.new(
12
9
  requires: ['bundler'],
13
10
  domains: ['Bundler::Dsl']
@@ -3,14 +3,11 @@
3
3
  module Solargraph
4
4
  module Convention
5
5
  class Gemspec < Base
6
- def match? source
7
- File.basename(source.filename).end_with?('.gemspec')
8
- end
9
-
10
- def environ
6
+ def local source_map
7
+ return EMPTY_ENVIRON unless File.basename(source_map.filename).end_with?('.gemspec')
11
8
  @environ ||= Environ.new(
12
9
  requires: ['rubygems'],
13
- overrides: [
10
+ pins: [
14
11
  Solargraph::Pin::Reference::Override.from_comment(
15
12
  'Gem::Specification.new',
16
13
  %(
@@ -3,18 +3,15 @@
3
3
  module Solargraph
4
4
  module Convention
5
5
  class Rspec < Base
6
- def match? source
7
- File.basename(source.filename) =~ /_spec\.rb$/
8
- end
9
-
10
- def environ
6
+ def local source_map
7
+ return EMPTY_ENVIRON unless File.basename(source_map.filename) =~ /_spec\.rb$/
11
8
  @environ ||= Environ.new(
12
9
  requires: ['rspec'],
13
10
  domains: ['RSpec::Matchers', 'RSpec::ExpectationGroups'],
14
11
  # This override is necessary due to an erroneous @return tag in
15
12
  # rspec's YARD documentation.
16
13
  # @todo The return types have been fixed (https://github.com/rspec/rspec-expectations/pull/1121)
17
- overrides: [
14
+ pins: [
18
15
  Solargraph::Pin::Reference::Override.method_return('RSpec::Matchers#expect', 'RSpec::Expectations::ExpectationTarget')
19
16
  ]
20
17
  )
@@ -13,32 +13,13 @@ module Solargraph
13
13
  # @param code [String]
14
14
  # @return [Array(Array<String>, Array<String>)]
15
15
  def generate_options filename, code
16
- args = ['-f', 'j']
17
- rubocop_file = find_rubocop_file(filename)
18
- args.push('-c', fix_drive_letter(rubocop_file)) unless rubocop_file.nil?
19
- args.push filename
16
+ args = ['-f', 'j', filename]
20
17
  base_options = RuboCop::Options.new
21
18
  options, paths = base_options.parse(args)
22
19
  options[:stdin] = code
23
20
  [options, paths]
24
21
  end
25
22
 
26
- # Find a RuboCop configuration file in a file's directory tree.
27
- #
28
- # @param filename [String]
29
- # @return [String, nil]
30
- def find_rubocop_file filename
31
- return nil unless File.exist?(filename)
32
- filename = File.realpath(filename)
33
- dir = File.dirname(filename)
34
- until File.dirname(dir) == dir
35
- here = File.join(dir, '.rubocop.yml')
36
- return here if File.exist?(here)
37
- dir = File.dirname(dir)
38
- end
39
- nil
40
- end
41
-
42
23
  # RuboCop internally uses capitalized drive letters for Windows paths,
43
24
  # so we need to convert the paths provided to the command.
44
25
  #
@@ -1,6 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
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
+ #
4
9
  class Environ
5
10
  # @return [Array<String>]
6
11
  attr_reader :requires
@@ -9,22 +14,22 @@ module Solargraph
9
14
  attr_reader :domains
10
15
 
11
16
  # @return [Array<Pin::Reference::Override>]
12
- attr_reader :overrides
17
+ attr_reader :pins
13
18
 
14
19
  # @param requires [Array<String>]
15
20
  # @param domains [Array<String>]
16
- # @param overrides [Array<Pin::Reference::Override>]
17
- def initialize requires: [], domains: [], overrides: []
21
+ # @param pins [Array<Pin::Base>]
22
+ def initialize requires: [], domains: [], pins: []
18
23
  @requires = requires
19
24
  @domains = domains
20
- @overrides = overrides
25
+ @pins = pins
21
26
  end
22
27
 
23
28
  # @return [self]
24
29
  def clear
25
30
  domains.clear
26
31
  requires.clear
27
- overrides.clear
32
+ pins.clear
28
33
  self
29
34
  end
30
35
 
@@ -33,7 +38,7 @@ module Solargraph
33
38
  def merge other
34
39
  domains.concat other.domains
35
40
  requires.concat other.requires
36
- overrides.concat other.overrides
41
+ pins.concat other.pins
37
42
  self
38
43
  end
39
44
  end
@@ -494,6 +494,11 @@ module Solargraph
494
494
  library.read_text(filename)
495
495
  end
496
496
 
497
+ def formatter_config uri
498
+ library = library_for(uri)
499
+ library.workspace.config.formatter
500
+ end
501
+
497
502
  # @param uri [String]
498
503
  # @param line [Integer]
499
504
  # @param column [Integer]
@@ -34,7 +34,12 @@ module Solargraph
34
34
  LanguageServer::MessageTypes::INFO,
35
35
  ['Update now'] do |result|
36
36
  next unless result == 'Update now'
37
- o, s = Open3.capture2("gem update solargraph")
37
+ cmd = if host.options['useBundler']
38
+ 'bundle update solargraph'
39
+ else
40
+ 'gem update solargraph'
41
+ end
42
+ o, s = Open3.capture2(cmd)
38
43
  if s == 0
39
44
  host.show_message 'Successfully updated the Solargraph gem.', LanguageServer::MessageTypes::INFO
40
45
  host.send_notification '$/solargraph/restart', {}
@@ -13,7 +13,7 @@ module Solargraph::LanguageServer::Message::TextDocument
13
13
  def code_location
14
14
  suggestions = host.definitions_at(params['textDocument']['uri'], @line, @column)
15
15
  return nil if suggestions.empty?
16
- suggestions.reject{|pin| pin.location.nil?}.map do |pin|
16
+ suggestions.reject { |pin| pin.location.nil? || pin.location.filename.nil? }.map do |pin|
17
17
  {
18
18
  uri: file_to_uri(pin.location.filename),
19
19
  range: pin.location.range.to_hash
@@ -2,6 +2,7 @@
2
2
 
3
3
  require 'rubocop'
4
4
  require 'securerandom'
5
+ require 'tmpdir'
5
6
 
6
7
  module Solargraph
7
8
  module LanguageServer
@@ -10,32 +11,58 @@ module Solargraph
10
11
  class Formatting < Base
11
12
  include Solargraph::Diagnostics::RubocopHelpers
12
13
 
14
+ class BlankRubocopFormatter < ::RuboCop::Formatter::BaseFormatter; end
15
+
13
16
  def process
14
- filename = uri_to_file(params['textDocument']['uri'])
15
- # Make the temp file in the original file's directory so RuboCop
16
- # detects the correct configuration
17
- # the .rb extension is needed for ruby file without extension, else rubocop won't format
18
- tempfile = File.join(File.dirname(filename), "_tmp_#{SecureRandom.hex(8)}_#{File.basename(filename)}.rb")
19
- rubocop_file = Diagnostics::RubocopHelpers.find_rubocop_file(filename)
20
- original = host.read_text(params['textDocument']['uri'])
21
- File.write tempfile, original
22
- begin
23
- args = ['-a', '-f', 'fi', tempfile]
24
- args.unshift('-c', fix_drive_letter(rubocop_file)) unless rubocop_file.nil?
25
- options, paths = RuboCop::Options.new.parse(args)
26
- store = RuboCop::ConfigStore.new
27
- redirect_stdout { RuboCop::Runner.new(options, store).run(paths) }
28
- result = File.read(tempfile)
29
- format original, result
30
- rescue RuboCop::ValidationError, RuboCop::ConfigNotFoundError => e
31
- set_error(Solargraph::LanguageServer::ErrorCodes::INTERNAL_ERROR, "[#{e.class}] #{e.message}")
32
- ensure
33
- File.unlink tempfile
17
+ file_uri = params['textDocument']['uri']
18
+ config = config_for(file_uri)
19
+ original = host.read_text(file_uri)
20
+ args = cli_args(file_uri, config)
21
+
22
+ options, paths = RuboCop::Options.new.parse(args)
23
+ options[:stdin] = original
24
+ redirect_stdout do
25
+ RuboCop::Runner.new(options, RuboCop::ConfigStore.new).run(paths)
34
26
  end
27
+ result = options[:stdin]
28
+
29
+ format original, result
30
+ rescue RuboCop::ValidationError, RuboCop::ConfigNotFoundError => e
31
+ set_error(Solargraph::LanguageServer::ErrorCodes::INTERNAL_ERROR, "[#{e.class}] #{e.message}")
35
32
  end
36
33
 
37
34
  private
38
35
 
36
+ def config_for(file_uri)
37
+ conf = host.formatter_config(file_uri)
38
+ return {} unless conf.is_a?(Hash)
39
+
40
+ conf['rubocop'] || {}
41
+ end
42
+
43
+ def cli_args file, config
44
+ args = [
45
+ config['cops'] == 'all' ? '--auto-correct-all' : '--auto-correct',
46
+ '--cache', 'false',
47
+ '--format', 'Solargraph::LanguageServer::Message::' \
48
+ 'TextDocument::Formatting::BlankRubocopFormatter',
49
+ ]
50
+
51
+ ['except', 'only'].each do |arg|
52
+ cops = cop_list(config[arg])
53
+ args += ["--#{arg}", cops] if cops
54
+ end
55
+
56
+ args += config['extra_args'] if config['extra_args']
57
+ args + [file]
58
+ end
59
+
60
+ def cop_list(value)
61
+ value = value.join(',') if value.respond_to?(:join)
62
+ return nil if value == '' || !value.is_a?(String)
63
+ value
64
+ end
65
+
39
66
  # @param original [String]
40
67
  # @param result [String]
41
68
  # @return [void]
@@ -20,7 +20,7 @@ module Solargraph
20
20
  def initialize workspace = Solargraph::Workspace.new, name = nil
21
21
  @workspace = workspace
22
22
  @name = name
23
- api_map.catalog bundle
23
+ api_map.catalog bench
24
24
  @synchronized = true
25
25
  @catalog_mutex = Mutex.new
26
26
  end
@@ -209,7 +209,6 @@ module Solargraph
209
209
  # @return [Array<Solargraph::Range>]
210
210
  # @todo Take a Location instead of filename/line/column
211
211
  def references_from filename, line, column, strip: false
212
- # checkout filename
213
212
  cursor = api_map.cursor_at(filename, Position.new(line, column))
214
213
  clip = api_map.clip(cursor)
215
214
  pins = clip.define
@@ -222,7 +221,7 @@ module Solargraph
222
221
  referenced = definitions_at(loc.filename, loc.range.ending.line, loc.range.ending.character)
223
222
  # HACK: The additional location comparison is necessary because
224
223
  # Clip#define can return proxies for parameter pins
225
- referenced.any?{|r| r == pin || r.location == pin.location}
224
+ referenced.any? { |r| r == pin || r.location == pin.location }
226
225
  end
227
226
  # HACK: for language clients that exclude special characters from the start of variable names
228
227
  if strip && match = cursor.word.match(/^[^a-z0-9_]+/i)
@@ -290,7 +289,6 @@ module Solargraph
290
289
  # @param filename [String]
291
290
  # @return [Array<Solargraph::Pin::Base>]
292
291
  def document_symbols filename
293
- # checkout filename
294
292
  api_map.document_symbols(filename)
295
293
  end
296
294
 
@@ -351,7 +349,7 @@ module Solargraph
351
349
  @catalog_mutex.synchronize do
352
350
  break if synchronized?
353
351
  logger.info "Cataloging #{workspace.directory.empty? ? 'generic workspace' : workspace.directory}"
354
- api_map.catalog bundle
352
+ api_map.catalog bench
355
353
  @synchronized = true
356
354
  logger.info "Catalog complete (#{api_map.source_maps.length} files, #{api_map.pins.length} pins)" if logger.info?
357
355
  end
@@ -403,9 +401,9 @@ module Solargraph
403
401
  @api_map ||= Solargraph::ApiMap.new
404
402
  end
405
403
 
406
- # @return [Bundle]
407
- def bundle
408
- Bundle.new(
404
+ # @return [Bench]
405
+ def bench
406
+ Bench.new(
409
407
  workspace: workspace,
410
408
  opened: @current ? [@current] : []
411
409
  )
@@ -98,6 +98,7 @@ module Solargraph
98
98
 
99
99
  def convert_hash node
100
100
  return {} unless Parser.is_ast_node?(node) && node.type == :hash
101
+ return convert_hash(node.children[0].children[0]) if splatted_hash?(node)
101
102
  result = {}
102
103
  node.children.each do |pair|
103
104
  result[pair.children[0].children[0]] = Solargraph::Parser.chain(pair.children[1])
@@ -118,6 +119,14 @@ module Solargraph
118
119
  result
119
120
  end
120
121
 
122
+ def splatted_hash? node
123
+ Parser.is_ast_node?(node.children[0]) && node.children[0].type == :kwsplat
124
+ end
125
+
126
+ def splatted_call? node
127
+ Parser.is_ast_node?(node.children[0]) && node.children[0].type == :kwsplat && node.children[0].children[0].type != :hash
128
+ end
129
+
121
130
  # @todo Temporarily here for testing. Move to Solargraph::Parser.
122
131
  def call_nodes_from node
123
132
  return [] unless node.is_a?(::Parser::AST::Node)
@@ -19,7 +19,7 @@ module Solargraph
19
19
  if region.visibility == :module_function
20
20
  here = get_node_start_position(node)
21
21
  named_path = named_path_pin(here)
22
- if named_path.is_a?(Pin::BaseMethod)
22
+ if named_path.is_a?(Pin::Method)
23
23
  pins.push Solargraph::Pin::InstanceVariable.new(
24
24
  location: loc,
25
25
  closure: Pin::Namespace.new(type: :module, closure: region.closure.closure, name: region.closure.name),
@@ -10,20 +10,7 @@ module Solargraph
10
10
  def process
11
11
  if node.children[0].nil?
12
12
  if [:private, :public, :protected].include?(node.children[1])
13
- if (node.children.length > 2)
14
- node.children[2..-1].each do |child|
15
- next unless child.is_a?(AST::Node) && (child.type == :sym || child.type == :str)
16
- name = child.children[0].to_s
17
- matches = pins.select{ |pin| pin.is_a?(Pin::BaseMethod) && pin.name == name && pin.namespace == region.closure.full_context.namespace && pin.context.scope == (region.scope || :instance)}
18
- matches.each do |pin|
19
- # @todo Smelly instance variable access
20
- pin.instance_variable_set(:@visibility, node.children[1])
21
- end
22
- end
23
- else
24
- # @todo Smelly instance variable access
25
- region.instance_variable_set(:@visibility, node.children[1])
26
- end
13
+ process_visibility
27
14
  elsif node.children[1] == :module_function
28
15
  process_module_function
29
16
  elsif [:attr_reader, :attr_writer, :attr_accessor].include?(node.children[1])
@@ -54,6 +41,27 @@ module Solargraph
54
41
 
55
42
  private
56
43
 
44
+ # @return [void]
45
+ def process_visibility
46
+ if (node.children.length > 2)
47
+ node.children[2..-1].each do |child|
48
+ if child.is_a?(AST::Node) && (child.type == :sym || child.type == :str)
49
+ name = child.children[0].to_s
50
+ matches = pins.select{ |pin| pin.is_a?(Pin::Method) && pin.name == name && pin.namespace == region.closure.full_context.namespace && pin.context.scope == (region.scope || :instance)}
51
+ matches.each do |pin|
52
+ # @todo Smelly instance variable access
53
+ pin.instance_variable_set(:@visibility, node.children[1])
54
+ end
55
+ else
56
+ process_children region.update(visibility: node.children[1])
57
+ end
58
+ end
59
+ else
60
+ # @todo Smelly instance variable access
61
+ region.instance_variable_set(:@visibility, node.children[1])
62
+ end
63
+ end
64
+
57
65
  # @return [void]
58
66
  def process_attribute
59
67
  node.children[2..-1].each do |a|
@@ -61,26 +69,30 @@ module Solargraph
61
69
  clos = region.closure
62
70
  cmnt = comments_for(node)
63
71
  if node.children[1] == :attr_reader || node.children[1] == :attr_accessor
64
- pins.push Solargraph::Pin::Attribute.new(
72
+ pins.push Solargraph::Pin::Method.new(
65
73
  location: loc,
66
74
  closure: clos,
67
75
  name: a.children[0].to_s,
68
76
  comments: cmnt,
69
- access: :reader,
70
77
  scope: region.scope || :instance,
71
- visibility: region.visibility
78
+ visibility: region.visibility,
79
+ attribute: true
72
80
  )
73
81
  end
74
82
  if node.children[1] == :attr_writer || node.children[1] == :attr_accessor
75
- pins.push Solargraph::Pin::Attribute.new(
83
+ pins.push Solargraph::Pin::Method.new(
76
84
  location: loc,
77
85
  closure: clos,
78
86
  name: "#{a.children[0]}=",
79
87
  comments: cmnt,
80
- access: :writer,
81
88
  scope: region.scope || :instance,
82
- visibility: region.visibility
89
+ visibility: region.visibility,
90
+ attribute: true
83
91
  )
92
+ pins.last.parameters.push Pin::Parameter.new(name: 'value', decl: :arg, closure: pins.last)
93
+ if pins.last.return_type.defined?
94
+ pins.last.docstring.add_tag YARD::Tags::Tag.new(:param, '', pins.last.return_type.to_s.split(', '), 'value')
95
+ end
84
96
  end
85
97
  end
86
98
  end
@@ -157,7 +169,7 @@ module Solargraph
157
169
  elsif node.children[2].type == :sym || node.children[2].type == :str
158
170
  node.children[2..-1].each do |x|
159
171
  cn = x.children[0].to_s
160
- ref = pins.select{|p| [Solargraph::Pin::Method, Solargraph::Pin::Attribute].include?(p.class) && p.namespace == region.closure.full_context.namespace && p.name == cn}.first
172
+ ref = pins.select{ |p| p.is_a?(Pin::Method) && p.namespace == region.closure.full_context.namespace && p.name == cn }.first
161
173
  unless ref.nil?
162
174
  pins.delete ref
163
175
  mm = Solargraph::Pin::Method.new(
@@ -229,7 +241,7 @@ module Solargraph
229
241
  # @return [Boolean]
230
242
  def process_private_class_method
231
243
  if node.children[2].type == :sym || node.children[2].type == :str
232
- ref = pins.select{|p| [Solargraph::Pin::Method, Solargraph::Pin::Attribute].include?(p.class) && p.namespace == region.closure.full_context.namespace && p.name == node.children[2].children[0].to_s}.first
244
+ ref = pins.select { |p| p.is_a?(Pin::Method) && p.namespace == region.closure.full_context.namespace && p.name == node.children[2].children[0].to_s }.first
233
245
  # HACK: Smelly instance variable access
234
246
  ref.instance_variable_set(:@visibility, :private) unless ref.nil?
235
247
  false