Class: LanguageServer::Protocol::Interface::TextDocumentItem

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(uri:, language_id:, version:, text:) ⇒ TextDocumentItem

Returns a new instance of TextDocumentItem.



5
6
7
8
9
10
11
12
13
14
# File 'lib/language_server/protocol/interface/text_document_item.rb', line 5

def initialize(uri:, language_id:, version:, text:)
  @attributes = {}

  @attributes[:uri] = uri
  @attributes[:languageId] = language_id
  @attributes[:version] = version
  @attributes[:text] = text

  @attributes.freeze
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



49
50
51
# File 'lib/language_server/protocol/interface/text_document_item.rb', line 49

def attributes
  @attributes
end

Instance Method Details

#language_idstring

The text document’s language identifier.

Returns:

  • (string)


28
29
30
# File 'lib/language_server/protocol/interface/text_document_item.rb', line 28

def language_id
  attributes.fetch(:languageId)
end

#textstring

The content of the opened text document.

Returns:

  • (string)


45
46
47
# File 'lib/language_server/protocol/interface/text_document_item.rb', line 45

def text
  attributes.fetch(:text)
end

#to_hashObject



51
52
53
# File 'lib/language_server/protocol/interface/text_document_item.rb', line 51

def to_hash
  attributes
end

#to_json(*args) ⇒ Object



55
56
57
# File 'lib/language_server/protocol/interface/text_document_item.rb', line 55

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

#uristring

The text document’s URI.

Returns:

  • (string)


20
21
22
# File 'lib/language_server/protocol/interface/text_document_item.rb', line 20

def uri
  attributes.fetch(:uri)
end

#versionnumber

The version number of this document (it will increase after each change, including undo/redo).

Returns:

  • (number)


37
38
39
# File 'lib/language_server/protocol/interface/text_document_item.rb', line 37

def version
  attributes.fetch(:version)
end