Skip to content

Commit a667f3b

Browse files
authored
📺 frontend: Reset error highlight on start (#119)
Reset error highlight on start (run), so that the error highlight so that we accurately display new errors or no errors if they are gone. Previously errors only got reset if the line was updated which incorrectly kept error line highlight for follow-on errors, e.g.: x := "foo" // line 1: 'x' declared but not used print y // line 2: unknown variable name 'y' Fixed as x := "foo" // 💣 error remained: line 1: 'x' declared but not used print x // no error Now all errors get reset. Pull-Request: #119
1 parent 6e49107 commit a667f3b

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

frontend/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ async function start() {
203203
stopped = false
204204
errors = false
205205
wasmInst = await WebAssembly.instantiate(wasmModule, go.importObject)
206+
editor.update({ errorLines: {} })
206207
clearOutput()
207208

208209
const runButton = document.querySelector("#run")

frontend/module/yace-editor.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ export default class Yace {
7777

7878
if (
7979
(value === this.value || value == null) &&
80+
Object.keys(this.errorLines).length === 0 &&
8081
(!errorLines || Object.keys(errorLines).length === 0)
8182
) {
8283
return

0 commit comments

Comments
 (0)