Class: RubyLsp::Requests::Diagnostics
- Inherits:
-
BaseRequest
- Object
- SyntaxTree::Visitor
- BaseRequest
- RubyLsp::Requests::Diagnostics
- Extended by:
- T::Sig
- 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 “`
Instance Method Summary collapse
-
#initialize(uri, document) ⇒ Diagnostics
constructor
A new instance of Diagnostics.
- #run ⇒ Object
Methods inherited from BaseRequest
Constructor Details
#initialize(uri, document) ⇒ Diagnostics
Returns a new instance of Diagnostics.
25 26 27 28 29 |
# File 'lib/ruby_lsp/requests/diagnostics.rb', line 25 def initialize(uri, document) super(document) @uri = uri end |
Instance Method Details
#run ⇒ Object
39 40 41 42 43 44 |
# File 'lib/ruby_lsp/requests/diagnostics.rb', line 39 def run return syntax_error_diagnostics if @document.syntax_errors? return [] unless defined?(Support::RuboCopDiagnosticsRunner) Support::RuboCopDiagnosticsRunner.instance.run(@uri, @document) end |