diff --git a/playground/src/editor.tsx b/playground/src/editor.tsx index 8059f809ce..69d4c80b5d 100644 --- a/playground/src/editor.tsx +++ b/playground/src/editor.tsx @@ -110,15 +110,10 @@ export function Editor(props: { >([]); const [hasCheckErrors, setHasCheckErrors] = useState(false); - function markErrors(version?: number) { + function markErrors() { const model = editor.current?.getModel(); if (!model) return; - if (version != null && version !== model.getVersionId()) { - // Diagnostics event received for an outdated model - return; - } - const errs = [ ...errMarks.current.checkDiags, ...errMarks.current.shotDiags, @@ -260,7 +255,11 @@ export function Editor(props: { // will be invalid as it captures the *original* props.languageService // and not the updated one. Not a problem currently since the language // service is never updated, but not correct either. - srcModel.onDidChangeContent(async () => { + srcModel.onDidChangeContent(async (e) => { + e.changes.forEach((change) => { + log.debug("changes for version %d are: %o", e.versionId, change); + }); + // Reset the shot errors whenever the document changes. // The markers will be refreshed by the onDiagnostics callback // when the language service finishes checking the document. @@ -304,7 +303,7 @@ export function Editor(props: { function onDiagnostics(evt: LanguageServiceEvent) { const diagnostics = evt.detail.diagnostics; errMarks.current.checkDiags = diagnostics; - markErrors(evt.detail.version); + markErrors(); setHasCheckErrors( diagnostics.filter((d) => d.severity === "error").length > 0, );