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

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

Overview

An item to transfer a text document from the client to the server.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of TextDocumentItem.



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

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.



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

def attributes
  @attributes
end

Instance Method Details

#language_idstring

The text document’s language identifier.

Returns:

  • (string)


32
33
34
# File 'lib/language_server/protocol/interface/text_document_item.rb', line 32

def language_id
  attributes.fetch(:languageId)
end

#textstring

The content of the opened text document.

Returns:

  • (string)


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

def text
  attributes.fetch(:text)
end

#to_hashObject



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

def to_hash
  attributes
end

#to_json(*args) ⇒ Object



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

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

#uriDocumentUri

The text document’s uri.

Returns:

  • (DocumentUri)


24
25
26
# File 'lib/language_server/protocol/interface/text_document_item.rb', line 24

def uri
  attributes.fetch(:uri)
end

#versioninteger

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

Returns:

  • (integer)


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

def version
  attributes.fetch(:version)
end