Class: LanguageServer::Protocol::Interface::DidChangeNotebookDocumentParams

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

Overview

The params sent in a change notebook document notification.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(notebook_document:, change:) ⇒ DidChangeNotebookDocumentParams

Returns a new instance of DidChangeNotebookDocumentParams.



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

def initialize(notebook_document:, change:)
  @attributes = {}

  @attributes[:notebookDocument] = notebook_document
  @attributes[:change] = change

  @attributes.freeze
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



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

def attributes
  @attributes
end

Instance Method Details

#changeNotebookDocumentChangeEvent

The actual changes to the notebook document.

The change describes single state change to the notebook document. So it moves a notebook document, its cells and its cell text document contents from state S to S’.

To mirror the content of a notebook using change events use the following approach:

  • start with the same initial content

  • apply the ‘notebookDocument/didChange’ notifications in the order

you receive them.



40
41
42
# File 'lib/language_server/protocol/interface/did_change_notebook_document_params.rb', line 40

def change
  attributes.fetch(:change)
end

#notebook_documentVersionedNotebookDocumentIdentifier

The notebook document that did change. The version number points to the version after all provided changes have been applied.



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

def notebook_document
  attributes.fetch(:notebookDocument)
end

#to_hashObject



46
47
48
# File 'lib/language_server/protocol/interface/did_change_notebook_document_params.rb', line 46

def to_hash
  attributes
end

#to_json(*args) ⇒ Object



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

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