Skip to content

API reference / @jsprismarine/script-host / debugger/DebugSession

debugger/DebugSession ​

Classes ​

Interfaces ​

DebugSessionOptions ​

Defined in: script-host/src/debugger/DebugSession.ts:52

How a ScriptDebugSession presents the world's scripts to the extension.

Properties ​

diagnosticsTabs? ​

readonly optional diagnosticsTabs?: readonly DiagnosticsTab[]

Defined in: script-host/src/debugger/DebugSession.ts:77

The tabs the SchemaEvent after the handshake describes; BDS's DIAGNOSTICS_TABS when absent.

fromDebuggerPath? ​

readonly optional fromDebuggerPath?: (path) => string

Defined in: script-host/src/debugger/DebugSession.ts:62

Turns a path from the extension into the engine's file name. The same path when absent.

Parameters ​
path ​

string

Returns ​

string

knowsFile? ​

readonly optional knowsFile?: (file) => boolean

Defined in: script-host/src/debugger/DebugSession.ts:64

Whether the engine knows a file, so a breakpoint in it is verified. Every file when absent.

Parameters ​
file ​

string

Returns ​

boolean

passcode? ​

readonly optional passcode?: string

Defined in: script-host/src/debugger/DebugSession.ts:56

The script-debugger-passcode the extension must send. None when absent or empty.

plugins ​

readonly plugins: readonly DebuggerPlugin[]

Defined in: script-host/src/debugger/DebugSession.ts:54

The script packs the extension may pick, by the UUID of each pack's script module.

pollLines? ​

readonly optional pollLines?: number

Defined in: script-host/src/debugger/DebugSession.ts:75

The lines a running script runs between polls, DebuggerOptions.pollLines. The profiler samples the stack at each poll.

profilerClock? ​

readonly optional profilerClock?: () => number

Defined in: script-host/src/debugger/DebugSession.ts:79

The time in microseconds, which labels the profiler's samples; the system clock when absent.

Returns ​

number

runCommand? ​

readonly optional runCommand?: (command, dimension) => void

Defined in: script-host/src/debugger/DebugSession.ts:70

Runs a command the extension's command box sent, in the named dimension. It is called while the session handles a message, which can be inside a stopped or running script, so a host whose commands reach the scripts queues it for later.

Parameters ​
command ​

string

dimension ​

string

Returns ​

void

threadId? ​

readonly optional threadId?: number

Defined in: script-host/src/debugger/DebugSession.ts:58

The thread id the extension shows for the scripts.

toDebuggerPath? ​

readonly optional toDebuggerPath?: (file) => string

Defined in: script-host/src/debugger/DebugSession.ts:60

Turns an engine file name into the path the extension knows it by. The same name when absent.

Parameters ​
file ​

string

Returns ​

string


DebuggerChannel ​

Defined in: script-host/src/debugger/DebugSession.ts:37

Carries whole messages between a session and the extension. A session calls it only on the engine's thread.

Properties ​

closed ​

readonly closed: boolean

Defined in: script-host/src/debugger/DebugSession.ts:48

Whether the connection has closed. receive and poll still return the messages that arrived before it closed.

Methods ​

poll() ​

poll(): unknown

Defined in: script-host/src/debugger/DebugSession.ts:43

Returns the next message if one has arrived, without waiting; undefined otherwise.

Returns ​

unknown

receive() ​

receive(): unknown

Defined in: script-host/src/debugger/DebugSession.ts:41

Returns the next message, waiting as long as it takes; undefined once the connection has closed.

Returns ​

unknown

send() ​

send(message): void

Defined in: script-host/src/debugger/DebugSession.ts:39

Sends one message to the extension.

Parameters ​
message ​

HostMessage

Returns ​

void

Variables ​

DEFAULT_THREAD_ID ​

const DEFAULT_THREAD_ID: 1 = 1

Defined in: script-host/src/debugger/DebugSession.ts:83

The thread id a session reports when none is given.