Skip to content

chore: patching diagnostics kcl lsp error (symptom, not root cause) #7977

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions src/lang/KclSingleton.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,20 @@ export class KclManager extends EventTarget {
}

setDiagnosticsForCurrentErrors() {
this.singletons.editorManager?.setDiagnostics(this.diagnostics)
this._diagnosticsCallback(this.diagnostics)
let diagnostics = this.diagnostics
const codeIsEmptyString = this.singletons.codeManager.code.trim() === ''
if (codeIsEmptyString && diagnostics.length > 0) {
/**
* If the current code is the empty string, why would there be diagnostics on an empty string?
* The entire editor should be cleared. It cannot have diagnostics for '' since we do not
* tell the user if the editor is completely blank.
*/
console.error('attempted diagnostics:', this.diagnostics)
diagnostics = []
}

this.singletons.editorManager?.setDiagnostics(diagnostics)
this._diagnosticsCallback(diagnostics)
}

get isExecuting() {
Expand Down
Loading