solargraph 0.18.3 → 0.19.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/solargraph/api_map/probe.rb +222 -0
- data/lib/solargraph/api_map/source_to_yard.rb +3 -3
- data/lib/solargraph/api_map/store.rb +135 -0
- data/lib/solargraph/api_map.rb +169 -609
- data/lib/solargraph/diagnostics/rubocop.rb +4 -4
- data/lib/solargraph/language_server/host.rb +53 -19
- data/lib/solargraph/language_server/message/extended/document.rb +1 -1
- data/lib/solargraph/language_server/message/extended/search.rb +1 -1
- data/lib/solargraph/language_server/message/method_not_found.rb +1 -1
- data/lib/solargraph/language_server/message/text_document/definition.rb +2 -15
- data/lib/solargraph/language_server/message/text_document/document_symbol.rb +2 -15
- data/lib/solargraph/language_server/message/workspace/workspace_symbol.rb +3 -15
- data/lib/solargraph/language_server/message_types.rb +10 -0
- data/lib/solargraph/language_server.rb +1 -0
- data/lib/solargraph/library.rb +8 -0
- data/lib/solargraph/node_methods.rb +6 -1
- data/lib/solargraph/page.rb +2 -1
- data/lib/solargraph/pin/attribute.rb +8 -12
- data/lib/solargraph/pin/base.rb +20 -95
- data/lib/solargraph/pin/base_variable.rb +15 -74
- data/lib/solargraph/pin/block.rb +21 -0
- data/lib/solargraph/pin/block_parameter.rb +30 -44
- data/lib/solargraph/pin/class_variable.rb +3 -0
- data/lib/solargraph/pin/constant.rb +4 -8
- data/lib/solargraph/pin/conversions.rb +4 -3
- data/lib/solargraph/pin/documenting.rb +27 -0
- data/lib/solargraph/pin/global_variable.rb +3 -0
- data/lib/solargraph/pin/instance_variable.rb +5 -4
- data/lib/solargraph/pin/local_variable.rb +8 -15
- data/lib/solargraph/pin/localized.rb +12 -0
- data/lib/solargraph/pin/method.rb +6 -67
- data/lib/solargraph/pin/method_parameter.rb +24 -11
- data/lib/solargraph/pin/namespace.rb +26 -35
- data/lib/solargraph/pin/reference.rb +15 -8
- data/lib/solargraph/pin/symbol.rb +34 -3
- data/lib/solargraph/pin/yard_object.rb +11 -4
- data/lib/solargraph/pin.rb +16 -2
- data/lib/solargraph/server.rb +2 -2
- data/lib/solargraph/source/change.rb +10 -13
- data/lib/solargraph/source/fragment.rb +42 -94
- data/lib/solargraph/source/location.rb +13 -0
- data/lib/solargraph/source/mapper.rb +426 -0
- data/lib/solargraph/source/position.rb +1 -0
- data/lib/solargraph/source/range.rb +11 -3
- data/lib/solargraph/source.rb +93 -284
- data/lib/solargraph/version.rb +1 -1
- data/lib/solargraph/views/_method.erb +59 -60
- data/lib/solargraph/views/_name_type_tag.erb +10 -0
- data/lib/solargraph/views/_namespace.erb +26 -26
- data/lib/solargraph/views/document.erb +23 -16
- data/lib/solargraph/views/layout.erb +38 -10
- data/lib/solargraph/views/search.erb +12 -11
- data/lib/solargraph/workspace/config.rb +27 -6
- data/lib/solargraph/workspace.rb +10 -2
- data/lib/solargraph.rb +10 -2
- data/lib/yard-solargraph.rb +3 -0
- metadata +25 -20
- data/lib/solargraph/pin/directed/attribute.rb +0 -20
- data/lib/solargraph/pin/directed/method.rb +0 -22
- data/lib/solargraph/pin/directed.rb +0 -9
- data/lib/solargraph/pin/parameter.rb +0 -23
@@ -1,56 +1,42 @@
|
|
1
1
|
module Solargraph
|
2
2
|
module Pin
|
3
|
-
class BlockParameter <
|
3
|
+
class BlockParameter < Base
|
4
|
+
include Localized
|
5
|
+
|
4
6
|
attr_reader :index
|
5
7
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
tags.each do |tag|
|
13
|
-
if tag.name == name and !tag.types.nil? and !tag.types.empty?
|
14
|
-
@return_type = tag.types[0]
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
8
|
+
attr_reader :block
|
9
|
+
|
10
|
+
def initialize location, namespace, name, docstring, block
|
11
|
+
super(location, namespace, name, docstring)
|
12
|
+
@block = block
|
13
|
+
@presence = block.location.range
|
18
14
|
end
|
19
15
|
|
20
|
-
|
21
|
-
|
22
|
-
return unless return_type.nil?
|
23
|
-
signature = resolve_node_signature(@tree[0].children[0])
|
24
|
-
# @todo Hardcoding :class scope might not be appropriate
|
25
|
-
# meth = api_map.infer_pin(signature, namespace, :class, [:public, :private, :protected], true)
|
26
|
-
meth = api_map.tail_pin(signature, namespace, :class, [:public, :private, :protected])
|
27
|
-
return nil if meth.nil?
|
28
|
-
if (Solargraph::CoreFills::METHODS_WITH_YIELDPARAM_SUBTYPES.include?(meth.path))
|
29
|
-
base = signature.split('.')[0..-2].join('.')
|
30
|
-
return nil if base.nil? or base.empty?
|
31
|
-
# @todo Maybe use a fragment so this picks up local variables
|
32
|
-
bmeth = api_map.tail_pin(base, namespace, :class, [:public, :private, :protected])
|
33
|
-
return nil if bmeth.nil?
|
34
|
-
subtypes = get_subtypes(bmeth.return_type)
|
35
|
-
@return_type = api_map.find_fully_qualified_namespace(subtypes[0], namespace)
|
36
|
-
else
|
37
|
-
unless meth.docstring.nil?
|
38
|
-
yps = meth.docstring.tags(:yieldparam)
|
39
|
-
unless yps[index].nil? or yps[index].types.nil? or yps[index].types.empty?
|
40
|
-
@return_type = yps[index].types[0]
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
16
|
+
def kind
|
17
|
+
Pin::BLOCK_PARAMETER
|
44
18
|
end
|
45
19
|
|
46
|
-
|
20
|
+
def completion_item_kind
|
21
|
+
Solargraph::LanguageServer::CompletionItemKinds::VARIABLE
|
22
|
+
end
|
23
|
+
|
24
|
+
def index
|
25
|
+
block.parameters.index(self)
|
26
|
+
end
|
47
27
|
|
48
|
-
def
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
28
|
+
def return_type
|
29
|
+
if @return_type.nil? and !block.docstring.nil?
|
30
|
+
found = nil
|
31
|
+
params = block.docstring.tags(:param)
|
32
|
+
params.each do |p|
|
33
|
+
next unless p.name == name
|
34
|
+
found = p
|
35
|
+
end
|
36
|
+
@return_type = found.types[0] unless found.nil? or found.types.nil?
|
37
|
+
end
|
38
|
+
@return_type
|
39
|
+
end
|
54
40
|
end
|
55
41
|
end
|
56
42
|
end
|
@@ -3,23 +3,19 @@ module Solargraph
|
|
3
3
|
class Constant < BaseVariable
|
4
4
|
attr_reader :visibility
|
5
5
|
|
6
|
-
def initialize
|
7
|
-
super(
|
6
|
+
def initialize location, namespace, name, docstring, signature, literal, context, visibility
|
7
|
+
super(location, namespace, name, docstring, signature, literal, context)
|
8
8
|
@visibility = visibility
|
9
9
|
end
|
10
10
|
|
11
|
-
def
|
12
|
-
|
11
|
+
def kind
|
12
|
+
Pin::CONSTANT
|
13
13
|
end
|
14
14
|
|
15
15
|
def completion_item_kind
|
16
16
|
Solargraph::LanguageServer::CompletionItemKinds::CONSTANT
|
17
17
|
end
|
18
18
|
|
19
|
-
def value
|
20
|
-
source.code_for(node.children[2])
|
21
|
-
end
|
22
|
-
|
23
19
|
def path
|
24
20
|
"#{namespace}::#{name}"
|
25
21
|
end
|
@@ -1,11 +1,12 @@
|
|
1
1
|
module Solargraph
|
2
2
|
module Pin
|
3
|
+
# @todo Move this stuff. It should be the responsibility of the language server.
|
3
4
|
module Conversions
|
4
5
|
# @return [Hash]
|
5
6
|
def completion_item
|
6
7
|
{
|
7
8
|
label: name,
|
8
|
-
kind:
|
9
|
+
kind: completion_item_kind,
|
9
10
|
detail: completion_item_detail,
|
10
11
|
data: {
|
11
12
|
path: path,
|
@@ -42,7 +43,7 @@ module Solargraph
|
|
42
43
|
# @return [Hash]
|
43
44
|
def signature_help
|
44
45
|
{
|
45
|
-
label: name + '(' +
|
46
|
+
label: name + '(' + parameters.join(', ') + ')',
|
46
47
|
documentation: documentation
|
47
48
|
}
|
48
49
|
end
|
@@ -51,7 +52,7 @@ module Solargraph
|
|
51
52
|
|
52
53
|
def completion_item_detail
|
53
54
|
detail = ''
|
54
|
-
detail += "(#{parameters.join(', ')}) " unless parameters.empty?
|
55
|
+
detail += "(#{parameters.join(', ')}) " unless kind != Pin::METHOD or parameters.empty?
|
55
56
|
detail += "=> #{return_type}" unless return_type.nil?
|
56
57
|
return nil if detail.empty?
|
57
58
|
detail
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Solargraph
|
2
|
+
module Pin
|
3
|
+
module Documenting
|
4
|
+
# @return [String]
|
5
|
+
def documentation
|
6
|
+
if @documentation.nil? and !docstring.nil?
|
7
|
+
@documentation = ReverseMarkdown.convert(helper.html_markup_rdoc(docstring), github_flavored: true)
|
8
|
+
@documentation.strip!
|
9
|
+
end
|
10
|
+
@documentation
|
11
|
+
end
|
12
|
+
|
13
|
+
# True if the suggestion has documentation.
|
14
|
+
# Useful for determining whether a client should resolve a suggestion's
|
15
|
+
# path to retrieve more information about it.
|
16
|
+
#
|
17
|
+
# @return [Boolean]
|
18
|
+
def has_doc?
|
19
|
+
!docstring.nil? and !docstring.all.empty?
|
20
|
+
end
|
21
|
+
|
22
|
+
def helper
|
23
|
+
@helper ||= Solargraph::Pin::Helper.new
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -1,11 +1,12 @@
|
|
1
1
|
module Solargraph
|
2
2
|
module Pin
|
3
3
|
class InstanceVariable < BaseVariable
|
4
|
-
|
4
|
+
def kind
|
5
|
+
Pin::INSTANCE_VARIABLE
|
6
|
+
end
|
5
7
|
|
6
|
-
def
|
7
|
-
|
8
|
-
@scope = scope
|
8
|
+
def scope
|
9
|
+
@scope ||= (context.kind == Pin::NAMESPACE ? :class : context.scope)
|
9
10
|
end
|
10
11
|
end
|
11
12
|
end
|
@@ -1,23 +1,16 @@
|
|
1
1
|
module Solargraph
|
2
2
|
module Pin
|
3
3
|
class LocalVariable < BaseVariable
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
end
|
11
|
-
end
|
4
|
+
include Localized
|
5
|
+
|
6
|
+
def initialize location, namespace, name, docstring, assignment, literal, context, block, presence
|
7
|
+
super(location, namespace, name, docstring, assignment, literal, context)
|
8
|
+
@block = block
|
9
|
+
@presence = presence
|
12
10
|
end
|
13
11
|
|
14
|
-
def
|
15
|
-
|
16
|
-
parents.each do |p|
|
17
|
-
return true if @tree[0] == p
|
18
|
-
return false if [:def, :defs, :class, :module].include?(p.type)
|
19
|
-
end
|
20
|
-
false
|
12
|
+
def kind
|
13
|
+
Pin::LOCAL_VARIABLE
|
21
14
|
end
|
22
15
|
end
|
23
16
|
end
|
@@ -3,20 +3,17 @@ module Solargraph
|
|
3
3
|
class Method < Base
|
4
4
|
attr_reader :scope
|
5
5
|
attr_reader :visibility
|
6
|
+
attr_reader :parameters
|
6
7
|
|
7
|
-
def initialize
|
8
|
-
super(
|
8
|
+
def initialize location, namespace, name, docstring, scope, visibility, args
|
9
|
+
super(location, namespace, name, docstring)
|
9
10
|
@scope = scope
|
10
11
|
@visibility = visibility
|
11
|
-
|
12
|
-
if name == 'initialize' and scope == :instance
|
13
|
-
@visibility = :private
|
14
|
-
end
|
15
|
-
@fully_resolved = false
|
12
|
+
@parameters = args
|
16
13
|
end
|
17
14
|
|
18
|
-
def
|
19
|
-
|
15
|
+
def kind
|
16
|
+
Solargraph::Pin::METHOD
|
20
17
|
end
|
21
18
|
|
22
19
|
def path
|
@@ -39,10 +36,6 @@ module Solargraph
|
|
39
36
|
@return_type
|
40
37
|
end
|
41
38
|
|
42
|
-
def parameters
|
43
|
-
@parameters ||= get_method_args
|
44
|
-
end
|
45
|
-
|
46
39
|
def documentation
|
47
40
|
if @documentation.nil?
|
48
41
|
@documentation ||= super || ''
|
@@ -83,60 +76,6 @@ module Solargraph
|
|
83
76
|
end
|
84
77
|
@params
|
85
78
|
end
|
86
|
-
|
87
|
-
def resolve api_map
|
88
|
-
if return_type.nil?
|
89
|
-
sc = api_map.superclass_of(namespace)
|
90
|
-
until sc.nil?
|
91
|
-
sc_path = "#{sc}#{scope == :instance ? '#' : '.'}#{name}"
|
92
|
-
sugg = api_map.get_path_suggestions(sc_path).first
|
93
|
-
break if sugg.nil?
|
94
|
-
@return_type = api_map.find_fully_qualified_namespace(sugg.return_type, sugg.namespace) unless sugg.return_type.nil?
|
95
|
-
break unless @return_type.nil?
|
96
|
-
sc = api_map.superclass_of(sc)
|
97
|
-
end
|
98
|
-
end
|
99
|
-
unless return_type.nil? or @fully_resolved
|
100
|
-
@fully_resolved = true
|
101
|
-
@return_type = api_map.find_fully_qualified_namespace(@return_type, namespace)
|
102
|
-
end
|
103
|
-
end
|
104
|
-
|
105
|
-
def method?
|
106
|
-
true
|
107
|
-
end
|
108
|
-
|
109
|
-
private
|
110
|
-
|
111
|
-
# @return [Array<String>]
|
112
|
-
def get_method_args
|
113
|
-
return [] if node.nil?
|
114
|
-
list = nil
|
115
|
-
args = []
|
116
|
-
node.children.each { |c|
|
117
|
-
if c.kind_of?(AST::Node) and c.type == :args
|
118
|
-
list = c
|
119
|
-
break
|
120
|
-
end
|
121
|
-
}
|
122
|
-
return args if list.nil?
|
123
|
-
list.children.each { |c|
|
124
|
-
if c.type == :arg
|
125
|
-
args.push c.children[0].to_s
|
126
|
-
elsif c.type == :restarg
|
127
|
-
args.push "*#{c.children[0]}"
|
128
|
-
elsif c.type == :optarg
|
129
|
-
args.push "#{c.children[0]} = #{source.code_for(c.children[1])}"
|
130
|
-
elsif c.type == :kwarg
|
131
|
-
args.push "#{c.children[0]}:"
|
132
|
-
elsif c.type == :kwoptarg
|
133
|
-
args.push "#{c.children[0]}: #{source.code_for(c.children[1])}"
|
134
|
-
elsif c.type == :blockarg
|
135
|
-
args.push "&#{c.children[0]}"
|
136
|
-
end
|
137
|
-
}
|
138
|
-
args
|
139
|
-
end
|
140
79
|
end
|
141
80
|
end
|
142
81
|
end
|
@@ -1,18 +1,31 @@
|
|
1
1
|
module Solargraph
|
2
2
|
module Pin
|
3
|
-
class MethodParameter <
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
3
|
+
class MethodParameter < Base
|
4
|
+
include Localized
|
5
|
+
|
6
|
+
attr_reader :block
|
7
|
+
|
8
|
+
def initialize location, namespace, name, docstring, block
|
9
|
+
super(location, namespace, name, docstring)
|
10
|
+
@block = block
|
11
|
+
@presence = block.location.range
|
12
|
+
end
|
13
|
+
|
14
|
+
def completion_item_kind
|
15
|
+
Solargraph::LanguageServer::CompletionItemKinds::VARIABLE
|
16
|
+
end
|
17
|
+
|
18
|
+
def return_type
|
19
|
+
if @return_type.nil? and !block.docstring.nil?
|
20
|
+
found = nil
|
21
|
+
params = block.docstring.tags(:param)
|
22
|
+
params.each do |p|
|
23
|
+
next unless p.name == name
|
24
|
+
found = p
|
14
25
|
end
|
26
|
+
@return_type = found.types[0] unless found.nil? or found.types.nil?
|
15
27
|
end
|
28
|
+
@return_type
|
16
29
|
end
|
17
30
|
end
|
18
31
|
end
|
@@ -5,60 +5,51 @@ module Solargraph
|
|
5
5
|
|
6
6
|
attr_reader :visibility
|
7
7
|
|
8
|
-
|
9
|
-
super(source, node, namespace)
|
10
|
-
@visibility = visibility
|
11
|
-
@superclass_reference = Reference.new(self, superclass) unless superclass.nil?
|
12
|
-
end
|
13
|
-
|
14
|
-
def reference_include name
|
15
|
-
include_references.push Reference.new(self, name)
|
16
|
-
end
|
17
|
-
|
18
|
-
def reference_extend name
|
19
|
-
extend_references.push Reference.new(self, name)
|
20
|
-
end
|
8
|
+
attr_reader :type
|
21
9
|
|
22
|
-
|
23
|
-
|
24
|
-
end
|
25
|
-
|
26
|
-
def name
|
27
|
-
@name ||= (node.type == :source ? '' : pack_name(node.children[0]).last.to_s)
|
28
|
-
end
|
29
|
-
|
30
|
-
def path
|
31
|
-
@path ||= (namespace.empty? ? '' : "#{namespace}::") + name
|
32
|
-
end
|
10
|
+
# @return [Pin::Reference]
|
11
|
+
attr_reader :superclass_reference
|
33
12
|
|
34
|
-
def
|
35
|
-
|
13
|
+
def initialize location, namespace, name, docstring, type, visibility, superclass
|
14
|
+
super(location, namespace, name, docstring)
|
15
|
+
@type = type
|
16
|
+
@visibility = visibility
|
17
|
+
# @superclass_reference = Reference.new(self, superclass) unless superclass.nil?
|
18
|
+
@superclass_reference = Pin::Reference.new(location, namespace, superclass) unless superclass.nil?
|
36
19
|
end
|
37
20
|
|
21
|
+
# @return [Array<Pin::Reference>]
|
38
22
|
def include_references
|
39
23
|
@include_references ||= []
|
40
24
|
end
|
41
25
|
|
26
|
+
# @return [Array<String>]
|
42
27
|
def extend_references
|
43
28
|
@extend_references ||= []
|
44
29
|
end
|
45
30
|
|
46
|
-
def
|
47
|
-
|
31
|
+
def kind
|
32
|
+
Pin::NAMESPACE
|
33
|
+
end
|
34
|
+
|
35
|
+
def named_context
|
36
|
+
path
|
48
37
|
end
|
49
38
|
|
50
|
-
|
51
|
-
|
52
|
-
node.type
|
39
|
+
def scope
|
40
|
+
:class
|
53
41
|
end
|
54
42
|
|
55
|
-
def
|
56
|
-
|
57
|
-
|
43
|
+
def completion_item_kind
|
44
|
+
(type == :class ? LanguageServer::CompletionItemKinds::CLASS : LanguageServer::CompletionItemKinds::MODULE)
|
45
|
+
end
|
46
|
+
|
47
|
+
def path
|
48
|
+
@path ||= (namespace.empty? ? '' : "#{namespace}::") + name
|
58
49
|
end
|
59
50
|
|
60
51
|
def return_type
|
61
|
-
@return_type ||= (
|
52
|
+
@return_type ||= (type == :class ? 'Class' : 'Module') + "<#{path}>"
|
62
53
|
end
|
63
54
|
end
|
64
55
|
end
|
@@ -1,20 +1,27 @@
|
|
1
1
|
module Solargraph
|
2
2
|
module Pin
|
3
3
|
class Reference
|
4
|
-
|
4
|
+
# @return [Source::Location]
|
5
|
+
attr_reader :location
|
6
|
+
|
7
|
+
# @return [String]
|
8
|
+
attr_reader :namespace
|
9
|
+
|
10
|
+
# @return [String]
|
5
11
|
attr_reader :name
|
6
12
|
|
7
|
-
def initialize
|
8
|
-
@
|
13
|
+
def initialize location, namespace, name
|
14
|
+
@location = location
|
15
|
+
@namespace = namespace
|
9
16
|
@name = name
|
10
|
-
@resolved = false
|
11
17
|
end
|
12
18
|
|
19
|
+
# @todo Deprecaate
|
13
20
|
def resolve api_map
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
21
|
+
end
|
22
|
+
|
23
|
+
def filename
|
24
|
+
location.filename
|
18
25
|
end
|
19
26
|
end
|
20
27
|
end
|
@@ -1,8 +1,39 @@
|
|
1
1
|
module Solargraph
|
2
2
|
module Pin
|
3
|
-
class Symbol
|
4
|
-
|
5
|
-
|
3
|
+
class Symbol
|
4
|
+
include Conversions
|
5
|
+
|
6
|
+
attr_reader :location
|
7
|
+
|
8
|
+
attr_reader :name
|
9
|
+
|
10
|
+
def initialize location, name
|
11
|
+
@name = name
|
12
|
+
@location = location
|
13
|
+
end
|
14
|
+
|
15
|
+
def filename
|
16
|
+
location.filename
|
17
|
+
end
|
18
|
+
|
19
|
+
def kind
|
20
|
+
Pin::SYMBOL
|
21
|
+
end
|
22
|
+
|
23
|
+
def path
|
24
|
+
nil
|
25
|
+
end
|
26
|
+
|
27
|
+
def identifier
|
28
|
+
name
|
29
|
+
end
|
30
|
+
|
31
|
+
def completion_item_kind
|
32
|
+
Solargraph::LanguageServer::CompletionItemKinds::KEYWORD
|
33
|
+
end
|
34
|
+
|
35
|
+
def return_type
|
36
|
+
'Symbol'
|
6
37
|
end
|
7
38
|
end
|
8
39
|
end
|
@@ -8,6 +8,13 @@ module Solargraph
|
|
8
8
|
YARD::CodeObjects::ConstantObject => Solargraph::LanguageServer::CompletionItemKinds::CONSTANT
|
9
9
|
}
|
10
10
|
|
11
|
+
KIND_MAP = {
|
12
|
+
YARD::CodeObjects::ClassObject => Pin::NAMESPACE,
|
13
|
+
YARD::CodeObjects::ModuleObject => Pin::NAMESPACE,
|
14
|
+
YARD::CodeObjects::MethodObject => Pin::METHOD,
|
15
|
+
YARD::CodeObjects::ConstantObject => Pin::CONSTANT
|
16
|
+
}
|
17
|
+
|
11
18
|
# @return [YARD::CodeObjects::Base]
|
12
19
|
attr_reader :code_object
|
13
20
|
|
@@ -22,6 +29,10 @@ module Solargraph
|
|
22
29
|
@name ||= code_object.name.to_s
|
23
30
|
end
|
24
31
|
|
32
|
+
def kind
|
33
|
+
@kind ||= KIND_MAP[code_object.class] || Pin::KEYWORD
|
34
|
+
end
|
35
|
+
|
25
36
|
def completion_item_kind
|
26
37
|
@completion_item_kind ||= COMPLETION_ITEM_KIND_MAP[code_object.class] || Solargraph::LanguageServer::CompletionItemKinds::KEYWORD
|
27
38
|
end
|
@@ -77,10 +88,6 @@ module Solargraph
|
|
77
88
|
@parameters ||= get_method_args
|
78
89
|
end
|
79
90
|
|
80
|
-
def method?
|
81
|
-
completion_item_kind == Solargraph::LanguageServer::CompletionItemKinds::METHOD
|
82
|
-
end
|
83
|
-
|
84
91
|
def visibility
|
85
92
|
:public #@todo Resolve this
|
86
93
|
end
|
data/lib/solargraph/pin.rb
CHANGED
@@ -12,13 +12,27 @@ module Solargraph
|
|
12
12
|
autoload :GlobalVariable, 'solargraph/pin/global_variable'
|
13
13
|
autoload :Constant, 'solargraph/pin/constant'
|
14
14
|
autoload :Symbol, 'solargraph/pin/symbol'
|
15
|
-
autoload :Directed, 'solargraph/pin/directed'
|
16
15
|
autoload :Namespace, 'solargraph/pin/namespace'
|
17
16
|
autoload :YardObject, 'solargraph/pin/yard_object'
|
18
17
|
autoload :Keyword, 'solargraph/pin/keyword'
|
19
|
-
autoload :Parameter, 'solargraph/pin/parameter'
|
20
18
|
autoload :MethodParameter, 'solargraph/pin/method_parameter'
|
21
19
|
autoload :BlockParameter, 'solargraph/pin/block_parameter'
|
22
20
|
autoload :Reference, 'solargraph/pin/reference'
|
21
|
+
autoload :Documenting, 'solargraph/pin/documenting'
|
22
|
+
autoload :Block, 'solargraph/pin/block'
|
23
|
+
autoload :Localized, 'solargraph/pin/localized'
|
24
|
+
|
25
|
+
ATTRIBUTE = 1
|
26
|
+
CLASS_VARIABLE = 2
|
27
|
+
CONSTANT = 3
|
28
|
+
GLOBAL_VARIABLE = 4
|
29
|
+
INSTANCE_VARIABLE = 5
|
30
|
+
KEYWORD = 6
|
31
|
+
LOCAL_VARIABLE = 7
|
32
|
+
METHOD = 8
|
33
|
+
NAMESPACE = 9
|
34
|
+
SYMBOL = 10
|
35
|
+
BLOCK = 11
|
36
|
+
BLOCK_PARAMETER = 12
|
23
37
|
end
|
24
38
|
end
|
data/lib/solargraph/server.rb
CHANGED
@@ -161,12 +161,12 @@ module Solargraph
|
|
161
161
|
|
162
162
|
get '/search' do
|
163
163
|
@results = @@library.search(params['query'])
|
164
|
-
erb :search
|
164
|
+
erb :search, locals: { query: params['query'], results: @results }
|
165
165
|
end
|
166
166
|
|
167
167
|
get '/document' do
|
168
168
|
@objects = @@library.document(params['query'])
|
169
|
-
erb :document
|
169
|
+
erb :document, locals: { objects: @objects }
|
170
170
|
end
|
171
171
|
|
172
172
|
def htmlify text
|