solargraph 0.18.3 → 0.19.0

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 (62) hide show
  1. checksums.yaml +4 -4
  2. data/lib/solargraph/api_map/probe.rb +222 -0
  3. data/lib/solargraph/api_map/source_to_yard.rb +3 -3
  4. data/lib/solargraph/api_map/store.rb +135 -0
  5. data/lib/solargraph/api_map.rb +169 -609
  6. data/lib/solargraph/diagnostics/rubocop.rb +4 -4
  7. data/lib/solargraph/language_server/host.rb +53 -19
  8. data/lib/solargraph/language_server/message/extended/document.rb +1 -1
  9. data/lib/solargraph/language_server/message/extended/search.rb +1 -1
  10. data/lib/solargraph/language_server/message/method_not_found.rb +1 -1
  11. data/lib/solargraph/language_server/message/text_document/definition.rb +2 -15
  12. data/lib/solargraph/language_server/message/text_document/document_symbol.rb +2 -15
  13. data/lib/solargraph/language_server/message/workspace/workspace_symbol.rb +3 -15
  14. data/lib/solargraph/language_server/message_types.rb +10 -0
  15. data/lib/solargraph/language_server.rb +1 -0
  16. data/lib/solargraph/library.rb +8 -0
  17. data/lib/solargraph/node_methods.rb +6 -1
  18. data/lib/solargraph/page.rb +2 -1
  19. data/lib/solargraph/pin/attribute.rb +8 -12
  20. data/lib/solargraph/pin/base.rb +20 -95
  21. data/lib/solargraph/pin/base_variable.rb +15 -74
  22. data/lib/solargraph/pin/block.rb +21 -0
  23. data/lib/solargraph/pin/block_parameter.rb +30 -44
  24. data/lib/solargraph/pin/class_variable.rb +3 -0
  25. data/lib/solargraph/pin/constant.rb +4 -8
  26. data/lib/solargraph/pin/conversions.rb +4 -3
  27. data/lib/solargraph/pin/documenting.rb +27 -0
  28. data/lib/solargraph/pin/global_variable.rb +3 -0
  29. data/lib/solargraph/pin/instance_variable.rb +5 -4
  30. data/lib/solargraph/pin/local_variable.rb +8 -15
  31. data/lib/solargraph/pin/localized.rb +12 -0
  32. data/lib/solargraph/pin/method.rb +6 -67
  33. data/lib/solargraph/pin/method_parameter.rb +24 -11
  34. data/lib/solargraph/pin/namespace.rb +26 -35
  35. data/lib/solargraph/pin/reference.rb +15 -8
  36. data/lib/solargraph/pin/symbol.rb +34 -3
  37. data/lib/solargraph/pin/yard_object.rb +11 -4
  38. data/lib/solargraph/pin.rb +16 -2
  39. data/lib/solargraph/server.rb +2 -2
  40. data/lib/solargraph/source/change.rb +10 -13
  41. data/lib/solargraph/source/fragment.rb +42 -94
  42. data/lib/solargraph/source/location.rb +13 -0
  43. data/lib/solargraph/source/mapper.rb +426 -0
  44. data/lib/solargraph/source/position.rb +1 -0
  45. data/lib/solargraph/source/range.rb +11 -3
  46. data/lib/solargraph/source.rb +93 -284
  47. data/lib/solargraph/version.rb +1 -1
  48. data/lib/solargraph/views/_method.erb +59 -60
  49. data/lib/solargraph/views/_name_type_tag.erb +10 -0
  50. data/lib/solargraph/views/_namespace.erb +26 -26
  51. data/lib/solargraph/views/document.erb +23 -16
  52. data/lib/solargraph/views/layout.erb +38 -10
  53. data/lib/solargraph/views/search.erb +12 -11
  54. data/lib/solargraph/workspace/config.rb +27 -6
  55. data/lib/solargraph/workspace.rb +10 -2
  56. data/lib/solargraph.rb +10 -2
  57. data/lib/yard-solargraph.rb +3 -0
  58. metadata +25 -20
  59. data/lib/solargraph/pin/directed/attribute.rb +0 -20
  60. data/lib/solargraph/pin/directed/method.rb +0 -22
  61. data/lib/solargraph/pin/directed.rb +0 -9
  62. data/lib/solargraph/pin/parameter.rb +0 -23
@@ -13,17 +13,17 @@ module Solargraph
13
13
  begin
