Class: LanguageServer::Protocol::Interface::DocumentDiagnosticReport
- Inherits:
-
Object
- Object
- LanguageServer::Protocol::Interface::DocumentDiagnosticReport
- Defined in:
- lib/language_server/protocol/interface/document_diagnostic_report.rb,
sig/language_server/protocol/interface/document_diagnostic_report.rbs
Overview
The result of a document diagnostic pull request. A report can either be a full report containing all diagnostics for the requested document or an unchanged report indicating that nothing has changed in terms of diagnostics in comparison to the last pull request.
Instance Attribute Summary collapse
- #attributes ⇒ Hash[Symbol, untyped] readonly
Instance Method Summary collapse
-
#initialize(related_documents: nil, kind:, result_id: nil, items: nil) ⇒ DocumentDiagnosticReport
constructor
A new instance of DocumentDiagnosticReport.
-
#items ⇒ Diagnostic[]
The actual items.
-
#kind ⇒ "full" | "unchanged"
A full document diagnostic report.
-
#related_documents ⇒ DocumentUri => FullDocumentDiagnosticReport | UnchangedDocumentDiagnosticReport
Diagnostics of related documents.
-
#result_id ⇒ string
An optional result id.
- #to_hash ⇒ Hash[Symbol, untyped]
- #to_json(*args) ⇒ String
Constructor Details
#initialize(related_documents: nil, kind:, result_id: nil, items: nil) ⇒ DocumentDiagnosticReport
Returns a new instance of DocumentDiagnosticReport.
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/language_server/protocol/interface/document_diagnostic_report.rb', line 14 def initialize(related_documents: nil, kind:, result_id: nil, items: nil) @attributes = {} @attributes[:relatedDocuments] = if @attributes[:kind] = kind @attributes[:resultId] = result_id if result_id @attributes[:items] = items if items @attributes.freeze end |
Instance Attribute Details
#attributes ⇒ Hash[Symbol, untyped] (readonly)
77 78 79 |
# File 'lib/language_server/protocol/interface/document_diagnostic_report.rb', line 77 def attributes @attributes end |
Instance Method Details
#items ⇒ Diagnostic[]
The actual items.
73 74 75 |
# File 'lib/language_server/protocol/interface/document_diagnostic_report.rb', line 73 def items attributes.fetch(:items) end |
#kind ⇒ "full" | "unchanged"
A full document diagnostic report.
--- OR ---
A document diagnostic report indicating
no changes to the last result. A server can
only return unchanged if result ids are
provided.
50 51 52 |
# File 'lib/language_server/protocol/interface/document_diagnostic_report.rb', line 50 def kind attributes.fetch(:kind) end |
#related_documents ⇒ DocumentUri => FullDocumentDiagnosticReport | UnchangedDocumentDiagnosticReport
Diagnostics of related documents. This information is useful in programming languages where code in a file A can generate diagnostics in a file B which A depends on. An example of such a language is C/C++ where marco definitions in a file a.cpp and result in errors in a header file b.hpp.
35 36 37 |
# File 'lib/language_server/protocol/interface/document_diagnostic_report.rb', line 35 def attributes.fetch(:relatedDocuments) end |
#result_id ⇒ string
An optional result id. If provided it will be sent on the next diagnostic request for the same document.
--- OR ---
A result id which will be sent on the next diagnostic request for the same document.
65 66 67 |
# File 'lib/language_server/protocol/interface/document_diagnostic_report.rb', line 65 def result_id attributes.fetch(:resultId) end |
#to_hash ⇒ Hash[Symbol, untyped]
79 80 81 |
# File 'lib/language_server/protocol/interface/document_diagnostic_report.rb', line 79 def to_hash attributes end |
#to_json(*args) ⇒ String
83 84 85 |
# File 'lib/language_server/protocol/interface/document_diagnostic_report.rb', line 83 def to_json(*args) to_hash.to_json(*args) end |