Class: LanguageServer::Protocol::Interface::NotebookCell

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

Overview

A notebook cell.

A cell’s document URI must be unique across ALL notebook cells and can therefore be used to uniquely identify a notebook cell or the cell’s text document.

Since:

  • 3.17.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(kind:, document:, metadata: nil, execution_summary: nil) ⇒ NotebookCell

Returns a new instance of NotebookCell.

Since:

  • 3.17.0



14
15
16
17
18
19
20
21
22
23
# File 'lib/language_server/protocol/interface/notebook_cell.rb', line 14

def initialize(kind:, document:, metadata: nil, execution_summary: nil)
  @attributes = {}

  @attributes[:kind] = kind
  @attributes[:document] = document
  @attributes[:metadata] =  if 
  @attributes[:executionSummary] = execution_summary if execution_summary

  @attributes.freeze
end

Instance Attribute Details

#attributesObject (readonly)

Since:

  • 3.17.0



61
62
63
# File 'lib/language_server/protocol/interface/notebook_cell.rb', line 61

def attributes
  @attributes
end

Instance Method Details

#documentDocumentUri

The URI of the cell’s text document content.

Returns:

  • (DocumentUri)

Since:

  • 3.17.0



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

def document
  attributes.fetch(:document)
end

#execution_summaryExecutionSummary | nil

Additional execution summary information if supported by the client.

Returns:

Since:

  • 3.17.0



57
58
59
# File 'lib/language_server/protocol/interface/notebook_cell.rb', line 57

def execution_summary
  attributes.fetch(:executionSummary)
end

#kindNotebookCellKind

The cell’s kind

Returns:

  • (NotebookCellKind)

Since:

  • 3.17.0



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

def kind
  attributes.fetch(:kind)
end

#metadataLSPObject | nil

Additional metadata stored with the cell.

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

Returns:

Since:

  • 3.17.0



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

def 
  attributes.fetch(:metadata)
end

#to_hashObject

Since:

  • 3.17.0



63
64
65
# File 'lib/language_server/protocol/interface/notebook_cell.rb', line 63

def to_hash
  attributes
end

#to_json(*args) ⇒ Object

Since:

  • 3.17.0



67
68
69
# File 'lib/language_server/protocol/interface/notebook_cell.rb', line 67

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