Class: LanguageServer::Protocol::Interface::DocumentDiagnosticReport

Inherits:
Object
  • Object
show all
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.

Since:

  • 3.17.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of DocumentDiagnosticReport.

Parameters:

  • related_documents: (Object) (defaults to: nil)
  • kind: ("full", "unchanged")
  • result_id: (String) (defaults to: nil)
  • items: (Array[untyped]) (defaults to: nil)

Since:

  • 3.17.0



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] = related_documents if related_documents
  @attributes[:kind] = kind
  @attributes[:resultId] = result_id if result_id
  @attributes[:items] = items if items

  @attributes.freeze
end

Instance Attribute Details

#attributesHash[Symbol, untyped] (readonly)

Returns:

  • (Hash[Symbol, untyped])

Since:

  • 3.17.0



77
78
79
# File 'lib/language_server/protocol/interface/document_diagnostic_report.rb', line 77

def attributes
  @attributes
end

Instance Method Details

#itemsDiagnostic[]

The actual items.

Returns:

Since:

  • 3.17.0



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.

Returns:

  • ("full" | "unchanged")

Since:

  • 3.17.0



50
51
52
# File 'lib/language_server/protocol/interface/document_diagnostic_report.rb', line 50

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.

Returns:

Since:

  • 3.17.0



35
36
37
# File 'lib/language_server/protocol/interface/document_diagnostic_report.rb', line 35

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.

--- OR ---

A result id which will be sent on the next diagnostic request for the same document.

Returns:

  • (string)

Since:

  • 3.17.0



65
66
67
# File 'lib/language_server/protocol/interface/document_diagnostic_report.rb', line 65

def result_id
  attributes.fetch(:resultId)
end

#to_hashHash[Symbol, untyped]

Returns:

  • (Hash[Symbol, untyped])

Since:

  • 3.17.0



79
80
81
# File 'lib/language_server/protocol/interface/document_diagnostic_report.rb', line 79

def to_hash
  attributes
end

#to_json(*args) ⇒ String

Parameters:

  • (Object)

Returns:

  • (String)

Since:

  • 3.17.0



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