Skip to content

Commit

Permalink
Merge branch 'master' into caught-uncaught-exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian-Holbrook authored Jan 7, 2025
2 parents 01c0b58 + f88ddde commit 7d2dfd7
Show file tree
Hide file tree
Showing 7 changed files with 181 additions and 107 deletions.
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0



## [0.21.13](https://github.com/rokucommunity/roku-debug/compare/v0.21.12...v0.21.13) - 2024-12-20
### Added
- Add `$children` virtual variables for `roSGNode` ([#192](https://github.com/rokucommunity/roku-debug/pull/192))
- Check for two error types. Make sure we do not double display an error ([#204](https://github.com/rokucommunity/roku-debug/pull/204))
- Add the missing `Diagnostic` props to `BSDebugDiagnostic` ([#203](https://github.com/rokucommunity/roku-debug/pull/203))
### Changed
- upgrade to [brighterscript@0.68.2](https://github.com/rokucommunity/brighterscript/blob/master/CHANGELOG.md#0682---2024-12-06). Notable changes since 0.67.8:
- Add more convenience exports from vscode-languageserver ([brighterscript#1359](https://github.com/rokucommunity/brighterscript/pull/1359))
- Fix issues with the ast walkArray function ([brighterscript#1347](https://github.com/rokucommunity/brighterscript/pull/1347))
- upgrade to [roku-deploy@3.12.3](https://github.com/rokucommunity/roku-deploy/blob/master/CHANGELOG.md#3123---2024-12-06). Notable changes since 3.12.2:
- Fix issues with detecting "check for updates required" ([roku-deploy#181](https://github.com/rokucommunity/roku-deploy/pull/181))
- Identify when a 577 error is thrown, send a new developer friendly message ([roku-deploy#180](https://github.com/rokucommunity/roku-deploy/pull/180))
### Fixed
- Fix cli bug ([#201](https://github.com/rokucommunity/roku-debug/pull/201))



## [0.21.12](https://github.com/rokucommunity/roku-debug/compare/v0.21.11...v0.21.12) - 2024-10-18
### Changed
- upgrade to [brighterscript@0.67.8](https://github.com/rokucommunity/brighterscript/blob/master/CHANGELOG.md#0678---2024-10-18). Notable changes since 0.67.7:
Expand Down
82 changes: 16 additions & 66 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "roku-debug",
"version": "0.21.12",
"version": "0.21.13",
"description": "Debug adapter for Roku application development using Node.js",
"main": "dist/index.js",
"scripts": {
Expand Down Expand Up @@ -74,9 +74,9 @@
"@types/request": "^2.48.8",
"@types/semver": "^7.3.9",
"@types/sinon": "^10.0.6",
"@types/yargs": "^15.0.5",
"@typescript-eslint/eslint-plugin": "^5.27.0",
"@typescript-eslint/parser": "^5.27.0",
"@types/yargs": "^15.0.5",
"chai": "^4.3.4",
"coveralls-next": "^4.2.0",
"decompress": "^4.2.1",
Expand All @@ -100,7 +100,7 @@
"@types/request": "^2.48.8",
"@vscode/debugadapter": "^1.68.0",
"@vscode/debugprotocol": "^1.68.0",
"brighterscript": "^0.68.1",
"brighterscript": "^0.68.2",
"dateformat": "^4.6.3",
"debounce": "^1.2.1",
"eol": "^0.9.1",
Expand All @@ -113,7 +113,7 @@
"postman-request": "^2.88.1-postman.40",
"replace-in-file": "^6.3.2",
"replace-last": "^1.2.6",
"roku-deploy": "^3.12.2",
"roku-deploy": "^3.12.3",
"semver": "^7.5.4",
"serialize-error": "^8.1.0",
"smart-buffer": "^4.2.0",
Expand Down
61 changes: 60 additions & 1 deletion src/adapters/DebugProtocolAdapter.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,9 @@ describe('DebugProtocolAdapter', function() {
container?.children.map(x => x.evaluateName)
).to.eql([
'person["name"]',
'person["age"]'
'person["age"]',
//For arrays or objects with children we add a $count property for the number of items or children
'2'
]);
//the top level object should be an AA
expect(container.type).to.eql(VariableType.AssociativeArray);
Expand All @@ -559,4 +561,61 @@ describe('DebugProtocolAdapter', function() {
expect(container.children[1].children).to.eql([]);
});
});

it('creates evaluate container with keyType string', () => {
let container = adapter['createEvaluateContainer'](
{
isConst: false,
isContainer: true,
refCount: 1,
type: VariableType.AssociativeArray,
value: undefined,
childCount: 1,
keyType: VariableType.String,
name: 'm',
children: [{
isConst: false,
isContainer: true,
refCount: 1,
type: VariableType.AssociativeArray,
value: undefined,
childCount: 0,
keyType: VariableType.String,
name: 'child'
}]
},
'm',
undefined
);
expect(container.children[0].evaluateName).to.eql('m["child"]');
});

it('creates evaluate container with keyType integer', () => {
let container = adapter['createEvaluateContainer'](
{
isConst: false,
isContainer: true,
refCount: 1,
type: VariableType.AssociativeArray,
value: undefined,
childCount: 1,
keyType: VariableType.Integer,
name: 'm',
children: [{
isConst: false,
isContainer: true,
refCount: 1,
type: VariableType.AssociativeArray,
value: undefined,
childCount: 0,
keyType: VariableType.Integer,
name: 'child'
}]
},
'm',
undefined
);
expect(container.children[0].evaluateName).to.eql('m[0]');
});

});
10 changes: 6 additions & 4 deletions src/adapters/DebugProtocolAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import type { TelnetAdapter } from './TelnetAdapter';
import type { DeviceInfo } from 'roku-deploy';
import type { ThreadsResponse } from '../debugProtocol/events/responses/ThreadsResponse';
import type { ExceptionBreakpoint } from '../debugProtocol/events/requests/SetExceptionBreakpointsRequest';
import { insertCustomVariables } from './customVariableUtils';

/**
* 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 @@ -620,6 +621,7 @@ export class DebugProtocolAdapter {
//this is the top-level container, so there are no parent keys to this entry
undefined
);
await insertCustomVariables(this, expression, container);
return container;
}
}
Expand Down Expand Up @@ -658,7 +660,7 @@ export class DebugProtocolAdapter {
* @param name the name of this variable. For example, `alpha.beta.charlie`, this value would be `charlie`. For local vars, this is the root variable name (i.e. `alpha`)
* @param parentEvaluateName the string used to derive the parent, _excluding_ this variable's name (i.e. `alpha.beta` or `alpha[0]`)
*/
private createEvaluateContainer(variable: Variable, name: string, parentEvaluateName: string) {
private createEvaluateContainer(variable: Variable, name: string | number, parentEvaluateName: string) {
let value;
let variableType = variable.type;
if (variable.value === null) {
Expand All @@ -680,15 +682,15 @@ export class DebugProtocolAdapter {
//build full evaluate name for this var. (i.e. `alpha["beta"]` + ["charlie"]` === `alpha["beta"]["charlie"]`)
let evaluateName: string;
if (!parentEvaluateName?.trim()) {
evaluateName = name;
evaluateName = name?.toString();
} else if (typeof name === 'string') {
evaluateName = `${parentEvaluateName}["${name}"]`;
} else if (typeof name === 'number') {
evaluateName = `${parentEvaluateName}[${name}]`;
}

let container: EvaluateContainer = {
name: name ?? '',
name: name?.toString() ?? '',
evaluateName: evaluateName ?? '',
type: variableType ?? '',
value: value ?? null,
Expand All @@ -707,7 +709,7 @@ export class DebugProtocolAdapter {
const childVariable = variable.children[i];
const childContainer = this.createEvaluateContainer(
childVariable,
container.keyType === KeyType.integer ? i.toString() : childVariable.name,
container.keyType === KeyType.integer ? i : childVariable.name,
container.evaluateName
);
container.children.push(childContainer);
Expand Down
Loading

0 comments on commit 7d2dfd7

Please sign in to comment.