editor repaints any errors when rendered (#3260)
* editor repaints any errors when rendered Signed-off-by: Jess Frazelle <github@jessfraz.com> * Update src/lang/KclSingleton.ts * fix test Signed-off-by: Jess Frazelle <github@jessfraz.com> * fix typo --------- Signed-off-by: Jess Frazelle <github@jessfraz.com> Co-authored-by: Kurt Hutten <k.hutten@protonmail.ch>
This commit is contained in:
@ -193,6 +193,10 @@ export const KclEditorPane = () => {
|
||||
if (_editorView === null) return
|
||||
|
||||
editorManager.setEditorView(_editorView)
|
||||
|
||||
// On first load of this component, ensure we show the current errors
|
||||
// in the editor.
|
||||
kclManager.setDiagnosticsForCurrentErrors()
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
|
@ -91,12 +91,16 @@ export class KclManager {
|
||||
set kclErrors(kclErrors) {
|
||||
if (kclErrors === this._kclErrors && this.lints.length === 0) return
|
||||
this._kclErrors = kclErrors
|
||||
let diagnostics = kclErrorsToDiagnostics(kclErrors)
|
||||
this.setDiagnosticsForCurrentErrors()
|
||||
this._kclErrorsCallBack(kclErrors)
|
||||
}
|
||||
|
||||
setDiagnosticsForCurrentErrors() {
|
||||
let diagnostics = kclErrorsToDiagnostics(this.kclErrors)
|
||||
if (this.lints.length > 0) {
|
||||
diagnostics = diagnostics.concat(this.lints)
|
||||
}
|
||||
editorManager.setDiagnostics(diagnostics)
|
||||
this._kclErrorsCallBack(kclErrors)
|
||||
}
|
||||
|
||||
addKclErrors(kclErrors: KCLError[]) {
|
||||
|
Reference in New Issue
Block a user