solargraph 0.8.2 → 0.8.3
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.
- checksums.yaml +4 -4
- data/lib/solargraph/api_map.rb +14 -11
- data/lib/solargraph/code_map.rb +5 -4
- data/lib/solargraph/suggestion.rb +2 -0
- data/lib/solargraph/version.rb +1 -1
- data/lib/solargraph/yard_map.rb +4 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e52db6d5b84e35fa182015ad0178c8fde5433534
|
4
|
+
data.tar.gz: 4cb0dbfa89392f8fb4b9b04b506114d1b975fcb9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9f4d6d1f77fb88afb992b1a32eb12e017f74a310e090c0b275d4f5d6546313455c7e5d9230322007d1e15acc9686bc88f744e3cb18512b2ba6be5d356adb147e
|
7
|
+
data.tar.gz: 74cd777945f475843b629de0613cd10949b9aed887a30f5a1423825bac943df4c4491f9caf98b8d3f231df12f22a4e09cb6c62836cc5047003a4a665a2f5a8fd
|
data/lib/solargraph/api_map.rb
CHANGED
@@ -10,7 +10,7 @@ module Solargraph
|
|
10
10
|
'begin', 'break', 'case', 'class', 'def', 'defined?', 'do', 'else',
|
11
11
|
'elsif', 'end', 'ensure', 'false', 'for', 'if', 'in', 'module', 'next',
|
12
12
|
'nil', 'not', 'or', 'redo', 'rescue', 'retry', 'return', 'self', 'super',
|
13
|
-
'then', 'true', 'undef', 'unless', 'until', 'when', 'while', 'yield'
|
13
|
+
'then', 'true', 'undef', 'unless', 'until', 'when', 'while', 'yield'
|
14
14
|
]
|
15
15
|
|
16
16
|
MAPPABLE_METHODS = [
|
@@ -97,6 +97,7 @@ module Solargraph
|
|
97
97
|
@file_comments[filename][node.loc]
|
98
98
|
end
|
99
99
|
|
100
|
+
|
100
101
|
def self.get_keywords
|
101
102
|
result = []
|
102
103
|
keywords = KEYWORDS + ['attr_reader', 'attr_writer', 'attr_accessor', 'private', 'public', 'protected']
|
@@ -510,14 +511,16 @@ module Solargraph
|
|
510
511
|
docstring = get_comment_for(c)
|
511
512
|
label = "#{c.children[1]}"
|
512
513
|
args = get_method_args(c)
|
513
|
-
|
514
|
+
if (c.children[1].to_s[0].match(/[a-z_]/i) and c.children[1] != :def)
|
515
|
+
meths.push Suggestion.new(label, insert: c.children[1].to_s.gsub(/=/, ' = '), kind: Suggestion::METHOD, detail: 'Method', documentation: docstring, arguments: args)
|
516
|
+
end
|
514
517
|
elsif c.type == :send and c.children[1] == :include
|
515
518
|
# TODO: This might not be right. Should we be getting singleton methods
|
516
519
|
# from an include, or only from an extend?
|
517
520
|
i = unpack_name(c.children[2])
|
518
|
-
meths
|
521
|
+
meths.concat inner_get_methods(i, root, skip) unless i == 'Kernel'
|
519
522
|
else
|
520
|
-
meths
|
523
|
+
meths.concat inner_get_methods_from_node(c, root, skip)
|
521
524
|
end
|
522
525
|
end
|
523
526
|
}
|
@@ -554,16 +557,16 @@ module Solargraph
|
|
554
557
|
meths.push Suggestion.new(label, insert: c.children[0].to_s.gsub(/=/, ' = '), kind: Suggestion::METHOD, documentation: cmnt, detail: fqns, arguments: args) if c.children[0].to_s[0].match(/[a-z]/i)
|
555
558
|
elsif c.kind_of?(AST::Node) and c.type == :send and c.children[1] == :attr_reader
|
556
559
|
c.children[2..-1].each { |x|
|
557
|
-
meths.push Suggestion.new(x.children[0], kind: Suggestion::
|
560
|
+
meths.push Suggestion.new(x.children[0], kind: Suggestion::FIELD) if x.type == :sym
|
558
561
|
}
|
559
562
|
elsif c.kind_of?(AST::Node) and c.type == :send and c.children[1] == :attr_writer
|
560
563
|
c.children[2..-1].each { |x|
|
561
|
-
meths.push Suggestion.new("#{x.children[0]}=", kind: Suggestion::
|
564
|
+
meths.push Suggestion.new("#{x.children[0]}=", kind: Suggestion::FIELD) if x.type == :sym
|
562
565
|
}
|
563
566
|
elsif c.kind_of?(AST::Node) and c.type == :send and c.children[1] == :attr_accessor
|
564
567
|
c.children[2..-1].each { |x|
|
565
|
-
meths.push Suggestion.new(x.children[0], kind: Suggestion::
|
566
|
-
meths.push Suggestion.new("#{x.children[0]}=", kind: Suggestion::
|
568
|
+
meths.push Suggestion.new(x.children[0], kind: Suggestion::FIELD) if x.type == :sym
|
569
|
+
meths.push Suggestion.new("#{x.children[0]}=", kind: Suggestion::FIELD) if x.type == :sym
|
567
570
|
}
|
568
571
|
end
|
569
572
|
end
|
@@ -589,7 +592,7 @@ module Solargraph
|
|
589
592
|
false
|
590
593
|
end
|
591
594
|
end
|
592
|
-
|
595
|
+
|
593
596
|
def reduce node, comment_hash
|
594
597
|
return node unless node.kind_of?(AST::Node)
|
595
598
|
mappable = get_mappable_nodes(node.children, comment_hash)
|
@@ -680,7 +683,7 @@ module Solargraph
|
|
680
683
|
cursor = cursor[t.to_s]
|
681
684
|
}
|
682
685
|
end
|
683
|
-
|
686
|
+
|
684
687
|
def map_namespaces node, tree = []
|
685
688
|
if node.kind_of?(AST::Node)
|
686
689
|
if node.type == :class or node.type == :module
|
@@ -698,6 +701,6 @@ module Solargraph
|
|
698
701
|
map_namespaces c, tree
|
699
702
|
}
|
700
703
|
end
|
701
|
-
end
|
704
|
+
end
|
702
705
|
end
|
703
706
|
end
|
data/lib/solargraph/code_map.rb
CHANGED
@@ -181,7 +181,7 @@ module Solargraph
|
|
181
181
|
end
|
182
182
|
|
183
183
|
def suggest_at index, filtered: false, with_snippets: false
|
184
|
-
return [] if string_at?(index)
|
184
|
+
return [] if string_at?(index) or string_at?(index - 1)
|
185
185
|
result = []
|
186
186
|
phrase = phrase_at(index)
|
187
187
|
signature = get_signature_at(index)
|
@@ -213,7 +213,7 @@ module Solargraph
|
|
213
213
|
ns = parts[0..-2].join('::') + '::' + parts.last[0..parts.last.index('.')-1]
|
214
214
|
result = api_map.get_methods(ns)
|
215
215
|
else
|
216
|
-
result = api_map.namespaces_in(ns)
|
216
|
+
result = api_map.namespaces_in(ns, namespace)
|
217
217
|
end
|
218
218
|
else
|
219
219
|
current_namespace = namespace_at(index)
|
@@ -223,7 +223,7 @@ module Solargraph
|
|
223
223
|
result += ApiMap.get_keywords
|
224
224
|
while parts.length > 0
|
225
225
|
ns = parts.join('::')
|
226
|
-
result += api_map.namespaces_in(ns)
|
226
|
+
result += api_map.namespaces_in(ns, namespace)
|
227
227
|
parts.pop
|
228
228
|
end
|
229
229
|
result += api_map.namespaces_in('')
|
@@ -301,6 +301,7 @@ module Solargraph
|
|
301
301
|
parts = signature.split('.')
|
302
302
|
ns_here = namespace_from(node)
|
303
303
|
start = parts[0]
|
304
|
+
return nil if start.nil?
|
304
305
|
remainder = parts[1..-1]
|
305
306
|
scope = :instance
|
306
307
|
var = find_local_variable_node(start, node)
|
@@ -460,7 +461,7 @@ module Solargraph
|
|
460
461
|
args = node.children[1]
|
461
462
|
args.children.each do |arg|
|
462
463
|
name = arg.children[0].to_s
|
463
|
-
result.push Suggestion.new(name, kind: Suggestion::
|
464
|
+
result.push Suggestion.new(name, kind: Suggestion::PROPERTY, insert: name)
|
464
465
|
end
|
465
466
|
result
|
466
467
|
end
|
data/lib/solargraph/version.rb
CHANGED
data/lib/solargraph/yard_map.rb
CHANGED
@@ -148,7 +148,8 @@ module Solargraph
|
|
148
148
|
n = m.to_s.split(/[\.#]/).last.gsub(/=/, ' = ')
|
149
149
|
label = "#{n}"
|
150
150
|
args = get_method_args(m)
|
151
|
-
|
151
|
+
kind = (m.is_attribute? ? Suggestion::FIELD : Suggestion::METHOD)
|
152
|
+
meths.push Suggestion.new(label, insert: "#{n.gsub(/=/, ' = ')}", kind: kind, documentation: m.docstring, code_object: m, detail: "#{ns}", location: "#{m.file}:#{m.line}", arguments: args)
|
152
153
|
}
|
153
154
|
# Collect superclass methods
|
154
155
|
if ns.kind_of?(YARD::CodeObjects::ClassObject) and !ns.superclass.nil?
|
@@ -191,7 +192,8 @@ module Solargraph
|
|
191
192
|
if n.to_s.match(/^[a-z]/i) and (namespace == 'Kernel' or !m.to_s.start_with?('Kernel#')) and !m.docstring.to_s.include?(':nodoc:')
|
192
193
|
label = "#{n}"
|
193
194
|
args = get_method_args(m)
|
194
|
-
|
195
|
+
kind = (m.is_attribute? ? Suggestion::FIELD : Suggestion::METHOD)
|
196
|
+
meths.push Suggestion.new(label, insert: "#{n.gsub(/=/, ' = ')}", kind: kind, documentation: m.docstring, code_object: m, detail: m.namespace, location: "#{m.file}:#{m.line}", arguments: args)
|
195
197
|
end
|
196
198
|
}
|
197
199
|
if ns.kind_of?(YARD::CodeObjects::ClassObject) and namespace != 'Object'
|
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.8.
|
4
|
+
version: 0.8.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fred Snyder
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-06-
|
11
|
+
date: 2017-06-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: parser
|