[Bug] lazily adding extra libs did not trigger re-validation of semantic
See original GitHub issueReproducible in vscode.dev or in VS Code Desktop?
- Not reproducible in vscode.dev or VS Code Desktop
Reproducible in the monaco editor playground?
- Not reproducible in the monaco editor playground
Monaco Editor Playground Code
monaco.languages.typescript.typescriptDefaults.setDiagnosticsOptions({
// I don't want to disable semantic validation.
noSemanticValidation: false,
noSyntaxValidation: false
});
function addLib() {
console.log('adding lib...');
// extra libraries
var libSource = [
'declare class Facts {',
' /**',
' * Returns the next fact',
' */',
' static next():string',
'}'
].join('\n');
var libUri = 'ts:filename/facts.d.ts';
monaco.languages.typescript.typescriptDefaults.addExtraLib(libSource, libUri);
monaco.editor.createModel(libSource, 'typescript', monaco.Uri.parse(libUri));
}
var jsCode = [
'"use strict";',
'',
'class Chuck {',
' greet() {',
' return Facts.next();',
' }',
'}'
].join('\n');
monaco.editor.create(document.getElementById('container'), {
value: jsCode,
language: 'typescript'
});
// `setEagerModelSync` would not help here.
// monaco.languages.typescript.typescriptDefaults.setEagerModelSync(true);
// Simulate adding libs lazily.
setTimeout(addLib, 2000);
// Changing timeout to `0` will make it work.
Actual Behavior
It shows Cannot find name 'Facts'
while it shows class Facts
above which indicates the lib has been loaded.
And when I make any edits, the error disappears.
I tried add monaco.languages.typescript.typescriptDefaults.setEagerModelSync(true)
but it didn’t help.
I think a re-validation of semantic should be done automatically after adding libs. Or Monaco should expose an API to do this.
Expected Behavior
Expect the error message disappears after libs loaded.
Additional Context
No response
Issue Analytics
- State:
- Created 2 years ago
- Comments:9 (2 by maintainers)
Top Results From Across the Web
Semantic-UI avoid trigger form validation for some click events
My form has some buttons and validation is triggered when any of them is clicked. I need to avoid that from some of...
Read more >Bug List
Bugzilla – Bug List ... This list is too long for Bugzilla's little mind; ... Code assist to insert method does not work...
Read more >RELEASE-NOTES - platform/external/e2fsprogs - Git at Google
Fixed e2image -I so it works on image files which are larger than 2GB. Fixed e2fsck's handling of directory inodes with a corrupt...
Read more >Ember Changelog - GitHub
#19868 [BUGFIX] Fix a bug with the implicit injections deprecation that meant injecting a store to avoid the deprecation did not work.
Read more >Change log for 4.8.43
Bug 2030698: KubePodCrashLooping may fire when pod is not in ... Add changelog for release 1.2 #148; fix: use pv annotation to trigger...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Done.
Yes
@alexdima Could you provide your estimates on this? Or maybe any workarounds? We’re heavily relying on this and can’t downgrade as several other bugs were resolved in the new version.