Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions lib/ruby_lsp/requests/support/rubocop_runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def initialize(*args)
@offenses = [] #: Array[::RuboCop::Cop::Offense]
@errors = [] #: Array[String]
@warnings = [] #: Array[String]
@prism_result = nil #: Prism::ParseLexResult?
# @prism_result = nil #: Prism::ParseLexResult?

args += DEFAULT_ARGS
rubocop_options = ::RuboCop::Options.new.parse(args).first
Expand All @@ -101,7 +101,11 @@ def run(path, contents, prism_result)
@warnings = []
@offenses = []
@options[:stdin] = contents
@prism_result = prism_result

# Setting the Prism result before running the RuboCop runner makes it reuse the existing AST and avoids
# double-parsing. Unfortunately, this leads to a bunch of cops failing to execute properly under LSP mode.
# Uncomment this once reusing the Prism result is more stable
# @prism_result = prism_result

super([path])

Expand Down