Sketch mode more tolerant to syntax errors (#4056)
* add fix * add test * typos * clean up
This commit is contained in:
@ -43,6 +43,7 @@ export class KclManager {
|
||||
digest: null,
|
||||
}
|
||||
private _programMemory: ProgramMemory = ProgramMemory.empty()
|
||||
lastSuccessfulProgramMemory: ProgramMemory = ProgramMemory.empty()
|
||||
private _logs: string[] = []
|
||||
private _lints: Diagnostic[] = []
|
||||
private _kclErrors: KCLError[] = []
|
||||
@ -297,6 +298,9 @@ export class KclManager {
|
||||
// Do not add the errors since the program was interrupted and the error is not a real KCL error
|
||||
this.addKclErrors(isInterrupted ? [] : errors)
|
||||
this.programMemory = programMemory
|
||||
if (!errors.length) {
|
||||
this.lastSuccessfulProgramMemory = programMemory
|
||||
}
|
||||
this.ast = { ...ast }
|
||||
this._executeCallback()
|
||||
this.engineCommandManager.addCommandLog({
|
||||
@ -342,6 +346,9 @@ export class KclManager {
|
||||
this._logs = logs
|
||||
this._kclErrors = errors
|
||||
this._programMemory = programMemory
|
||||
if (!errors.length) {
|
||||
this.lastSuccessfulProgramMemory = programMemory
|
||||
}
|
||||
if (updates !== 'artifactRanges') return
|
||||
|
||||
// TODO the below seems like a work around, I wish there's a comment explaining exactly what
|
||||
|
Reference in New Issue
Block a user