Skip to content

Commit

Permalink
#29 fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Traineratwot committed May 9, 2024
1 parent 1a7faad commit ac2d15d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/components/CodeMirror.vue
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,17 @@ const opt: hoverOptions = {
break
case "sd":
label = l.args[0].toString()
deviceId = label
deviceId = env.getAlias(label, true)
prop = l.args[1].toString()
break
case "ld":
label = l.args[1].toString()
deviceId = label
deviceId = env.getAlias(label, true)
prop = l.args[2].toString()
break
}
if (deviceId && prop) {
new_text = `${label}[${prop}] = ` + env.getDeviceProp(deviceId, prop)
new_text = `${label}[${prop}] = ` + env.getDeviceProp(deviceId.toString(), prop)
}
}
}
Expand Down
7 changes: 7 additions & 0 deletions src/core/Env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@ class Env extends DevEnv<{ update: () => void; update_code: () => void }> {
this.preAlias.set(l?.args[0]?.toString(), l?.args[1])
}
})
this.lines
.filter((l) => l?.fn === "define")
.forEach((l) => {
if (l?.args[0] && l?.args[1]) {
this.preAlias.set(l?.args[0]?.toString(), Number(l?.args[1]))
}
})
this.emit("update")
}

Expand Down

0 comments on commit ac2d15d

Please sign in to comment.