solargraph 0.23.5 → 0.23.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9c281911d4b36b81d86b88a11979ee08e9c974cd10cbe83e1d07a03cf3f52185
4
- data.tar.gz: 65d1fe2602ac1ac9b9272aaf52a0a4772edd5897465b29d370ee6ebc15cedb44
3
+ metadata.gz: c5b6ac3cd79425340ddf486c9b3447115553a374a3c782d8c8a103825b4461b9
4
+ data.tar.gz: 4561568bb8075f955777c2a17a2a19a91c14b198df6c8f5798168b01abdeac19
5
5
  SHA512:
6
- metadata.gz: d1c5981b4b14c3651833ddc5589c8002ede7d7d690519ee70d8a8e82a59bbfaecdcd6576b0d6706b29d6d92bda3f1a5c990a23286114d81b84ec49b99ca9bb8e
7
- data.tar.gz: 0c75eb3da1835a7cd35ee8a594554ec0e6638c4afbe471aa27f05c7233df0841b47d5e313fb53d319b56af6fc46fd1876756dc9b8ace48476ca4e9353c23dba1
6
+ metadata.gz: 489953a5c791e8475b217b4033a502196a1d0aa0112f5d778ce2dba9ed488e773b867fb596ca02a1f81a6143b426d54007ab0448f979d1c9ad98344034fa96a1
7
+ data.tar.gz: 390e4c2bf98f7733232f551749114229afb6e4f7271ac1792e2034cd223de6e0b636ab001281ad225b7f8267b0a8e1e48e927be0a88bab63a4ded3c7779e3bc3
data/bin/solargraph CHANGED
File without changes
File without changes
data/lib/solargraph.rb CHANGED
File without changes
File without changes
@@ -48,7 +48,7 @@ module Solargraph
48
48
  def infer_signature_type signature, context_pin, locals
49
49
  pins = infer_signature_pins(signature, context_pin, locals)
50
50
  pins.each do |pin|
51
- return pin.return_type unless pin.return_type.nil?
51
+ return qualify(pin.return_type, pin.named_context) unless pin.return_type.nil?
52
52
  type = resolve_pin_type(pin, locals - [pin])
53
53
  return qualify(type, pin.named_context) unless type.nil?
54
54
  end
@@ -32,15 +32,10 @@ module Solargraph
32
32
  code_object_map[pin.path].instance_mixins.push code_object_map[ref.name] unless code_object_map[ref.name].nil? or code_object_map[pin.path].nil?
33
33
  end
34
34
  end
35
- s.attribute_pins.each do |pin|
36
- code_object_map[pin.path] ||= YARD::CodeObjects::MethodObject.new(code_object_at(pin.namespace), pin.name, :instance)
37
- code_object_map[pin.path].docstring = pin.docstring unless pin.docstring.nil?
38
- code_object_map[pin.path].files.push pin.location.filename
39
- #code_object_map[pin.path].parameters = []
40
- end
41
35
  s.method_pins.each do |pin|
42
36
  code_object_map[pin.path] ||= YARD::CodeObjects::MethodObject.new(code_object_at(pin.namespace), pin.name, pin.scope)
43
37
  code_object_map[pin.path].docstring = pin.docstring unless pin.docstring.nil?
38
+ code_object_map[pin.path].visibility = pin.visibility || :public
44
39
  code_object_map[pin.path].files.push pin.location.filename
45
40
  code_object_map[pin.path].parameters = pin.parameters.map do |p|
46
41
  n = p.match(/^[a-z0-9_]*:?/i)[0]
@@ -4,7 +4,11 @@ module Solargraph
4
4
  class Initialize < Base
5
5
  def process
6
6
  host.configure params['initializationOptions']
