ruby_language_server 0.2.2 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.txt +5 -0
- data/Gemfile.lock +1 -1
- data/Guardfile +1 -1
- data/lib/resources/fallback_rubocop.yml +1 -0
- data/lib/ruby_language_server/good_cop.rb +12 -7
- data/lib/ruby_language_server/project_manager.rb +20 -3
- data/lib/ruby_language_server/scope_data/variable.rb +1 -6
- data/lib/ruby_language_server/scope_parser.rb +10 -5
- data/lib/ruby_language_server/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 60974ac65c0aacc79f9908f9f5afc5dff607ec21122904782f5479a5b266b63a
|
4
|
+
data.tar.gz: cc93e7a695b0dd2d0fae15f9d40d54c7307b388e367773598a1ceb78892bd137
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 35be0584ef0e925aa4cbca2edcd82e015cf19012b969fad1cb1ecd628789ba3e6ca1e0c92991acd934574dc2d33e054141b49bcb73935d0068ed4216d2a58a57
|
7
|
+
data.tar.gz: e86ebb35b637cf6f49894e42720b7e4d46a2f4ec6f126faabe8ae045d9a46838cc3444f5b13c202910f0bfe45b4b836f3d088ec24c915098383797441a07ca04
|
data/CHANGELOG.txt
CHANGED
data/Gemfile.lock
CHANGED
data/Guardfile
CHANGED
@@ -29,7 +29,7 @@ guard :minitest, all_after_pass: true do
|
|
29
29
|
watch(%r{^spec/spec_helper\.rb$}) { 'spec' }
|
30
30
|
end
|
31
31
|
|
32
|
-
guard :rubocop, cli: [
|
32
|
+
guard :rubocop, cli: [] do
|
33
33
|
watch('.rubocop_ruby_language_parser.yml')
|
34
34
|
watch(/.+\.rb$/)
|
35
35
|
watch(%r{(?:.+/)?\.rubocop(?:_todo)?\.yml$}) { |m| File.dirname(m[0]) }
|
@@ -0,0 +1 @@
|
|
1
|
+
# This is a blank rubocop file just to have a handle to make rubocop happy
|
@@ -10,12 +10,8 @@ module RubyLanguageServer
|
|
10
10
|
def initialize
|
11
11
|
@initialization_error = nil
|
12
12
|
config_store = RuboCop::ConfigStore.new
|
13
|
-
|
14
|
-
|
15
|
-
CONFIG_PATH
|
16
|
-
else
|
17
|
-
FALLBACK_PATH
|
18
|
-
end
|
13
|
+
|
14
|
+
config_store.options_config = config_path
|
19
15
|
super({}, config_store)
|
20
16
|
rescue Exception => exception
|
21
17
|
RubyLanguageServer.logger.error(exception)
|
@@ -79,7 +75,7 @@ module RubyLanguageServer
|
|
79
75
|
when 'refactor', 'convention'
|
80
76
|
3
|
81
77
|
else
|
82
|
-
RubyLanguageServer.logger.
|
78
|
+
RubyLanguageServer.logger.error("Could not map severity for #{severity} - returning 2")
|
83
79
|
2
|
84
80
|
end
|
85
81
|
end
|
@@ -121,5 +117,14 @@ module RubyLanguageServer
|
|
121
117
|
}
|
122
118
|
]
|
123
119
|
end
|
120
|
+
|
121
|
+
def config_path
|
122
|
+
my_path = __FILE__
|
123
|
+
pathname = Pathname.new(my_path)
|
124
|
+
my_directory = pathname.dirname
|
125
|
+
fallback_pathname = my_directory + '../resources/fallback_rubocop.yml'
|
126
|
+
possible_config_paths = [RubyLanguageServer::ProjectManager.root_path, fallback_pathname.to_s]
|
127
|
+
possible_config_paths.detect { |path| File.exist?(path) }
|
128
|
+
end
|
124
129
|
end
|
125
130
|
end
|
@@ -8,9 +8,26 @@ module RubyLanguageServer
|
|
8
8
|
class ProjectManager
|
9
9
|
attr_reader :uri_code_file_hash
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
11
|
+
# GoodCop wants to know where to find its config. So here we are.
|
12
|
+
ROOT_PATH_MUTEX = Mutex.new
|
13
|
+
@_root_path = nil
|
14
|
+
|
15
|
+
class << self
|
16
|
+
def root_path=(path)
|
17
|
+
ROOT_PATH_MUTEX.synchronize do
|
18
|
+
@_root_path = path
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def root_path
|
23
|
+
@_root_path
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def initialize(path)
|
28
|
+
# Should probably lock for read, but I'm feeling crazy!
|
29
|
+
self.class.root_path = path if self.class.root_path.nil?
|
30
|
+
@root_uri = "file://#{path}"
|
14
31
|
# This is {uri: code_file} where content stuff is like
|
15
32
|
@uri_code_file_hash = {}
|
16
33
|
@update_mutext = Mutex.new
|
@@ -14,12 +14,7 @@ module RubyLanguageServer
|
|
14
14
|
@column = column
|
15
15
|
@full_name = [scope.full_name, @name].join(JoinHash[TYPE_VARIABLE])
|
16
16
|
@type = type
|
17
|
-
#
|
18
|
-
unless @name.instance_of? String
|
19
|
-
RubyLanguageServer.logger.error("@name is not a string! #{self}, #{scope.inspect}")
|
20
|
-
@name = @name.to_s
|
21
|
-
end
|
22
|
-
# rubocop:enable Style/GuardClause
|
17
|
+
raise "bogus variable #{inspect}" unless @name.instance_of? String
|
23
18
|
end
|
24
19
|
|
25
20
|
def constant?
|
@@ -130,10 +130,6 @@ module RubyLanguageServer
|
|
130
130
|
end
|
131
131
|
|
132
132
|
def on_block_var(args, rest)
|
133
|
-
(_, ((_, name, (line, column)))) = args
|
134
|
-
add_variable(name, line, column)
|
135
|
-
# blocks don't declare their first line in the parser
|
136
|
-
current_scope.top_line ||= line
|
137
133
|
process(args)
|
138
134
|
process(rest)
|
139
135
|
end
|
@@ -157,7 +153,14 @@ module RubyLanguageServer
|
|
157
153
|
# def self.something(par)...
|
158
154
|
# [:var_ref, [:@kw, "self", [28, 14]]], [[:@period, ".", [28, 18]], [:@ident, "something", [28, 19]], [:paren, [:params, [[:@ident, "par", [28, 23]]], nil, nil, nil, nil, nil, nil]], [:bodystmt, [[:assign, [:var_field, [:@ident, "pax", [29, 12]]], [:var_ref, [:@ident, "par", [29, 18]]]]], nil, nil, nil]]
|
159
155
|
def on_defs(args, rest)
|
160
|
-
on_def(rest[1], rest[2]) if args[1][1] == 'self' && rest[0][1] == '.'
|
156
|
+
on_def(rest[1], rest[2..-1]) if args[1][1] == 'self' && rest[0][1] == '.'
|
157
|
+
end
|
158
|
+
|
159
|
+
# Multiple left hand side
|
160
|
+
# (foo, bar) = somethingg...
|
161
|
+
def on_mlhs(args, rest)
|
162
|
+
process(args)
|
163
|
+
process(rest)
|
161
164
|
end
|
162
165
|
|
163
166
|
# ident is something that gets processed at parameters to a function or block
|
@@ -266,6 +269,8 @@ module RubyLanguageServer
|
|
266
269
|
|
267
270
|
def add_variable(name, line, column, scope = @current_scope)
|
268
271
|
new_variable = ScopeData::Variable.new(scope, name, line, column)
|
272
|
+
# blocks don't declare their first line in the parser
|
273
|
+
scope.top_line ||= line
|
269
274
|
scope.variables << new_variable unless scope.has_variable_or_constant?(new_variable)
|
270
275
|
end
|
271
276
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby_language_server
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kurt Werle
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-01
|
11
|
+
date: 2019-02-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -242,6 +242,7 @@ files:
|
|
242
242
|
- bin/console
|
243
243
|
- bin/setup
|
244
244
|
- exe/ruby_language_server
|
245
|
+
- lib/resources/fallback_rubocop.yml
|
245
246
|
- lib/ruby_language_server.rb
|
246
247
|
- lib/ruby_language_server/code_file.rb
|
247
248
|
- lib/ruby_language_server/completion.rb
|