Class: LanguageServer::Protocol::Interface::WorkspaceEdit

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(changes: nil, document_changes: nil) ⇒ WorkspaceEdit

Returns a new instance of WorkspaceEdit.



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

def initialize(changes: nil, document_changes: nil)
  @attributes = {}

  @attributes[:changes] = changes if changes
  @attributes[:documentChanges] = document_changes if document_changes

  @attributes.freeze
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



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

def attributes
  @attributes
end

Instance Method Details

#changes{ [uri: string]: TextEdit[]; }

Holds changes to existing resources.

Returns:



18
19
20
# File 'lib/language_server/protocol/interface/workspace_edit.rb', line 18

def changes
  attributes.fetch(:changes)
end

#document_changesTextDocumentEdit[]

An array of ‘TextDocumentEdit`s to express changes to n different text documents where each text document edit addresses a specific version of a text document. Whether a client supports versioned document edits is expressed via `WorkspaceClientCapabilities.workspaceEdit.documentChanges`.

Returns:



29
30
31
# File 'lib/language_server/protocol/interface/workspace_edit.rb', line 29

def document_changes
  attributes.fetch(:documentChanges)
end

#to_hashObject



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

def to_hash
  attributes
end

#to_json(*args) ⇒ Object



39
40
41
# File 'lib/language_server/protocol/interface/workspace_edit.rb', line 39

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