Class: LanguageServer::Protocol::Interface::RelatedFullDocumentDiagnosticReport

Inherits:
Object
  • Object
show all
Defined in:
lib/language_server/protocol/interface/related_full_document_diagnostic_report.rb

Overview

A full diagnostic report with a set of related documents.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(kind:, result_id: nil, items:, related_documents: nil) ⇒ RelatedFullDocumentDiagnosticReport

Returns a new instance of RelatedFullDocumentDiagnosticReport.



8
9
10
11
12
13
14
15
16
17
# File 'lib/language_server/protocol/interface/related_full_document_diagnostic_report.rb', line 8

def initialize(kind:, result_id: nil, items:, related_documents: nil)
  @attributes = {}

  @attributes[:kind] = kind
  @attributes[:resultId] = result_id if result_id
  @attributes[:items] = items
  @attributes[:relatedDocuments] = related_documents if related_documents

  @attributes.freeze
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



57
58
59
# File 'lib/language_server/protocol/interface/related_full_document_diagnostic_report.rb', line 57

def attributes
  @attributes
end

Instance Method Details

#itemsDiagnostic[]

The actual items.

Returns:



41
42
43
# File 'lib/language_server/protocol/interface/related_full_document_diagnostic_report.rb', line 41

def items
  attributes.fetch(:items)
end

#kindany

A full document diagnostic report.

Returns:

  • (any)


23
24
25
# File 'lib/language_server/protocol/interface/related_full_document_diagnostic_report.rb', line 23

def kind
  attributes.fetch(:kind)
end

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.



53
54
55
# File 'lib/language_server/protocol/interface/related_full_document_diagnostic_report.rb', line 53

def related_documents
  attributes.fetch(:relatedDocuments)
end

#result_idstring

An optional result id. If provided it will be sent on the next diagnostic request for the same document.

Returns:

  • (string)


33
34
35
# File 'lib/language_server/protocol/interface/related_full_document_diagnostic_report.rb', line 33

def result_id
  attributes.fetch(:resultId)
end

#to_hashObject



59
60
61
# File 'lib/language_server/protocol/interface/related_full_document_diagnostic_report.rb', line 59

def to_hash
  attributes
end

#to_json(*args) ⇒ Object



63
64
65
# File 'lib/language_server/protocol/interface/related_full_document_diagnostic_report.rb', line 63

def to_json(*args)
  to_hash.to_json(*args)
end