ruby_language_server 0.3.10 → 0.3.11
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 +4 -4
- data/lib/ruby_language_server/gem_installer.rb +1 -0
- data/lib/ruby_language_server/good_cop.rb +35 -15
- data/lib/ruby_language_server/project_manager.rb +1 -2
- data/lib/ruby_language_server/version.rb +1 -1
- data/ruby_language_server.gemspec +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fe54fa7e2447945dfdec7a3e4115d6a31d028842d78b26631885d4e324cd77bc
|
4
|
+
data.tar.gz: 178acfce9a35034338ae281542c46c84ae96982c0202a5568585f976239abe20
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 48e6196bf2fd6ae860211a5e31e670ef22fbe66d1cca0c44ae239b8ab82faa7ad3a657a3afcda15b6930e54becc8f743a2e415cef5648f3e03583158be5d507c
|
7
|
+
data.tar.gz: 4a5b80426e7e08be93eb514e42420c9f8bc15563b427fc20cc0d648d3a7280db092756ba1980153385696cc4e9249fb3843c26047e856a6ebfef39791f5dbe26
|
data/CHANGELOG.txt
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
ruby_language_server (0.3.
|
4
|
+
ruby_language_server (0.3.11)
|
5
5
|
activerecord (~> 5.2)
|
6
6
|
amatch
|
7
7
|
bundler
|
@@ -65,7 +65,7 @@ GEM
|
|
65
65
|
ruby_dep (~> 1.2)
|
66
66
|
lumberjack (1.0.13)
|
67
67
|
method_source (0.9.2)
|
68
|
-
minitest (5.
|
68
|
+
minitest (5.13.0)
|
69
69
|
minitest-color (0.0.2)
|
70
70
|
minitest (~> 5)
|
71
71
|
mize (0.4.0)
|
@@ -124,7 +124,7 @@ DEPENDENCIES
|
|
124
124
|
guard
|
125
125
|
guard-minitest
|
126
126
|
guard-rubocop
|
127
|
-
minitest (
|
127
|
+
minitest (= 5.13.0)
|
128
128
|
minitest-color
|
129
129
|
pry
|
130
130
|
pry-byebug
|
@@ -133,4 +133,4 @@ DEPENDENCIES
|
|
133
133
|
sexp_processor
|
134
134
|
|
135
135
|
BUNDLED WITH
|
136
|
-
2.1.
|
136
|
+
2.1.4
|
@@ -4,12 +4,14 @@ require 'rubocop'
|
|
4
4
|
|
5
5
|
module RubyLanguageServer
|
6
6
|
class GoodCop < RuboCop::Runner
|
7
|
-
def initialize
|
8
|
-
@initialization_error =
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
7
|
+
def initialize(config_path, initialization_error = nil)
|
8
|
+
@initialization_error = initialization_error
|
9
|
+
unless @initialization_error
|
10
|
+
config_store = RuboCop::ConfigStore.new
|
11
|
+
config_store.options_config = config_path
|
12
|
+
RubyLanguageServer.logger.debug("Rubocop config_path: #{config_path}")
|
13
|
+
super({}, config_store)
|
14
|
+
end
|
13
15
|
rescue Exception => e
|
14
16
|
RubyLanguageServer.logger.error(e)
|
15
17
|
@initialization_error = "There was an issue loading the rubocop configuration file: #{e}. Maybe you need to add some additional gems to the ide-ruby settings?"
|
@@ -100,7 +102,8 @@ module RubyLanguageServer
|
|
100
102
|
if excluded_file?(filename)
|
101
103
|
[]
|
102
104
|
else
|
103
|
-
|
105
|
+
ruby_version = 2.7
|
106
|
+
processed_source = RuboCop::ProcessedSource.new(text, ruby_version, filename)
|
104
107
|
offenses = inspect_file(processed_source)
|
105
108
|
offenses.compact.flatten
|
106
109
|
end
|
@@ -119,14 +122,31 @@ module RubyLanguageServer
|
|
119
122
|
]
|
120
123
|
end
|
121
124
|
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
125
|
+
class << self
|
126
|
+
def instance
|
127
|
+
@config_path ||= config_path
|
128
|
+
config_path_timestamp = File.mtime(@config_path)
|
129
|
+
if @cached_config_path_timestamp.nil? || @cached_config_path_timestamp < config_path_timestamp
|
130
|
+
@cached_config_path_timestamp = config_path_timestamp
|
131
|
+
@instance = new(@config_path)
|
132
|
+
else
|
133
|
+
@instance
|
134
|
+
end
|
135
|
+
rescue StandardError => e
|
136
|
+
@instance = new(@config_path, e.to_s)
|
137
|
+
end
|
138
|
+
|
139
|
+
private
|
140
|
+
|
141
|
+
def config_path
|
142
|
+
my_path = __FILE__
|
143
|
+
pathname = Pathname.new(my_path)
|
144
|
+
my_directory = pathname.dirname
|
145
|
+
fallback_pathname = my_directory + '../resources/fallback_rubocop.yml'
|
146
|
+
project_path = RubyLanguageServer::ProjectManager.root_path + '.rubocop.yml'
|
147
|
+
possible_config_paths = [project_path, fallback_pathname.to_s]
|
148
|
+
possible_config_paths.detect { |path| File.exist?(path) }
|
149
|
+
end
|
130
150
|
end
|
131
151
|
|
132
152
|
def excluded_file?(filename)
|
@@ -217,9 +217,8 @@ module RubyLanguageServer
|
|
217
217
|
def updated_diagnostics_for_codefile(code_file)
|
218
218
|
# Maybe we should be sharing this GoodCop across instances
|
219
219
|
RubyLanguageServer.logger.debug("updated_diagnostics_for_codefile: #{code_file.uri}")
|
220
|
-
@good_cop ||= GoodCop.new
|
221
220
|
project_relative_filename = filename_relative_to_project(code_file.uri)
|
222
|
-
code_file.diagnostics =
|
221
|
+
code_file.diagnostics = GoodCop.instance.diagnostics(code_file.text, project_relative_filename)
|
223
222
|
RubyLanguageServer.logger.debug("code_file.diagnostics: #{code_file.diagnostics}")
|
224
223
|
code_file.diagnostics
|
225
224
|
end
|
@@ -52,7 +52,7 @@ Gem::Specification.new do |spec|
|
|
52
52
|
spec.add_development_dependency 'guard'
|
53
53
|
spec.add_development_dependency 'guard-minitest'
|
54
54
|
spec.add_development_dependency 'guard-rubocop'
|
55
|
-
spec.add_development_dependency 'minitest', '
|
55
|
+
spec.add_development_dependency 'minitest', '5.13.0' # Very exact verion matching the one in gem_installer.rb because of runtime gem version conflicts
|
56
56
|
spec.add_development_dependency 'minitest-color'
|
57
57
|
spec.add_development_dependency 'pry'
|
58
58
|
spec.add_development_dependency 'pry-byebug'
|
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.3.
|
4
|
+
version: 0.3.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kurt Werle
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-01-
|
11
|
+
date: 2020-01-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -196,16 +196,16 @@ dependencies:
|
|
196
196
|
name: minitest
|
197
197
|
requirement: !ruby/object:Gem::Requirement
|
198
198
|
requirements:
|
199
|
-
- -
|
199
|
+
- - '='
|
200
200
|
- !ruby/object:Gem::Version
|
201
|
-
version:
|
201
|
+
version: 5.13.0
|
202
202
|
type: :development
|
203
203
|
prerelease: false
|
204
204
|
version_requirements: !ruby/object:Gem::Requirement
|
205
205
|
requirements:
|
206
|
-
- -
|
206
|
+
- - '='
|
207
207
|
- !ruby/object:Gem::Version
|
208
|
-
version:
|
208
|
+
version: 5.13.0
|
209
209
|
- !ruby/object:Gem::Dependency
|
210
210
|
name: minitest-color
|
211
211
|
requirement: !ruby/object:Gem::Requirement
|