14
14
  cmd = "rubocop -f j -s #{Shellwords.escape(filename)}"
15
15
  o, e, s = Open3.capture3(cmd, stdin_data: text)
16
- make_array text, JSON.parse(o)
16
+ raise DiagnosticsError, "RuboCop is not available" if e.include?('Gem::Exception')
17
+ raise DiagnosticsError, "RuboCop returned empty data" if o.empty?
18
+ make_array JSON.parse(o)
17
19
  rescue JSON::ParserError
18
20
  raise DiagnosticsError, 'RuboCop returned invalid data'
19
- rescue Exception => e
20
- raise DiagnosticsError, 'An internal error occurred while running diagnostics'
21
21
  end
22
22
  end
23
23
 
24
24
  private
25
25
 
26
- def make_array text, resp
26
+ def make_array resp
27
27
  severities = {
28
28
  'refactor' => 4,
29
29
  'convention' => 3,
@@ -24,7 +24,7 @@ module Solargraph
24
24
 
25
25
  # @param update [Hash]
26
26
  def configure update
27
- options.merge! update
27
+ options.merge! update unless update.nil?
28
28
  end
29
29
 
30
30
  # @return [Hash]
@@ -51,15 +51,17 @@ module Solargraph
51
51
  begin
52
52
  message.process
53
53
  rescue Exception => e
54
+ STDERR.puts e.message
55
+ STDERR.puts e.backtrace
54
56
  message.set_error Solargraph::LanguageServer::ErrorCodes::INTERNAL_ERROR, "[#{e.class}] #{e.message}"
55
57
  end
56
58
  message
57
59
  end
58
60
 
59
61
  def create uri
62
+ filename = uri_to_file(uri)
60
63
  @change_semaphore.synchronize do
61
- filename = uri_to_file(uri)
62
- library.create filename, File.read(filename)
64
+ library.create_from_disk filename
63
65
  end
64
66
  end
65
67
 
@@ -142,7 +144,15 @@ module Solargraph
142
144
  path = nil
143
145
  path = normalize_separators(directory) unless directory.nil?
144
146
  @change_semaphore.synchronize do
145
- @library = Solargraph::Library.load(path)
147
+ begin
148
+ @library = Solargraph::Library.load(path)
149
+ rescue WorkspaceTooLargeError => e
150
+ send_notification 'window/showMessage', {
151
+ 'type' => Solargraph::LanguageServer::MessageTypes::WARNING,
152
+ 'message' => "The workspace is too large to index (#{e.size} files, max #{Workspace::MAX_WORKSPACE_SIZE})"
153
+ }
154
+ @library = Solargraph::Library.load(nil)
155
+ end
146
156
  end
147
157
  end
148
158
 
@@ -195,34 +205,46 @@ module Solargraph
195
205
  end
196
206
 
197
207
  def completions_at filename, line, column
198
- results = nil
208
+ result = nil
199
209
  @change_semaphore.synchronize do
200
- results = library.completions_at filename, line, column
210
+ result = library.completions_at filename, line, column
201
211
  end
202
- results
212
+ result
203
213
  end
204
214
 
205
215
  # @return [Array<Solargraph::Pin::Base>]
206
216
  def definitions_at filename, line, column
207
- results = []
217
+ result = []
208
218
  @change_semaphore.synchronize do
209
- results = library.definitions_at(filename, line, column)
219
+ result = library.definitions_at(filename, line, column)
210
220
  end
211
- results
221
+ result
212
222
  end
213
223
 
214
224
  def signatures_at filename, line, column
215
- results = nil
225
+ result = nil
216
226
  @change_semaphore.synchronize do
217
- results = library.signatures_at(filename, line, column)
227
+ result = library.signatures_at(filename, line, column)
218
228
  end
219
- results
229
+ result
220
230
  end
221
231
 
222
232
  def query_symbols query
223
- results = nil
224
- @change_semaphore.synchronize { results = library.query_symbols(query) }
225
- results
233
+ result = nil
234
+ @change_semaphore.synchronize { result = library.query_symbols(query) }
235
+ result
236
+ end
237
+
238
+ def search query
239
+ result = nil
240
+ @change_semaphore.synchronize { result = library.search(query) }
241
+ result
242
+ end
243
+
244
+ def document query
245
+ result = nil
246
+ @change_semaphore.synchronize { result = library.document(query) }
247
+ result
226
248
  end
227
249
 
228
250
  def file_symbols uri
@@ -323,8 +345,20 @@ module Solargraph
323
345
  }
