From f6d298aaca199e66b0b82fd8062347a6a384063c Mon Sep 17 00:00:00 2001 From: WinPlay02 Date: Thu, 18 Jan 2024 03:13:24 +0100 Subject: [PATCH 1/5] feat: support placeholder queries that only request a subset of data --- .../safe-ds-vscode/src/extension/messages.ts | 33 +++++++++++++++++-- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/packages/safe-ds-vscode/src/extension/messages.ts b/packages/safe-ds-vscode/src/extension/messages.ts index 17adc8e37..f7204d750 100644 --- a/packages/safe-ds-vscode/src/extension/messages.ts +++ b/packages/safe-ds-vscode/src/extension/messages.ts @@ -68,7 +68,17 @@ export interface ProgramMainInformation { export interface PlaceholderQueryMessage { type: 'placeholder_query'; id: string; - data: string; + data: PlaceholderQuery; +} + +/** + * Contains the query for a placeholder value. + * Field name contains the name of the requested placeholder, field window_begin may contain an offset of and window_size may contain the size of a subset of the requested data. + */ +export interface PlaceholderQuery { + name: string; + window_begin: number | undefined; + window_size: number | undefined; } // Python Server to Extension @@ -105,6 +115,10 @@ export interface PlaceholderValue { name: string; type: string; value: string; + windowed: boolean | undefined; + window_begin: number | undefined; + window_size: number | undefined; + window_max: number | undefined; } // Python Server to Extension @@ -152,8 +166,21 @@ export const createProgramMessage = function (id: string, data: ProgramPackageMa return { type: 'program', id, data }; }; -export const createPlaceholderQueryMessage = function (id: string, placeholderName: string): PythonServerMessage { - return { type: 'placeholder_query', id, data: placeholderName }; +export const createPlaceholderQueryMessage = function ( + id: string, + placeholderName: string, + windowBegin: number | undefined = undefined, + windowSize: number | undefined = undefined, +): PythonServerMessage { + return { + type: 'placeholder_query', + id, + data: { + name: placeholderName, + window_begin: !windowBegin ? undefined : Math.round(windowBegin), + window_size: !windowSize ? undefined : Math.round(windowSize), + }, + }; }; // Extension to Python Server From 78112435f6462b15278460868ad7b94ad443eec8 Mon Sep 17 00:00:00 2001 From: WinPlay02 Date: Thu, 18 Jan 2024 09:37:30 +0100 Subject: [PATCH 2/5] style: changed new fields to be optional --- packages/safe-ds-vscode/src/extension/messages.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/safe-ds-vscode/src/extension/messages.ts b/packages/safe-ds-vscode/src/extension/messages.ts index f7204d750..b1f26e6a4 100644 --- a/packages/safe-ds-vscode/src/extension/messages.ts +++ b/packages/safe-ds-vscode/src/extension/messages.ts @@ -77,8 +77,8 @@ export interface PlaceholderQueryMessage { */ export interface PlaceholderQuery { name: string; - window_begin: number | undefined; - window_size: number | undefined; + window_begin?: number; + window_size?: number; } // Python Server to Extension @@ -115,10 +115,10 @@ export interface PlaceholderValue { name: string; type: string; value: string; - windowed: boolean | undefined; - window_begin: number | undefined; - window_size: number | undefined; - window_max: number | undefined; + windowed?: boolean; + window_begin?: number; + window_size?: number; + window_max?: number; } // Python Server to Extension From f7a0861eb53be435af8ed99e35091d920fa2ec5f Mon Sep 17 00:00:00 2001 From: Lars Reimann Date: Tue, 23 Jan 2024 09:59:06 +0100 Subject: [PATCH 3/5] docs: move comments to related fields --- packages/safe-ds-vscode/src/extension/messages.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/packages/safe-ds-vscode/src/extension/messages.ts b/packages/safe-ds-vscode/src/extension/messages.ts index b1f26e6a4..dbd84ca22 100644 --- a/packages/safe-ds-vscode/src/extension/messages.ts +++ b/packages/safe-ds-vscode/src/extension/messages.ts @@ -72,12 +72,22 @@ export interface PlaceholderQueryMessage { } /** - * Contains the query for a placeholder value. - * Field name contains the name of the requested placeholder, field window_begin may contain an offset of and window_size may contain the size of a subset of the requested data. + * A query on a placeholder value. */ export interface PlaceholderQuery { + /** + * The name of the requested placeholder. + */ name: string; + + /** + * The offset of the requested data. + */ window_begin?: number; + + /** + * The size of the requested data. + */ window_size?: number; } From 7046930b2550737ce806cfc594db3698953e97bd Mon Sep 17 00:00:00 2001 From: WinPlay02 Date: Tue, 23 Jan 2024 16:09:11 +0100 Subject: [PATCH 4/5] misc: put windowing information in their own structs for request and response --- .../safe-ds-vscode/src/extension/messages.ts | 35 +++++++++++++------ 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/packages/safe-ds-vscode/src/extension/messages.ts b/packages/safe-ds-vscode/src/extension/messages.ts index b1f26e6a4..f23569db9 100644 --- a/packages/safe-ds-vscode/src/extension/messages.ts +++ b/packages/safe-ds-vscode/src/extension/messages.ts @@ -73,12 +73,19 @@ export interface PlaceholderQueryMessage { /** * Contains the query for a placeholder value. - * Field name contains the name of the requested placeholder, field window_begin may contain an offset of and window_size may contain the size of a subset of the requested data. + * Field name contains the name of the requested placeholder, field window may contain information to request a subset of the data available. */ export interface PlaceholderQuery { name: string; - window_begin?: number; - window_size?: number; + window: PlaceholderQueryWindow; +} + +/** + * Contains the index offset of the requested data subset (begin), the size of the requested data subset and the max. amount of available elements. + */ +export interface PlaceholderQueryWindow { + begin?: number; + size?: number; } // Python Server to Extension @@ -109,16 +116,22 @@ export interface PlaceholderValueMessage { } /** - * Contains the name, type and the actual value of a calculated placeholder. + * Contains the name, type, the actual value of a calculated placeholder and optional windowing information when requesting a subset of data. */ export interface PlaceholderValue { name: string; type: string; value: string; - windowed?: boolean; - window_begin?: number; - window_size?: number; - window_max?: number; + window?: PlaceholderValueWindow; +} + +/** + * Contains the index offset of the requested data subset (begin), the size of the requested data subset and the max. amount of available elements. + */ +export interface PlaceholderValueWindow { + begin: number; + size: number; + max: number; } // Python Server to Extension @@ -177,8 +190,10 @@ export const createPlaceholderQueryMessage = function ( id, data: { name: placeholderName, - window_begin: !windowBegin ? undefined : Math.round(windowBegin), - window_size: !windowSize ? undefined : Math.round(windowSize), + window: { + begin: !windowBegin ? undefined : Math.round(windowBegin), + size: !windowSize ? undefined : Math.round(windowSize), + }, }, }; }; From f76a950c844581a7a512bb8b0a25541fae82f9fe Mon Sep 17 00:00:00 2001 From: WinPlay02 Date: Tue, 23 Jan 2024 16:23:57 +0100 Subject: [PATCH 5/5] docs: changed docs for messages to be attached to the actual fields of the message --- .../safe-ds-vscode/src/extension/messages.ts | 71 ++++++++++++++++--- 1 file changed, 62 insertions(+), 9 deletions(-) diff --git a/packages/safe-ds-vscode/src/extension/messages.ts b/packages/safe-ds-vscode/src/extension/messages.ts index fa081036a..149a745df 100644 --- a/packages/safe-ds-vscode/src/extension/messages.ts +++ b/packages/safe-ds-vscode/src/extension/messages.ts @@ -51,13 +51,21 @@ export interface ProgramModuleMap { /** * Contains execution information about a pipeline. - * Field modulepath contains the path to the current module. - * Field module contains the current module name. - * Field pipeline contains the pipeline name. */ export interface ProgramMainInformation { + /** + * The path to the current module. + */ modulepath: string; + + /** + * The current module name. + */ module: string; + + /** + * The pipeline name. + */ pipeline: string; } @@ -112,10 +120,17 @@ export interface PlaceholderTypeMessage { } /** - * Contains the name and the type of a calculated placeholder. + * Contains the description of a calculated placeholder. */ export interface PlaceholderDescription { + /** + * Name of the calculated placeholder. + */ name: string; + + /** + * Type of the calculated placeholder + */ type: string; } @@ -129,21 +144,47 @@ export interface PlaceholderValueMessage { } /** - * Contains the name, type, the actual value of a calculated placeholder and optional windowing information when requesting a subset of data. + * Contains the description and the value of a calculated placeholder. */ export interface PlaceholderValue { + /** + * Name of the calculated placeholder. + */ name: string; + + /** + * Type of the calculated placeholder. + */ type: string; + + /** + * Actual value of the calculated placeholder. + */ value: string; + + /** + * Optional windowing information when only a subset of the data was requested. This may be different from the requested bounds. + */ window?: PlaceholderValueWindow; } /** - * Contains the index offset of the requested data subset (begin), the size of the requested data subset and the max. amount of elements available. + * Windowing information for a placeholder value response. */ export interface PlaceholderValueWindow { + /** + * Index offset of the requested data subset. + */ begin: number; + + /** + * Size of the requested data subset. + */ size: number; + + /** + * Max. amount of elements available. + */ max: number; } @@ -158,20 +199,32 @@ export interface RuntimeErrorMessage { } /** - * Field message contains the error message. - * Field backtrace contains an array of stackframes present at the moment of raising the error + * Error description for runtime errors. */ export interface RuntimeErrorDescription { + /** + * Error Message + */ message: string; + + /** + * Array of stackframes at the moment of raising the error. + */ backtrace: RuntimeErrorBacktraceFrame[]; } /** * Contains debugging information about a stackframe. - * Field file contains the python module name (or file name), field line contains the line number where the error occurred. */ export interface RuntimeErrorBacktraceFrame { + /** + * Python module name (or file name). + */ file: string; + + /** + * Line number where the error occurred. + */ line: number; }