language_server 0.9.0 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +1 -0
- data/.rubocop.yml +45 -0
- data/CHANGELOG.md +5 -0
- data/Dockerfile +2 -0
- data/Dockerfile.development +1 -1
- data/Gemfile +4 -1
- data/Guardfile +1 -1
- data/README.md +2 -0
- data/Rakefile +1 -1
- data/benchmark/rubocop +25 -0
- data/benchmark/ruby_wc +3 -3
- data/bin/ci +7 -0
- data/bin/rubocop +17 -0
- data/circle.yml +10 -2
- data/exe/language_server-ruby +23 -1
- data/language_server.gemspec +13 -14
- data/lib/language_server.rb +42 -25
- data/lib/language_server/completion_provider/ad_hoc.rb +7 -7
- data/lib/language_server/completion_provider/rcodetools.rb +4 -4
- data/lib/language_server/definition_provider/ad_hoc.rb +5 -5
- data/lib/language_server/file_store.rb +21 -21
- data/lib/language_server/linter/rubocop.rb +16 -18
- data/lib/language_server/linter/ruby_wc.rb +48 -37
- data/lib/language_server/logger.rb +12 -12
- data/lib/language_server/project.rb +34 -34
- data/lib/language_server/project/node.rb +15 -12
- data/lib/language_server/project/parser.rb +54 -54
- data/lib/language_server/version.rb +1 -1
- metadata +44 -54
@@ -6,12 +6,10 @@ module LanguageServer
|
|
6
6
|
attr_accessor(*attrs)
|
7
7
|
attribute_names.concat(attrs)
|
8
8
|
class_eval <<-RUBY, __FILE__, __LINE__
|
9
|
-
def initialize(#{attribute_names.map {|n| "#{n}:" }.join(
|
10
|
-
#{
|
11
|
-
attribute_names.map {|n|
|
9
|
+
def initialize(#{attribute_names.map { |n| "#{n}:" }.join(",")})
|
10
|
+
#{attribute_names.map { |n|
|
12
11
|
"@#{n} = #{n}"
|
13
|
-
}.join("\n")
|
14
|
-
}
|
12
|
+
}.join("\n")}
|
15
13
|
end
|
16
14
|
RUBY
|
17
15
|
end
|
@@ -23,8 +21,13 @@ end
|
|
23
21
|
|
24
22
|
attributes :lineno, :character, :path
|
25
23
|
|
26
|
-
def remote_path
|
27
|
-
|
24
|
+
def remote_path
|
25
|
+
path.remote_path
|
26
|
+
end
|
27
|
+
|
28
|
+
def local_path
|
29
|
+
path.local_path
|
30
|
+
end
|
28
31
|
|
29
32
|
def eql?(other)
|
30
33
|
other.instance_of?(self.class) && attributes == other.attributes
|
@@ -39,7 +42,7 @@ end
|
|
39
42
|
end
|
40
43
|
|
41
44
|
def attributes
|
42
|
-
self.class.attribute_names.map {|a|
|
45
|
+
self.class.attribute_names.map { |a|
|
43
46
|
[a, public_send(a)]
|
44
47
|
}.to_h
|
45
48
|
end
|
@@ -57,7 +60,7 @@ end
|
|
57
60
|
end
|
58
61
|
|
59
62
|
def full_name
|
60
|
-
names.join(
|
63
|
+
names.join("::")
|
61
64
|
end
|
62
65
|
end
|
63
66
|
|
@@ -68,7 +71,7 @@ end
|
|
68
71
|
class Module < Node
|
69
72
|
attributes :constant, :children
|
70
73
|
|
71
|
-
%i
|
74
|
+
%i[name namespaces full_name names].each do |m|
|
72
75
|
define_method(m) { constant.__send__(m) }
|
73
76
|
end
|
74
77
|
|
@@ -117,7 +120,7 @@ end
|
|
117
120
|
end
|
118
121
|
|
119
122
|
def full_name
|
120
|
-
names.join(
|
123
|
+
names.join("::")
|
121
124
|
end
|
122
125
|
|
123
126
|
def inspect
|
@@ -149,7 +152,7 @@ end
|
|
149
152
|
end
|
150
153
|
|
151
154
|
def full_name
|
152
|
-
names.join(
|
155
|
+
names.join("::")
|
153
156
|
end
|
154
157
|
|
155
158
|
def inspect
|
@@ -1,5 +1,5 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require "language_server/project/node"
|
2
|
+
require "ripper"
|
3
3
|
|
4
4
|
module LanguageServer
|
5
5
|
class Project
|
@@ -32,79 +32,79 @@ module LanguageServer
|
|
32
32
|
|
33
33
|
private
|
34
34
|
|
35
|
-
|
35
|
+
alias_method :character, :column
|
36
36
|
|
37
|
-
|
37
|
+
attr_reader :path
|
38
38
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
39
|
+
def lineno
|
40
|
+
# Language Server Protocol's lineno is zero origin
|
41
|
+
super - 1
|
42
|
+
end
|
43
43
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
44
|
+
def on_var_ref(node)
|
45
|
+
if node.instance_of?(Constant)
|
46
|
+
build_node(VarRef, node: node).tap do |n|
|
47
|
+
result.refs << n
|
48
|
+
end
|
49
|
+
else
|
50
|
+
node
|
48
51
|
end
|
49
|
-
else
|
50
|
-
node
|
51
52
|
end
|
52
|
-
end
|
53
53
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
54
|
+
def on_const_path_ref(*nodes)
|
55
|
+
if nodes.all? { |n| [Constant, ConstPathRef, VarRef].include?(n.class) }
|
56
|
+
build_node(ConstPathRef, nodes: nodes).tap do |n|
|
57
|
+
result.refs << n
|
58
|
+
end
|
59
|
+
else
|
60
|
+
nodes
|
58
61
|
end
|
59
|
-
else
|
60
|
-
nodes
|
61
62
|
end
|
62
|
-
end
|
63
63
|
|
64
|
-
|
65
|
-
|
66
|
-
|
64
|
+
def on_const(name)
|
65
|
+
build_node(Constant, namespaces: [], name: name, value: nil)
|
66
|
+
end
|
67
67
|
|
68
|
-
|
69
|
-
|
70
|
-
|
68
|
+
def on_def(*args)
|
69
|
+
args.flatten.compact
|
70
|
+
end
|
71
71
|
|
72
|
-
|
73
|
-
|
74
|
-
|
72
|
+
def on_int(value)
|
73
|
+
build_node(LiteralValue, value: value.to_i)
|
74
|
+
end
|
75
75
|
|
76
|
-
|
77
|
-
|
78
|
-
|
76
|
+
def on_stmts_add(*args)
|
77
|
+
args.flatten.compact
|
78
|
+
end
|
79
79
|
|
80
|
-
|
81
|
-
|
80
|
+
def on_assign(left, right)
|
81
|
+
result.constants << left if left.instance_of?(Constant)
|
82
82
|
|
83
|
-
|
84
|
-
|
85
|
-
|
83
|
+
left.value = right if left.respond_to?(:value) # TODO: remove this condition
|
84
|
+
left
|
85
|
+
end
|
86
86
|
|
87
|
-
|
88
|
-
|
87
|
+
def on_module(constant, children)
|
88
|
+
cn = children.select { |child| child.respond_to?(:unshift_namespace) }
|
89
89
|
|
90
|
-
|
91
|
-
|
92
|
-
|
90
|
+
build_node(Module, constant: constant, children: cn).tap do |m|
|
91
|
+
result.modules << m
|
92
|
+
cn.each { |child| child.unshift_namespace(m) }
|
93
|
+
end
|
93
94
|
end
|
94
|
-
end
|
95
95
|
|
96
|
-
|
97
|
-
|
96
|
+
def on_class(constant, superclass, children)
|
97
|
+
cn = children.select { |child| child.respond_to?(:unshift_namespace) }
|
98
98
|
|
99
|
-
|
100
|
-
|
101
|
-
|
99
|
+
build_node(Class, constant: constant, superclass: superclass, children: cn).tap do |c|
|
100
|
+
result.classes << c
|
101
|
+
cn.each { |child| child.unshift_namespace(c) }
|
102
|
+
end
|
102
103
|
end
|
103
|
-
end
|
104
104
|
|
105
|
-
|
106
|
-
|
107
|
-
|
105
|
+
def build_node(klass, **args)
|
106
|
+
klass.new({ lineno: lineno, character: character, path: path }.merge(args))
|
107
|
+
end
|
108
108
|
end
|
109
109
|
end
|
110
110
|
end
|
metadata
CHANGED
@@ -1,29 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: language_server
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fumiaki MATSUSHIMA
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-11-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: rcodetools
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ">="
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ">="
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: language_server-protocol
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -39,63 +25,63 @@ dependencies:
|
|
39
25
|
- !ruby/object:Gem::Version
|
40
26
|
version: 0.4.0
|
41
27
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
28
|
+
name: rcodetools
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
44
30
|
requirements:
|
45
|
-
- - "
|
31
|
+
- - ">="
|
46
32
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
48
|
-
type: :
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
49
35
|
prerelease: false
|
50
36
|
version_requirements: !ruby/object:Gem::Requirement
|
51
37
|
requirements:
|
52
|
-
- - "
|
38
|
+
- - ">="
|
53
39
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
40
|
+
version: '0'
|
55
41
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
42
|
+
name: awesome_print
|
57
43
|
requirement: !ruby/object:Gem::Requirement
|
58
44
|
requirements:
|
59
|
-
- - "
|
45
|
+
- - ">="
|
60
46
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
47
|
+
version: '0'
|
62
48
|
type: :development
|
63
49
|
prerelease: false
|
64
50
|
version_requirements: !ruby/object:Gem::Requirement
|
65
51
|
requirements:
|
66
|
-
- - "
|
52
|
+
- - ">="
|
67
53
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
54
|
+
version: '0'
|
69
55
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
56
|
+
name: benchmark-ips
|
71
57
|
requirement: !ruby/object:Gem::Requirement
|
72
58
|
requirements:
|
73
|
-
- - "
|
59
|
+
- - ">="
|
74
60
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
61
|
+
version: '0'
|
76
62
|
type: :development
|
77
63
|
prerelease: false
|
78
64
|
version_requirements: !ruby/object:Gem::Requirement
|
79
65
|
requirements:
|
80
|
-
- - "
|
66
|
+
- - ">="
|
81
67
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
68
|
+
version: '0'
|
83
69
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
70
|
+
name: bundler
|
85
71
|
requirement: !ruby/object:Gem::Requirement
|
86
72
|
requirements:
|
87
|
-
- - "
|
73
|
+
- - "~>"
|
88
74
|
- !ruby/object:Gem::Version
|
89
|
-
version: '
|
75
|
+
version: '1.14'
|
90
76
|
type: :development
|
91
77
|
prerelease: false
|
92
78
|
version_requirements: !ruby/object:Gem::Requirement
|
93
79
|
requirements:
|
94
|
-
- - "
|
80
|
+
- - "~>"
|
95
81
|
- !ruby/object:Gem::Version
|
96
|
-
version: '
|
82
|
+
version: '1.14'
|
97
83
|
- !ruby/object:Gem::Dependency
|
98
|
-
name: guard
|
84
|
+
name: guard
|
99
85
|
requirement: !ruby/object:Gem::Requirement
|
100
86
|
requirements:
|
101
87
|
- - ">="
|
@@ -109,7 +95,7 @@ dependencies:
|
|
109
95
|
- !ruby/object:Gem::Version
|
110
96
|
version: '0'
|
111
97
|
- !ruby/object:Gem::Dependency
|
112
|
-
name: minitest
|
98
|
+
name: guard-minitest
|
113
99
|
requirement: !ruby/object:Gem::Requirement
|
114
100
|
requirements:
|
115
101
|
- - ">="
|
@@ -123,7 +109,7 @@ dependencies:
|
|
123
109
|
- !ruby/object:Gem::Version
|
124
110
|
version: '0'
|
125
111
|
- !ruby/object:Gem::Dependency
|
126
|
-
name:
|
112
|
+
name: m
|
127
113
|
requirement: !ruby/object:Gem::Requirement
|
128
114
|
requirements:
|
129
115
|
- - ">="
|
@@ -137,21 +123,21 @@ dependencies:
|
|
137
123
|
- !ruby/object:Gem::Version
|
138
124
|
version: '0'
|
139
125
|
- !ruby/object:Gem::Dependency
|
140
|
-
name: minitest
|
126
|
+
name: minitest
|
141
127
|
requirement: !ruby/object:Gem::Requirement
|
142
128
|
requirements:
|
143
|
-
- - "
|
129
|
+
- - "~>"
|
144
130
|
- !ruby/object:Gem::Version
|
145
|
-
version: '0'
|
131
|
+
version: '5.0'
|
146
132
|
type: :development
|
147
133
|
prerelease: false
|
148
134
|
version_requirements: !ruby/object:Gem::Requirement
|
149
135
|
requirements:
|
150
|
-
- - "
|
136
|
+
- - "~>"
|
151
137
|
- !ruby/object:Gem::Version
|
152
|
-
version: '0'
|
138
|
+
version: '5.0'
|
153
139
|
- !ruby/object:Gem::Dependency
|
154
|
-
name:
|
140
|
+
name: minitest-color
|
155
141
|
requirement: !ruby/object:Gem::Requirement
|
156
142
|
requirements:
|
157
143
|
- - ">="
|
@@ -165,7 +151,7 @@ dependencies:
|
|
165
151
|
- !ruby/object:Gem::Version
|
166
152
|
version: '0'
|
167
153
|
- !ruby/object:Gem::Dependency
|
168
|
-
name:
|
154
|
+
name: minitest-power_assert
|
169
155
|
requirement: !ruby/object:Gem::Requirement
|
170
156
|
requirements:
|
171
157
|
- - ">="
|
@@ -179,7 +165,7 @@ dependencies:
|
|
179
165
|
- !ruby/object:Gem::Version
|
180
166
|
version: '0'
|
181
167
|
- !ruby/object:Gem::Dependency
|
182
|
-
name:
|
168
|
+
name: pry-byebug
|
183
169
|
requirement: !ruby/object:Gem::Requirement
|
184
170
|
requirements:
|
185
171
|
- - ">="
|
@@ -193,19 +179,19 @@ dependencies:
|
|
193
179
|
- !ruby/object:Gem::Version
|
194
180
|
version: '0'
|
195
181
|
- !ruby/object:Gem::Dependency
|
196
|
-
name:
|
182
|
+
name: rake
|
197
183
|
requirement: !ruby/object:Gem::Requirement
|
198
184
|
requirements:
|
199
|
-
- - "
|
185
|
+
- - "~>"
|
200
186
|
- !ruby/object:Gem::Version
|
201
|
-
version: '
|
187
|
+
version: '12.2'
|
202
188
|
type: :development
|
203
189
|
prerelease: false
|
204
190
|
version_requirements: !ruby/object:Gem::Requirement
|
205
191
|
requirements:
|
206
|
-
- - "
|
192
|
+
- - "~>"
|
207
193
|
- !ruby/object:Gem::Version
|
208
|
-
version: '
|
194
|
+
version: '12.2'
|
209
195
|
description: A Ruby Language Server implementation
|
210
196
|
email:
|
211
197
|
- mtsmfm@gmail.com
|
@@ -216,6 +202,7 @@ extra_rdoc_files: []
|
|
216
202
|
files:
|
217
203
|
- ".dockerignore"
|
218
204
|
- ".gitignore"
|
205
|
+
- ".rubocop.yml"
|
219
206
|
- ".vscode/settings.json"
|
220
207
|
- CHANGELOG.md
|
221
208
|
- CODE_OF_CONDUCT.md
|
@@ -226,12 +213,15 @@ files:
|
|
226
213
|
- LICENSE.txt
|
227
214
|
- README.md
|
228
215
|
- Rakefile
|
216
|
+
- benchmark/rubocop
|
229
217
|
- benchmark/ruby_wc
|
230
218
|
- bin/_guard-core
|
219
|
+
- bin/ci
|
231
220
|
- bin/console
|
232
221
|
- bin/guard
|
233
222
|
- bin/language_server-ruby
|
234
223
|
- bin/m
|
224
|
+
- bin/rubocop
|
235
225
|
- bin/setup
|
236
226
|
- circle.yml
|
237
227
|
- docker-compose.ci.yml
|
@@ -272,7 +262,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
272
262
|
version: '0'
|
273
263
|
requirements: []
|
274
264
|
rubyforge_project:
|
275
|
-
rubygems_version: 2.
|
265
|
+
rubygems_version: 2.7.2
|
276
266
|
signing_key:
|
277
267
|
specification_version: 4
|
278
268
|
summary: A Ruby Language Server implementation
|