324
346
  end
325
347
  end
326
- rescue Exception => e
327
- STDERR.puts "Error in diagnostics: #{e.class}"
348
+ rescue DiagnosticsError => e
349
+ STDERR.puts "Error in diagnostics: #{e.message}"
350
+ options['diagnostics'] = false
351
+ send_notification 'window/showMessage', {
352
+ type: LanguageServer::MessageTypes::ERROR,
353
+ message: "Error in diagnostics: #{e.message}"
354
+ }
355
+ rescue Errno::ENOENT => e
356
+ STDERR.puts "Error in diagnostics: RuboCop could not be found"
357
+ options['diagnostics'] = false
358
+ send_notification 'window/showMessage', {
359
+ type: LanguageServer::MessageTypes::ERROR,
360
+ message: "Error in diagnostics: RuboCop could not be found"
361
+ }
328
362
  end
329
363
  end
330
364
  end
@@ -340,7 +374,7 @@ module Solargraph
340
374
  params['contentChanges'].each do |chng|
341
375
  changes.push Solargraph::Source::Change.new(
342
376
  (chng['range'].nil? ?
343
- nil :
377
+ nil :
344
378
  Solargraph::Source::Range.from_to(chng['range']['start']['line'], chng['range']['start']['character'], chng['range']['end']['line'], chng['range']['end']['character'])
345
379
  ),
346
380
  chng['text']
@@ -4,7 +4,7 @@ module Solargraph
4
4
  module Extended
5
5
  class Document < Base
6
6
  def process
7
- objects = host.library.document(params['query'])
7
+ objects = host.document(params['query'])
8
8
  page = Solargraph::Page.new(host.options['viewsPath'])
9
9
  content = page.render('document', locals: {objects: objects})
10
10
  set_result(
@@ -4,7 +4,7 @@ module Solargraph
4
4
  module Extended
5
5
  class Search < Base
6
6
  def process
7
- results = host.library.search(params['query'])
7
+ results = host.search(params['query'])
8
8
  page = Solargraph::Page.new(host.options['viewsPath'])
9
9
  content = page.render('search', locals: {query: params['query'], results: results})
10
10
  set_result(
@@ -5,7 +5,7 @@ module Solargraph
5
5
  def process
6
6
  set_error(
7
7
  Solargraph::LanguageServer::ErrorCodes::METHOD_NOT_FOUND,
8
- "Method not found: #{request['message']}"
8
+ "Method not found: #{request['method']}"
9
9
  )
10
10
  end
11
11
  end
@@ -13,22 +13,9 @@ module Solargraph::LanguageServer::Message::TextDocument
13
13
  suggestions = host.definitions_at(filename, line, col)
14
14
  locations = suggestions.map do |pin|
15
15
  unless pin.location.nil?
16
- parts = pin.location.split(':')
17
- char = parts.pop.to_i
18
- line = parts.pop.to_i
19
- filename = parts.join(':')
20
16
  {
21
- uri: file_to_uri(filename),
22
- range: {
23
- start: {
24
- line: line,
25
- character: char
26
- },
27
- end: {
28
- line: line,
29
- character: char
30
- }
31
- }
17
+ uri: file_to_uri(pin.location.filename),
18
+ range: pin.location.range.to_hash
32
19
  }
33
20
  end
34
21
  end
@@ -4,25 +4,12 @@ class Solargraph::LanguageServer::Message::TextDocument::DocumentSymbol < Solarg
4
4
  def process
5
5
  pins = host.file_symbols params['textDocument']['uri']
6
6
  info = pins.map do |pin|
7
- parts = pin.location.split(':')
8
- char = parts.pop.to_i
9
- line = parts.pop.to_i
10
- filename = parts.join(':')
11
7
  {
12
8
  name: pin.path,
13
9
  kind: Solargraph::LanguageServer::SymbolKinds::NAMESPACE,
14
10
  location: {
15
- uri: file_to_uri(filename),
16
- range: {
17
- start: {
18
- line: line,
19
- character: char
20
- },
21
- end: {
22
- line: line,
23
- character: char
24
- }
25
- }
11
+ uri: file_to_uri(pin.location.filename),
12
+ range: pin.location.range.to_hash
26
13
  }
27
14
  }
28
15
  end
@@ -4,25 +4,13 @@ class Solargraph::LanguageServer::Message::Workspace::WorkspaceSymbol < Solargra
4
4
  def process
5
5
  pins = host.query_symbols(params['query'])
6
6
  info = pins.map do |pin|
7
- parts = pin.location.split(':')
8
- char = parts.pop.to_i
9
- line = parts.pop.to_i
10
- filename = parts.join(':')
7
+ uri = file_to_uri(pin.location.filename)
11
8
  {
12
9
  name: pin.path,
13
10
  kind: Solargraph::LanguageServer::SymbolKinds::NAMESPACE,
14
11
  location: {
15
- uri: file_to_uri(filename),
16
- range: {
17
- start: {
18
- line: line,
19
- character: char
20
- },
21
- end: {
22
- line: line,
23
- character: char
24
- }
25
- }
12
+ uri: uri,
13
+ range: pin.location.range.to_hash
26
14
  }
27
15
  }
28
16
  end
@@ -0,0 +1,10 @@
1
+ module Solargraph
2
+ module LanguageServer
3
+ module MessageTypes
4
+ ERROR = 1
5
+ WARNING = 2
6
+ INFO = 3
7
+ LOG = 4
8
+ end
9
+ end
10
+ end
@@ -8,5 +8,6 @@ module Solargraph
8
8
  autoload :Message, 'solargraph/language_server/message'
9
9
  autoload :Transport, 'solargraph/language_server/transport'
10
10
  autoload :UriHelpers, 'solargraph/language_server/uri_helpers'
11
+ autoload :MessageTypes, 'solargraph/language_server/message_types'
11
12
  end
12
13
  end
@@ -45,6 +45,14 @@ module Solargraph
45
45
  true
46
46
  end
47
47
 
48
+ def create_from_disk filename
49
+ return if File.directory?(filename) or !File.exist?(filename)
50
+ return unless workspace.would_merge?(filename)
51
+ source = Solargraph::Source.load_string(File.read(filename), filename)
52
+ workspace.merge(source)
53
+ api_map.refresh
54
+ end
55
+
48
56
  # Delete a file from the library. Deleting a file will make it unavailable
49
57
  # for checkout and optionally remove it from the workspace unless the
50
58
  # workspace configuration determines that it should still exist.
@@ -57,6 +57,9 @@ module Solargraph
57
57
  return 'Float'
58
58
  elsif node.type == :sym
59
59
  return 'Symbol'
60
+ # @todo Maybe ignore nils
61
+ # elsif node.type == :nil
62
+ # return 'NilClass'
60
63
  end
61
64
  nil
62
65
  end
@@ -67,7 +70,9 @@ module Solargraph
67
70
  #
68
71
  # @return [String]
69
72
  def resolve_node_signature node
70
- drill_signature node, ''
73
+ result = drill_signature node, ''
74
+ return nil if result.empty?
75
+ result
71
76
  end
72
77
 
73
78
  private
@@ -41,7 +41,8 @@ module Solargraph
41
41
  end
42
42
  private_constant :Binder
43
43
 
44
- def initialize directory
44
+ def initialize directory = VIEWS_PATH
45
+ directory = VIEWS_PATH if directory.nil? or !File.directory?(directory)
45
46
  @render_method = proc { |template, layout: false, locals: {}|
46
47
  binder = Binder.new(locals, @render_method)
47
48
  if layout
@@ -4,14 +4,18 @@ module Solargraph
4
4
  # @return [Symbol] :reader or :writer
5
5
  attr_reader :access
6
6
 
7
- def initialize source, node, namespace, access, docstring
8
- super(source, node, namespace)
7
+ def initialize location, namespace, name, docstring, access
8
+ super(location, namespace, name, docstring)
9
9
  @access = access
10
10
  @docstring = docstring
11
11
  end
12
12
 
13
- def name
14
- @name ||= "#{node.children[0]}#{access == :writer ? '=' : ''}"
13
+ def kind
14
+ Solargraph::Pin::ATTRIBUTE
15
+ end
16
+
17
+ def completion_item_kind
18
+ Solargraph::LanguageServer::CompletionItemKinds::PROPERTY
15
19
  end
16
20
 
17
21
  def path
@@ -25,14 +29,6 @@ module Solargraph
25
29
  end
26
30
  @return_type
27
31
  end
28
-
29
- def completion_item_kind
30
- Solargraph::LanguageServer::CompletionItemKinds::PROPERTY
31
- end
32
-
33
- def method?
34
- true
35
- end
36
32
  end
37
33
  end
38
34
  end
@@ -4,126 +4,51 @@ module Solargraph
4
4
  module Pin
5
5
  class Base
6
6
  include Conversions
7
+ include Documenting
7
8
 
8
- # @return [Solargraph::Source]
9
- attr_reader :source
10
-
11
- # @return [Parser::AST::Node]
12
- attr_reader :node
9
+ attr_reader :location
13
10
 
14
11
  # @return [String]
15
12
  attr_reader :namespace
16
13
 
17
- def initialize source, node, namespace
18
- @source = source
19
- @node = node
20
- @namespace = namespace
21
- end
14
+ attr_reader :name
22
15
 
23
- def contain?(index)
24
- if index >= node.loc.expression.begin_pos
25
- if node.respond_to?(:end)
26
- if index < node.end.end_pos
27
- return true
28
- end
29
- elsif index < node.loc.expression.end_pos
30
- return true
31
- end
32
- end
33
- false
34
- end
35
-
36
- # @return [YARD::Docstring]
37
- def docstring
38
- @docstring ||= source.docstring_for(node) unless source.nil?
39
- @docstring
40
- end
16
+ attr_reader :docstring
41
17
 
42
18
  # @return [String]
43
- def name
44
- nil
45
- end
46
-
47
- # @return [String]
48
- def path
49
- nil
50
- end
19
+ attr_reader :return_type
51
20
 
52
- # @return [Integer]
53
- def completion_item_kind
54
- end
21
+ attr_reader :kind
55
22
 
56
- # @return [Integer]
57
- def symbol_kind
58
- end
23
+ attr_reader :path
59
24
 
60
- # @return [Integer]
61
- def kind
62
- completion_item_kind
63
- end
64
-
65
- # @return [String]
66
- def return_type
67
- nil
68
- end
69
-
70
- # @return [String]
71
- def signature
72
- nil
73
- end
74
-
75
- # @return [String]
76
- def value
77
- nil
78
- end
79
-
80
- # @return [Array<String>]
81
- def parameters
82
- []
83
- end
84
-
85
- def arguments
86
- parameters
25
+ def initialize location, namespace, name, docstring
26
+ @location = location
27
+ @namespace = namespace
28
+ @name = name
29
+ @docstring = docstring
87
30
  end
88
31
 
89
- # @return [String]
90
32
  def filename
91
- source.filename unless source.nil?
92
- end
93
-
94
- def location
95
- "#{source.filename}:#{node.location.expression.line - 1}:#{node.location.expression.column}" unless source.nil? or node.nil?
33
+ location.filename
96
34
  end
97
35
 
98
36
  # @return [String]
99
- def documentation
100
- if @documentation.nil? and !docstring.nil?
101
- @documentation = ReverseMarkdown.convert(helper.html_markup_rdoc(docstring), github_flavored: true)
102
- @documentation.strip!
103
- end
104
- @documentation
37
+ def path
105
38
  end
106
39
 
107
- # True if the suggestion has documentation.
108
- # Useful for determining whether a client should resolve a suggestion's
109
- # path to retrieve more information about it.
110
- #
111
- # @return [Boolean]
112
- def has_doc?
113
- !docstring.nil? and !docstring.all.empty?
40
+ # @return [Integer]
41
+ def kind
114
42
  end
115
43
 
116
- def helper
117
- @helper ||= Solargraph::Pin::Helper.new
44
+ def completion_item_kind
45
+ LanguageServer::CompletionItemKinds::KEYWORD
118
46
  end
119
47
 
120
48
  def to_s
121
49
  name.to_s
122
50
  end
123
51
 
124
- def resolve api_map
125
- end
126
-
127
52
  def identifier
128
53
  @identifier ||= "#{path}|#{name}"
129
54
  end
@@ -132,8 +57,8 @@ module Solargraph
132
57
  false
133
58
  end
134
59
 
135
- def method?
136
- false
60
+ def named_context
61
+ namespace
137
62
  end
138
63
  end
139
64
  end
@@ -1,16 +1,19 @@
1
1
  module Solargraph
2
2
  module Pin
3
3
  class BaseVariable < Base
4
- include NodeMethods
4
+ attr_reader :signature
5
5
 
6
- def initialize source, node, namespace
7
- super
8
- @tried_to_detect_return_type = false
9
- @tried_to_resolve_return_type = false
6
+ attr_reader :context
7
+
8
+ def initialize location, namespace, name, docstring, signature, literal, context
9
+ super(location, namespace, name, docstring)
10
+ @signature = signature
11
+ @literal = literal
12
+ @context = context
10
13
  end
11
14
 
12
- def name
13
- node.children[0].to_s
15
+ def scope
16
+ @scope ||= (context.kind == Pin::METHOD and context.scope == :instance ? :instance : :class)
14
17
  end
15
18
 
16
19
  def completion_item_kind
@@ -18,86 +21,24 @@ module Solargraph
18
21
  end
19
22
 
20
23
  def return_type
21
- if @return_type.nil? and !@tried_to_detect_return_type
22
- @tried_to_detect_return_type = true
23
- if docstring.nil?
24
- @return_type ||= infer_literal_node_type(assignment_node)
25
- else
24
+ if @return_type.nil?
25
+ if !docstring.nil?
26
26
  tag = docstring.tag(:type)
27
27
  @return_type = tag.types[0] unless tag.nil?
28
+ else
29
+ @return_type = @literal
28
30
  end
29
31
  end
30
32
  @return_type
31
33
  end
32
34
 
33
- def assignment_node
34
- @assignment_node ||= node.children[(node.type == :casgn ? 2 : 1)]
35
- end
36
-
37
35
  def nil_assignment?
38
- assignment_node.nil? or assignment_node.type == :nil
39
- end
40
-
41
- def signature
42
- @signature ||= resolve_node_signature(assignment_node)
43
- end
44
-
45
- def calculated_signature
46
- if @calculated_signature.nil?
47
- if signature.empty?
48
- type = infer_literal_node_type(assignment_node)
49
- @calculated_signature = "#{type}.new" unless type.nil?
50
- end
51
- @calculated_signature ||= signature
52
- end
53
- @calculated_signature
54
- end
55
-
56
- # @param api_map [Solargraph::ApiMap]
57
- def resolve api_map
58
- if return_type.nil? and !@tried_to_resolve_return_type
59
- @tried_to_detect_return_type = true
60
- return nil if signature.nil? or signature.empty? or signature == name or signature.split('.').first.strip == name
61
- # @todo This should be able to resolve signatures that start with local variables
62
- macro_type = nil
63
- # pin = api_map.tail_pin(signature, namespace, :class, [:public, :private, :protected])
64
- # unless pin.nil? or !pin.method?
65
- # macro_type = get_return_type_from_macro(pin, assignment_node)
66
- # end
67
- @return_type = macro_type || api_map.infer_type(signature, namespace, scope: :class)
68
- end
36
+ return_type == 'NilClass'
69
37
  end
70
38
 
71
39
  def variable?
72
40
  true
73
41
  end
74
-
75
- private
76
-
77
- def get_call_arguments node
78
- return get_call_arguments(node.children[1]) if [:ivasgn, :cvasgn, :lvasgn].include?(node.type)
79
- return [] unless node.type == :send
80
- result = []
81
- node.children[2..-1].each do |c|
82
- result.push unpack_name(c)
83
- end
84
- result
85
- end
86
-
87
- def get_return_type_from_macro method_pin, call_node
88
- return nil if method_pin.docstring.nil?
89
- type = nil
90
- all = YARD::Docstring.parser.parse(method_pin.docstring.all).directives
91
- macro = all.select{|m| m.tag.tag_name == 'macro'}.first
92
- return nil if macro.nil?
93
- macstring = YARD::Docstring.parser.parse(macro.tag.text).to_docstring
94
- rt = macstring.tag(:return)
95
- unless rt.nil? or rt.types.nil?
96
- args = get_call_arguments(call_node)
97
- type = "#{args[rt.types[0][1..-1].to_i-1]}"
98
- end
99
- type
100
- end
101
42
  end
102
43
  end
103
44
  end
@@ -0,0 +1,21 @@
1
+ module Solargraph
2
+ module Pin
3
+ class Block < Base
4
+ attr_reader :receiver
5
+ attr_reader :parameters
6
+
7
+ def initialize location, namespace, name, docstring, receiver
8
+ super(location, namespace, name, docstring)
9
+ @receiver = receiver
10
+ end
11
+
12
+ def kind
13
+ Pin::BLOCK
14
+ end
15
+
16
+ def parameters
17
+ @parameters ||= []
18
+ end
19
+ end
20
+ end
21
+ end