jimeh-solargraph 0.40.4.0 → 0.40.4.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1bc09b67a21b704d406052aedcc27d6d345d555a96374b24005ad7e707fe2a82
4
- data.tar.gz: 397a1cb3f450200026d4886c27ad40ac90c69d0dc81fa81a5d7f05a570667fe9
3
+ metadata.gz: ebdc45f294b8860094b90be97a988cf2ed4a43e767f3e4b50da7f60a1011cdc3
4
+ data.tar.gz: 976f697fbfe4e1082c56491382d8f170a14be328fd7cad6d0367f7db5122b282
5
5
  SHA512:
6
- metadata.gz: 61b974b0bb067c6143b9d9b71228d6b7f95e3567cf75aaa9fbc7fade20a4a2b233713bf151029b7ddddb4a014875e1eb6b759f94c7aa12da8ca2c423dbaeaad0
7
- data.tar.gz: 59b573435c26430c86794367a97dd3969828c0636f8aa832455990eae9023d36d4a4d22b0a3ef5efe0fdef571ca4060a032f9f4c313d8af58858aaec216a1fd3
6
+ metadata.gz: 4b3f4e6bdc7d3ef9600861b68831f04eff0de82a229233509cd944a3c508f3f4a40cf721e50a3e0db50c139725e8b463cc983bba3bc4558d747e7ae5a4a8f70b
7
+ data.tar.gz: fe947462017a54bb93a1a80f909635eec3d442a9b968828d8adfbec90986ad4b58c16bed952cc9bddc941eb5f66fb66acd17c8d92decd3abd6dba73d229e8211
@@ -57,7 +57,8 @@ module Solargraph
57
57
  range: offense_range(off).to_hash,
58
58
  # 1 = Error, 2 = Warning, 3 = Information, 4 = Hint
59
59
  severity: SEVERITIES[off['severity']],
60
- source: off['cop_name'],
60
+ source: 'rubocop',
61
+ code: off['cop_name'],
61
62
  message: off['message'].gsub(/^#{off['cop_name']}\:/, '')
62
63
  }
63
64
  end
@@ -11,8 +11,6 @@ module Solargraph
11
11
  class Formatting < Base
12
12
  include Solargraph::Diagnostics::RubocopHelpers
13
13
 
14
- class BlankRubocopFormatter < ::RuboCop::Formatter::BaseFormatter; end
15
-
16
14
  def process
17
15
  file_uri = params['textDocument']['uri']
18
16
  config = config_for(file_uri)
@@ -21,11 +19,13 @@ module Solargraph
21
19
 
22
20
  options, paths = RuboCop::Options.new.parse(args)
23
21
  options[:stdin] = original
24
- redirect_stdout do
22
+ corrections = redirect_stdout do
25
23
  RuboCop::Runner.new(options, RuboCop::ConfigStore.new).run(paths)
26
24
  end
27
25
  result = options[:stdin]
28
26
 
27
+ log_corrections(corrections)
28
+
29
29
  format original, result
30
30
  rescue RuboCop::ValidationError, RuboCop::ConfigNotFoundError => e
31
31
  set_error(Solargraph::LanguageServer::ErrorCodes::INTERNAL_ERROR, "[#{e.class}] #{e.message}")
@@ -33,6 +33,17 @@ module Solargraph
33
33
 
34
34
  private
35
35
 
36
+ def log_corrections(corrections)
37
+ corrections = corrections&.strip
38
+ return if corrections&.empty?
39
+
40
+ Solargraph.logger.info('Formatting result:')
41
+ corrections.each_line do |line|
42
+ next if line.strip.empty?
43
+ Solargraph.logger.info(line.strip)
44
+ end
45
+ end
46
+
36
47
  def config_for(file_uri)
37
48
  conf = host.formatter_config(file_uri)
38
49
  return {} unless conf.is_a?(Hash)
@@ -40,12 +51,11 @@ module Solargraph
40
51
  conf['rubocop'] || {}
41
52
  end
42
53
 
43
- def cli_args file, config
54
+ def cli_args file_uri, config
55
+ file = UriHelpers.uri_to_file(file_uri)
44
56
  args = [
45
57
  config['cops'] == 'all' ? '--auto-correct-all' : '--auto-correct',
46
- '--cache', 'false',
47
- '--format', 'Solargraph::LanguageServer::Message::' \
48
- 'TextDocument::Formatting::BlankRubocopFormatter',
58
+ '--cache', 'false', '--format', 'emacs'
49
59
  ]
50
60
 
51
61
  ['except', 'only'].each do |arg|
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Solargraph
4
- VERSION = '0.40.4.0'
4
+ VERSION = '0.40.4.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jimeh-solargraph
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.40.4.0
4
+ version: 0.40.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fred Snyder
@@ -557,7 +557,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
557
557
  - !ruby/object:Gem::Version
558
558
  version: '0'
559
559
  requirements: []
560
- rubygems_version: 3.1.4
560
+ rubygems_version: 3.1.6
561
561
  signing_key:
562
562
  specification_version: 4
563
563
  summary: A Ruby language server