Class: LanguageServer::Protocol::Interface::DocumentFormattingParams

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

Overview

The parameters of a [DocumentFormattingRequest](#DocumentFormattingRequest).

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(text_document:, options:, work_done_token: nil) ⇒ DocumentFormattingParams

Returns a new instance of DocumentFormattingParams.



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

def initialize(text_document:, options:, work_done_token: nil)
  @attributes = {}

  @attributes[:textDocument] = text_document
  @attributes[:options] = options
  @attributes[:workDoneToken] = work_done_token if work_done_token

  @attributes.freeze
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



42
43
44
# File 'lib/language_server/protocol/interface/document_formatting_params.rb', line 42

def attributes
  @attributes
end

Instance Method Details

#optionsFormattingOptions

The format options.

Returns:



30
31
32
# File 'lib/language_server/protocol/interface/document_formatting_params.rb', line 30

def options
  attributes.fetch(:options)
end

#text_documentTextDocumentIdentifier

The document to format.



22
23
24
# File 'lib/language_server/protocol/interface/document_formatting_params.rb', line 22

def text_document
  attributes.fetch(:textDocument)
end

#to_hashObject



44
45
46
# File 'lib/language_server/protocol/interface/document_formatting_params.rb', line 44

def to_hash
  attributes
end

#to_json(*args) ⇒ Object



48
49
50
# File 'lib/language_server/protocol/interface/document_formatting_params.rb', line 48

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

#work_done_tokenProgressToken | nil

An optional token that a server can use to report work done progress.

Returns:

  • (ProgressToken | nil)


38
39
40
# File 'lib/language_server/protocol/interface/document_formatting_params.rb', line 38

def work_done_token
  attributes.fetch(:workDoneToken)
end