Skip to content

Commit 1ac01cb

Browse files
committed
fix(monaco): address timing issue in validation patch
Signed-off-by: John Yanarella <jyanarella@nvidia.com>
1 parent 76e5b06 commit 1ac01cb

3 files changed

Lines changed: 27 additions & 14 deletions

File tree

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
"@semantic-release/commit-analyzer": "13.0.1",
3535
"@semantic-release/exec": "7.1.0",
3636
"@semantic-release/git": "10.0.1",
37+
"@semantic-release/github": "12.0.6",
3738
"@semantic-release/npm": "13.1.5",
3839
"@semantic-release/release-notes-generator": "14.1.0",
3940
"@weiran.zsd/multi-eslint-rule-config": "0.0.6",
@@ -48,8 +49,7 @@
4849
"semantic-release-replace-plugin": "1.2.7",
4950
"tar": "7.5.11",
5051
"unzipper": "0.12.3",
51-
"wireit": "0.14.12",
52-
"@semantic-release/github": "12.0.6"
52+
"wireit": "0.14.12"
5353
},
5454
"lint-staged": {
5555
"**/*": "prettier --write --ignore-unknown",

patches/monaco-editor.patch

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -845,23 +845,36 @@ index 9490e25363fb401bfc0dae094012675c1e8a5ba9..adfa224edb41f454732cb16ee66b2998
845845
setTheme: setTheme,
846846
remeasureFonts: remeasureFonts,
847847
diff --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;

pnpm-lock.yaml

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)