Class: RubyLsp::Requests::Diagnostics
- Inherits:
-
RuboCopRequest
- Object
- RuboCop::Runner
- RuboCopRequest
- RubyLsp::Requests::Diagnostics
- Defined in:
- lib/ruby_lsp/requests/diagnostics.rb
Overview
The [diagnostics](microsoft.github.io/language-server-protocol/specification#textDocument_publishDiagnostics) request informs the editor of RuboCop offenses for a given file.
# Example
“‘ruby def say_hello puts “Hello” # –> diagnostics: incorrect indentantion end “`
Constant Summary
Constants inherited from RuboCopRequest
RuboCopRequest::COMMON_RUBOCOP_FLAGS
Instance Attribute Summary
Attributes inherited from RuboCopRequest
Instance Method Summary collapse
Methods inherited from RuboCopRequest
Constructor Details
This class inherits a constructor from RubyLsp::Requests::RuboCopRequest
Instance Method Details
#file_finished(_file, offenses) ⇒ Object
26 27 28 |
# File 'lib/ruby_lsp/requests/diagnostics.rb', line 26 def file_finished(_file, offenses) @diagnostics = offenses.map { |offense| Support::RuboCopDiagnostic.new(offense, @uri) } end |
#run ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/ruby_lsp/requests/diagnostics.rb', line 18 def run return syntax_error_diagnostics if @document.syntax_errors? super @diagnostics end |