@@ -845,23 +845,36 @@ index 9490e25363fb401bfc0dae094012675c1e8a5ba9..adfa224edb41f454732cb16ee66b2998
845845 setTheme: setTheme,
846846 remeasureFonts: remeasureFonts,
847847diff --git a/esm/vs/language/common/lspLanguageFeatures.js b/esm/vs/language/common/lspLanguageFeatures.js
848- index 12a49bd4ac441dcbf3db21a25fb15614294f17d8..85016213666ec595890f20192353a922df09a2cf 100644
848+ index 12a49bd4ac441dcbf3db21a25fb15614294f17d8..b5087cf444492a8bcabed2a748efcb9561175cde 100644
849849--- a/esm/vs/language/common/lspLanguageFeatures.js
850850+++ b/esm/vs/language/common/lspLanguageFeatures.js
851- @@ -138,8 +138,11 @@ class DiagnosticsAdapter {
851+ @@ -133,13 +133,23 @@ class DiagnosticsAdapter {
852+ this._disposables.length = 0;
853+ }
854+ _doValidate(resource, languageId) {
855+ + // PATCH: Enable workers to communicate that syntax validation is complete for a specific model version
856+ + const model = editor.getModel(resource);
857+ + if (!model) {
858+ + return;
859+ + }
860+ + const modelVersionId = model.getVersionId();
861+ this._worker(resource).then((worker) => {
862+ return worker.doValidation(resource.toString());
852863 }).then((diagnostics) => {
864+ + // PATCH: Enable workers to communicate that syntax validation is complete for a specific model version
865+ + // let model = editor.getModel(resource);
853866 const markers = diagnostics.map((d) => toDiagnostics(resource, d));
854- let model = editor.getModel(resource);
867+ - let model = editor.getModel(resource);
855868- if (model && model.getLanguageId() === languageId) {
856- + // PATCH: Gracefully handle the case where the model was disposed during async validation.
857- + if (model && !model.isDisposed() && model.getLanguageId() === languageId) {
869+ + // PATCH: Gracefully handle the case where the model changed or was disposed during async validation.
870+ + if (model && !model.isDisposed() && model.getLanguageId() === languageId && model.getVersionId() === modelVersionId ) {
858871 editor.setModelMarkers(model, languageId, markers);
859872+ // PATCH: Enable workers to communicate that syntax validation is complete for a specific model version
860- + editor.setModelVersionValidated(model, model.getVersionId() );
873+ + editor.setModelVersionValidated(model, modelVersionId );
861874 }
862875 }).then(void 0, (err) => {
863876 console.error(err);
864- @@ -482,26 +485 ,11 @@ class DocumentSymbolAdapter {
877+ @@ -482,26 +492 ,11 @@ class DocumentSymbolAdapter {
865878 if (!items) {
866879 return;
867880 }
@@ -1166,4 +1179,4 @@ index 414405319ded9b3671a070b7405b7150afaa8321..c8b924d17e513acb02b8f8a74b75d8a7
11661179+ const element = this.domNode.getRootNode().querySelector(`#${this._list.getElementID(index)}`);
11671180 if (element) {
11681181 element.style.width = 'auto';
1169- const width = element.getBoundingClientRect().width;
1182+ const width = element.getBoundingClientRect().width;
0 commit comments