Skip to content

Commit

Permalink
fix: "Invalid variable attributes" displayed in variables lists (#92)
Browse files Browse the repository at this point in the history
  • Loading branch information
satoren authored Feb 20, 2022
1 parent 0aa3cf2 commit e0d0fc5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/lrdbDebug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ export class LuaDebugSession extends DebugSession {
variablesData.forEach((v,i) => {
const typename = typeof v
const k = i + 1
const varRef = (typename == 'object') ? this._variableHandles.create(evalParam(k)) : undefined
const varRef = (typename == 'object') ? this._variableHandles.create(evalParam(k)) : 0
variables.push({
name: `${k}`,
type: typename,
Expand All @@ -522,7 +522,7 @@ export class LuaDebugSession extends DebugSession {
} else if (typeof variablesData === 'object') {
for (const k in variablesData) {
const typename = typeof variablesData[k]
const varRef = (typename == 'object') ? this._variableHandles.create(evalParam(k)) : undefined
const varRef = (typename == 'object') ? this._variableHandles.create(evalParam(k)) : 0
variables.push({
name: k,
type: typename,
Expand Down
4 changes: 4 additions & 0 deletions test/__snapshots__/debugadapter.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,19 @@ Object {
"name": "local_value1",
"type": "number",
"value": "1",
"variablesReference": 0,
},
Object {
"name": "local_value2",
"type": "string",
"value": "\\"abc\\"",
"variablesReference": 0,
},
Object {
"name": "local_value3",
"type": "number",
"value": "1",
"variablesReference": 0,
},
Object {
"name": "local_value4",
Expand All @@ -40,5 +43,6 @@ Object {
"name": "a",
"type": "number",
"value": "1",
"variablesReference": 0,
}
`;
1 change: 1 addition & 0 deletions test/debugadapter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ describe('Lua Debug Adapter', () => {
name: '_VERSION',
type: 'string',
value: '"Lua 5.3"',
variablesReference: 0
})
))
})
Expand Down

0 comments on commit e0d0fc5

Please sign in to comment.