Dynamically adding extra lib is not working on 0.39.0 version. It was working fine till 0.28.0 version.
Below are the play ground link of 0.39.0 and 0.28.0
After playground editors are loaded, please follow the below steps to reproduce the issue:
step1 - Click on Second_injection button.
step2 - Click on Third_injection button.
step3 - Click on First_injection button.
After step3, editor should not show the error for test.descriptionfirst property, because we injected the first library again on button click. But it is still showing the error in 0.39.0 version. Same workflow working fine in 0.28.0 version.
const value = /* set from `myEditor.getModel()`: */ `function hello() {
alert('Hello world!');
}
var test:Test;
test.descriptionfirst;`;
// Hover on each property to see its docs!
const myEditor = monaco.editor.create(document.getElementById("container"), {
value,
language: "typescript",
automaticLayout: true,
});
var library = "declare class Test { descriptionfirst:string; } ";
let testDisposable1 = monaco.languages.typescript.typescriptDefaults.addExtraLib(library, monaco.Uri.file("test.d.ts").toString());
let testDisposable2 = monaco.languages.typescript.javascriptDefaults.addExtraLib(library, monaco.Uri.file("test.d.ts").toString());
var firstInjectTest = function firstInjectTest() {
testDisposable1.dispose();
testDisposable2.dispose();
let library = "declare class Test { descriptionfirst:string; } ";
testDisposable1 = monaco.languages.typescript.typescriptDefaults.addExtraLib(library, monaco.Uri.file("test.d.ts").toString());
testDisposable2 = monaco.languages.typescript.javascriptDefaults.addExtraLib(library, monaco.Uri.file("test.d.ts").toString());
alert('First library Injection\n LibraryClass: '+library);
}
window['firstInjectTest'] = firstInjectTest;
var secondInjectTest = function secondInjectTest() {
testDisposable1.dispose();
testDisposable2.dispose();
let library = "declare class Test { descriptionsecond:string; } ";
testDisposable1 = monaco.languages.typescript.typescriptDefaults.addExtraLib(library, monaco.Uri.file("test.d.ts").toString());
testDisposable2 = monaco.languages.typescript.javascriptDefaults.addExtraLib(library, monaco.Uri.file("test.d.ts").toString());
alert('Second library Injection \n LibraryClass: '+library);
}
window['secondInjectTest'] = secondInjectTest;
var thirdInjectTest = function thirdInjectTest() {
testDisposable1.dispose();
testDisposable2.dispose();
let library = "declare class Test { descriptionthird:string; } ";
testDisposable1 = monaco.languages.typescript.typescriptDefaults.addExtraLib(library, monaco.Uri.file("test.d.ts").toString());
testDisposable2 = monaco.languages.typescript.javascriptDefaults.addExtraLib(library, monaco.Uri.file("test.d.ts").toString());
alert('Third library Injection \n LibraryClass: '+library);
}
window['thirdInjectTest'] = thirdInjectTest;
// HTML CODE
<br><br>
<input type = "button" value="First_Injection" onclick = "firstInjectTest();" />
<br><br>
<input type = "button" value="Second_Injection" onclick = "secondInjectTest();" />
<br><br>
<input type = "button" value="Third_Injection" onclick = "thirdInjectTest();" />
<div id="container" style="height: 100%"></div>
Reproduction Steps
After playground editors are loaded, please follow the below steps to reproduce the issue:
step1 - Click on Second_injection button.
step2 - Click on Third_injection button.
step3 - Click on First_injection button.
After step3, editor should not show the error for test.descriptionfirst property, because we injected the first library again on First_injection button click. But it is still showing the error in 0.39.0 version. Same workflow working fine in 0.28.0 version.
Actual (Problematic) Behavior
If we dynamically dispose the library and add again with changes, first time it work fine but from the second time it is not working in 0.39.0 version but and I check in earlier version the same workflow was working till 0.28.0 version.
I have mentioned steps to reproduce the issue in Reproduction Steps.
It should dynamically dispose the previous library and add changed library and also should show the intelligence for change library even if we repeat the steps multiple times.
After step3, editor should not show the error for test.descriptionfirst property, because we injected the first library again on First_injection button click. But it is still showing the error in 0.39.0 version. Same workflow working fine in 0.28.0 version.
Reproducible in vscode.dev or in VS Code Desktop?
Reproducible in the monaco editor playground?
Monaco Editor Playground Link
Dynamically adding extra lib is not working on 0.39.0 version. It was working fine till 0.28.0 version.
Below are the play ground link of 0.39.0 and 0.28.0
After playground editors are loaded, please follow the below steps to reproduce the issue: step1 - Click on Second_injection button. step2 - Click on Third_injection button. step3 - Click on First_injection button.
After step3, editor should not show the error for test.descriptionfirst property, because we injected the first library again on button click. But it is still showing the error in 0.39.0 version. Same workflow working fine in 0.28.0 version.
Playground_V_0.39.0
Playground_V_0.28.0
Monaco Editor Playground Code
Reproduction Steps
After playground editors are loaded, please follow the below steps to reproduce the issue: step1 - Click on Second_injection button. step2 - Click on Third_injection button. step3 - Click on First_injection button.
After step3, editor should not show the error for test.descriptionfirst property, because we injected the first library again on First_injection button click. But it is still showing the error in 0.39.0 version. Same workflow working fine in 0.28.0 version.
Actual (Problematic) Behavior
If we dynamically dispose the library and add again with changes, first time it work fine but from the second time it is not working in 0.39.0 version but and I check in earlier version the same workflow was working till 0.28.0 version. I have mentioned steps to reproduce the issue in Reproduction Steps.
Playground_V_0.39.0
Playground_V_0.28.0
Expected Behavior
It should dynamically dispose the previous library and add changed library and also should show the intelligence for change library even if we repeat the steps multiple times.
After step3, editor should not show the error for test.descriptionfirst property, because we injected the first library again on First_injection button click. But it is still showing the error in 0.39.0 version. Same workflow working fine in 0.28.0 version.
Additional Context
No response