Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add children roSGNode containers #192

Merged
merged 24 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
b6d6dd9
Add children to the children of roSGNode containers. Make the evaluat…
Christian-Holbrook Jun 13, 2024
cbbc525
Fix lint issues
Christian-Holbrook Jun 13, 2024
ef39552
Move lint fixes
Christian-Holbrook Jun 13, 2024
8987a5f
Rename evalutTemporaryVariables to evaluateExpressionToTempVar
Christian-Holbrook Jun 14, 2024
d5d932b
Add the [[count]] value to the variables debug panel
Christian-Holbrook Jun 14, 2024
21ba1a1
Fix unit test
Christian-Holbrook Jun 26, 2024
cda34ee
Change counts type to "number" and make it greyed out with the "virtu…
Christian-Holbrook Jul 1, 2024
76c2a0c
Allow name to be a string or number when creating containers
Christian-Holbrook Jul 2, 2024
e6e2669
Set the [[count]] to zero if there are no elements and the type is "A…
Christian-Holbrook Jul 3, 2024
06d6416
Move logic for adding new variables into a helper file / function
Christian-Holbrook Nov 20, 2024
033e160
Merge branch 'master' into evaluate-roSGNode-Children
Christian-Holbrook Nov 20, 2024
eb0d1de
Return the container object
Christian-Holbrook Nov 21, 2024
8e7c450
Change the gate keeping logic to a nested if block instead of an earl…
Christian-Holbrook Nov 21, 2024
6d38fd4
Use $ instead of [[ ]]
Christian-Holbrook Nov 21, 2024
4e272a9
Add clarity to a test why a `2` showed up
TwitchBronBron Nov 25, 2024
a2158b8
Fix some lint errors in loops
TwitchBronBron Nov 25, 2024
a11b74c
Rename `insertCustomVariablesHelpers` and make it async
TwitchBronBron Nov 25, 2024
8f89a08
Make `createEvaluateContainer` `name` only accept a string
TwitchBronBron Nov 25, 2024
6ce25ec
Rename custom variable utils file
TwitchBronBron Nov 25, 2024
552d2c3
Revert integer thing.
TwitchBronBron Nov 25, 2024
aa729f9
Add unit tests for createEvaulateContainer with different children types
Christian-Holbrook Nov 26, 2024
fb66bbf
Merge branch 'master' into evaluate-roSGNode-Children
Christian-Holbrook Dec 2, 2024
5a3366b
Add clarifying comment
Christian-Holbrook Dec 3, 2024
e943865
Merge branch 'master' into evaluate-roSGNode-Children
TwitchBronBron Dec 3, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 2 additions & 28 deletions src/adapters/DebugProtocolAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { VariableType } from '../debugProtocol/events/responses/VariablesRespons
import type { TelnetAdapter } from './TelnetAdapter';
import type { DeviceInfo } from 'roku-deploy';
import type { ThreadsResponse } from '../debugProtocol/events/responses/ThreadsResponse';
import { insertCustomVariablesHelpers } from './InsertVariableHelper';

/**
* A class that connects to a Roku device over telnet debugger port and provides a standardized way of interacting with it.
Expand Down Expand Up @@ -598,34 +599,7 @@ export class DebugProtocolAdapter {
//this is the top-level container, so there are no parent keys to this entry
undefined
);
if (container?.value?.startsWith('roSGNode')) {
let nodeChildren = <EvaluateContainer>{
name: '[[children]]',
type: 'roArray',
highLevelType: 'array',
keyType: KeyType.integer,
presentationHint: 'virtual',
evaluateName: `${expression}.getChildren(-1, 0)`,
children: []
};
container.children.push(nodeChildren);
}
if (container.elementCount > 0 || container.type === 'Array') {
let nodeCount = <EvaluateContainer>{
name: '[[count]]',
evaluateName: container.elementCount.toString(),
type: 'number',
highLevelType: undefined,
keyType: undefined,
presentationHint: 'virtual',
value: container.elementCount.toString(),
elementCount: undefined,
children: []
};
container.children.push(nodeCount);
}

return container;
return insertCustomVariablesHelpers(this, expression, container);
}
}

Expand Down
35 changes: 35 additions & 0 deletions src/adapters/InsertVariableHelper.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import * as semver from 'semver';
import { KeyType } from './DebugProtocolAdapter';
import type { DebugProtocolAdapter, EvaluateContainer } from './DebugProtocolAdapter';

export function insertCustomVariablesHelpers(adapter: DebugProtocolAdapter, expression: string, container: EvaluateContainer) {
if (!semver.satisfies(adapter?.activeProtocolVersion, '<3.3.0')) {
Christian-Holbrook marked this conversation as resolved.
Show resolved Hide resolved
return;
}
if (container?.value?.startsWith('roSGNode')) {
let nodeChildren = <EvaluateContainer>{
name: '[[children]]',
type: 'roArray',
highLevelType: 'array',
keyType: KeyType.integer,
presentationHint: 'virtual',
evaluateName: `${expression}.getChildren(-1, 0)`,
children: []
};
container.children.push(nodeChildren);
}
if (container.elementCount > 0 || container.type === 'Array') {
let nodeCount = <EvaluateContainer>{
name: '[[count]]',
evaluateName: container.elementCount.toString(),
type: 'number',
highLevelType: undefined,
keyType: undefined,
presentationHint: 'virtual',
value: container.elementCount.toString(),
elementCount: undefined,
children: []
};
container.children.push(nodeCount);
}
}
Loading