Class: LanguageServer::Protocol::Interface::NotebookDocument

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

Overview

A notebook document.

Since:

  • 3.17.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(uri:, notebook_type:, version:, metadata: nil, cells:) ⇒ NotebookDocument

Returns a new instance of NotebookDocument.

Since:

  • 3.17.0



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

def initialize(uri:, notebook_type:, version:, metadata: nil, cells:)
  @attributes = {}

  @attributes[:uri] = uri
  @attributes[:notebookType] = notebook_type
  @attributes[:version] = version
  @attributes[:metadata] =  if 
  @attributes[:cells] = cells

  @attributes.freeze
end

Instance Attribute Details

#attributesObject (readonly)

Since:

  • 3.17.0



66
67
68
# File 'lib/language_server/protocol/interface/notebook_document.rb', line 66

def attributes
  @attributes
end

Instance Method Details

#cellsNotebookCell[]

The cells of a notebook.

Returns:

Since:

  • 3.17.0



62
63
64
# File 'lib/language_server/protocol/interface/notebook_document.rb', line 62

def cells
  attributes.fetch(:cells)
end

#metadataLSPObject | nil

Additional metadata stored with the notebook document.

Note: should always be an object literal (e.g. LSPObject)

Returns:

Since:

  • 3.17.0



54
55
56
# File 'lib/language_server/protocol/interface/notebook_document.rb', line 54

def 
  attributes.fetch(:metadata)
end

#notebook_typestring

The type of the notebook.

Returns:

  • (string)

Since:

  • 3.17.0



34
35
36
# File 'lib/language_server/protocol/interface/notebook_document.rb', line 34

def notebook_type
  attributes.fetch(:notebookType)
end

#to_hashObject

Since:

  • 3.17.0



68
69
70
# File 'lib/language_server/protocol/interface/notebook_document.rb', line 68

def to_hash
  attributes
end

#to_json(*args) ⇒ Object

Since:

  • 3.17.0



72
73
74
# File 'lib/language_server/protocol/interface/notebook_document.rb', line 72

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

#uriURI

The notebook document’s uri.

Returns:

  • (URI)

Since:

  • 3.17.0



26
27
28
# File 'lib/language_server/protocol/interface/notebook_document.rb', line 26

def uri
  attributes.fetch(:uri)
end

#versioninteger

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

Returns:

  • (integer)

Since:

  • 3.17.0



43
44
45
# File 'lib/language_server/protocol/interface/notebook_document.rb', line 43

def version
  attributes.fetch(:version)
end