Skip to content

Commit 8cd57cd

Browse files
authored
Stop reusing the Prism result for RuboCop for now (#3672)
1 parent f40a4e5 commit 8cd57cd

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/ruby_lsp/requests/support/rubocop_runner.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def initialize(*args)
8181
@offenses = [] #: Array[::RuboCop::Cop::Offense]
8282
@errors = [] #: Array[String]
8383
@warnings = [] #: Array[String]
84-
@prism_result = nil #: Prism::ParseLexResult?
84+
# @prism_result = nil #: Prism::ParseLexResult?
8585

8686
args += DEFAULT_ARGS
8787
rubocop_options = ::RuboCop::Options.new.parse(args).first
@@ -101,7 +101,11 @@ def run(path, contents, prism_result)
101101
@warnings = []
102102
@offenses = []
103103
@options[:stdin] = contents
104-
@prism_result = prism_result
104+
105+
# Setting the Prism result before running the RuboCop runner makes it reuse the existing AST and avoids
106+
# double-parsing. Unfortunately, this leads to a bunch of cops failing to execute properly under LSP mode.
107+
# Uncomment this once reusing the Prism result is more stable
108+
# @prism_result = prism_result
105109

106110
super([path])
107111

0 commit comments

Comments
 (0)