7
- host.prepare params['rootPath']
7
+ if params['rootUri']
8
+ host.prepare UriHelpers.uri_to_file(params['rootUri'])
9
+ else
10
+ host.prepare params['rootPath']
11
+ end
8
12
  result = {
9
13
  capabilities: {
10
14
  textDocumentSync: 2, # @todo What should this be?
@@ -4,7 +4,9 @@ module Solargraph
4
4
  module TextDocument
5
5
  class DidSave < Base
6
6
  def process
7
- host.save params
7
+ # @todo The server might not need to do anything in response to
8
+ # this notification. See https://github.com/castwide/solargraph/issues/73
9
+ # host.save params
8
10
  end
9
11
  end
10
12
  end
@@ -38,6 +38,11 @@ module Solargraph
38
38
  @return_type
39
39
  end
40
40
 
41
+ def visibility
42
+ # @todo Check attribute visibility
43
+ :public
44
+ end
45
+
41
46
  def parameters
42
47
  # Since attributes are generally equivalent to methods, treat
43
48
  # them as methods without parameters
@@ -42,7 +42,6 @@ module Solargraph
42
42
  end
43
43
 
44
44
  def return_type
45
- # @todo Get the return type
46
45
  if @return_type.nil?
47
46
  if code_object.kind_of?(YARD::CodeObjects::ClassObject)
48
47
  @return_type ||= "Class<#{path}>"
@@ -51,7 +50,7 @@ module Solargraph
51
50
  if code_object.kind_of?(YARD::CodeObjects::ModuleObject)
52
51
  @return_type ||= "Module<#{path}>"
53
52
  return @return_type
54
- end
53
+ end
55
54
  if Solargraph::CoreFills::CUSTOM_RETURN_TYPES.has_key?(path)
56
55
  @return_type = Solargraph::CoreFills::CUSTOM_RETURN_TYPES[path]
57
56
  else
File without changes
@@ -49,10 +49,13 @@ module Solargraph
49
49
 
50
50
  attr_reader :domains
51
51
 
52
+ # @return [Array<Solargraph::Pin::Base>]
52
53
  attr_reader :locals
53
54
 
54
55
  include NodeMethods
55
56
 
57
+ # @param code [String]
58
+ # @param filename [String]
56
59
  def initialize code, filename = nil
57
60
  begin
58
61
  @code = code
@@ -141,6 +144,7 @@ module Solargraph
141
144
  symbol_pins
142
145
  end
143
146
 
147
+ # @param name [String]
144
148
  # @return [Array<Source::Location>]
145
149
  def references name
146
150
  inner_node_references(name, node).map do |n|
@@ -202,19 +206,7 @@ module Solargraph
202
206
  stack
203
207
  end
204
208
 
205
- def inner_tree_at node, offset, stack
206
- return if node.nil?
207
- stack.unshift node
208
- node.children.each do |c|
209
- next unless c.is_a?(AST::Node)
210
- next if c.loc.expression.nil?
211
- if offset >= c.loc.expression.begin_pos and offset < c.loc.expression.end_pos
212
- inner_tree_at(c, offset, stack)
213
- break
214
- end
215
- end
216
- end
217
-
209
+ # @param updater [Source::Updater]
218
210
  def synchronize updater
219
211
  raise 'Invalid synchronization' unless updater.filename == filename
220
212
  original_code = @code
@@ -236,12 +228,15 @@ module Solargraph
236
228
  end
237
229
  end
238
230
 
231
+ # @param query [String]
232
+ # @return [Array<Solargraph::Pin::Base>]
239
233
  def query_symbols query
240
234
  return [] if query.empty?
241
235
  down = query.downcase
242
236
  all_symbols.select{|p| p.path.downcase.include?(down)}
243
237
  end
244
238
 
239
+ # @return [Array<Solargraph::Pin::Base>]
245
240
  def all_symbols
246
241
  @all_symbols ||= pins.select{ |pin|
247
242
  [Pin::ATTRIBUTE, Pin::CONSTANT, Pin::METHOD, Pin::NAMESPACE].include?(pin.kind) and !pin.name.empty?
@@ -286,6 +281,19 @@ module Solargraph
286
281
  result
287
282
  end
288
283
 
284
+ def inner_tree_at node, offset, stack
285
+ return if node.nil?
286
+ stack.unshift node
287
+ node.children.each do |c|
288
+ next unless c.is_a?(AST::Node)
289
+ next if c.loc.expression.nil?
290
+ if offset >= c.loc.expression.begin_pos and offset < c.loc.expression.end_pos
291
+ inner_tree_at(c, offset, stack)
292
+ break
293
+ end
294
+ end
295
+ end
296
+
289
297
  def parse
290
298
  node, comments = inner_parse(@fixed, filename)
291
299
  @node = node
@@ -318,12 +326,15 @@ module Solargraph
318
326
  end
319
327
 
320
328
  class << self
329
+ # @param filename [String]
321
330
  # @return [Solargraph::Source]
322
331
  def load filename
323
332
  code = File.read(filename)
324
333
  Source.load_string(code, filename)
325
334
  end
326
335
 
336
+ # @param code [String]
337
+ # @param filename [String]
327
338
  # @return [Solargraph::Source]
328
339
  def load_string code, filename = nil
329
340
  Source.new code, filename
@@ -319,7 +319,7 @@ module Solargraph
319
319
  brackets += 1
320
320
  elsif char == '['
321
321
  squares += 1
322
- signature = ".[]#{signature}" if squares == 0 and @code[index-2] != '%'
322
+ signature = ".[]#{signature}" if parens.zero? and brackets.zero? and squares.zero? and @code[index-2] != '%'
323
323
  end
324
324
  if brackets.zero? and parens.zero? and squares.zero?
325
325
  break if ['"', "'", ',', ';', '%'].include?(char)
@@ -1,3 +1,3 @@
1
1
  module Solargraph
2
- VERSION = '0.23.5'
2
+ VERSION = '0.23.6'
3
3
  end
File without changes
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solargraph
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.23.5
4
+ version: 0.23.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fred Snyder
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-07-16 00:00:00.000000000 Z
11
+ date: 2018-08-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parser
@@ -376,7 +376,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
376
376
  version: '0'
377
377
  requirements: []
378
378
  rubyforge_project:
379
- rubygems_version: 2.7.7
379
+ rubygems_version: 2.7.6
380
380
  signing_key:
381
381
  specification_version: 4
382
382
  summary: Solargraph for Ruby