Your environment
vscode-ruby version: 0.24.2
- Ruby version: 2.6.2
- Ruby version manager (if any):
- VS Code version: 1.37.1
- Operating System: macOS Mojave 10.14.5
- Using language server? (eg
useLanguageServer is true?) Yes
Expected behavior
It should format correctly the following file using rubocop:
Input:
# frozen_string_literal: true
puts "this is a test"
puts "\n=========================================================="
puts "okokokok"
Expected output (works when using rubocop standalone):
# frozen_string_literal: true
puts 'this is a test'
puts "\n=========================================================="
puts 'okokokok'
Actual behavior
The actual output when calling Format document removes most of the document:
More info
It looks like the issue is when parsing the output from rubocop it
thinks that the line with multiple ==== is the marker from rubocop when the actual file content starts.
~ ruby-2.6.2 🍔 cat test-rubocop.rb | rubocop -s test-rubocop.rb -a
Inspecting 1 file
C
Offenses:
test-rubocop.rb:1:1: C: Naming/FileName: The name of this source file (test-rubocop.rb) should use snake_case.
# frozen_string_literal: true
^
test-rubocop.rb:3:6: C: [Corrected] Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
puts "this is a test"
^^^^^^^^^^^^^^^^
test-rubocop.rb:5:6: C: [Corrected] Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
puts "okokokok"
^^^^^^^^^^
1 file inspected, 3 offenses detected, 2 offenses corrected
====================
# frozen_string_literal: true
puts 'this is a test'
puts "\n=========================================================="
puts 'okokokok'
Your environment
vscode-rubyversion: 0.24.2useLanguageServeris true?) YesExpected behavior
It should format correctly the following file using rubocop:
Input:
Expected output (works when using rubocop standalone):
Actual behavior
The actual output when calling Format document removes most of the document:
More info
It looks like the issue is when parsing the output from
rubocopitthinks that the line with multiple
====is the marker from rubocop when the actual file content starts.