Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Updating extra lib not working after dispose in 0.39.0 version. It is working fine till version 0.28.0 #4023

Open
1 of 2 tasks
DharmendraSendhav opened this issue Jun 13, 2023 · 3 comments · May be fixed by #4544
Open
1 of 2 tasks
Labels
bug Issue identified by VS Code Team member as probable bug typescript typescript-multifile

Comments

@DharmendraSendhav
Copy link

Reproducible in vscode.dev or in VS Code Desktop?

  • Not reproducible in vscode.dev or 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

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.

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

@DharmendraSendhav DharmendraSendhav changed the title Updating extra lib not working after dispose in 0.39.0 version. It is working fine till version 0.28.0 [Bug] Updating extra lib not working after dispose in 0.39.0 version. It is working fine till version 0.28.0 Jun 13, 2023
@hediet hediet added bug Issue identified by VS Code Team member as probable bug typescript typescript-multifile labels Jun 14, 2023
@hediet
Copy link
Member

hediet commented Jun 14, 2023

Can verify that it works in 0.28.1 but breaks in 0.29.0.

@DharmendraSendhav
Copy link
Author

Yes, in 0.28.1, it is working but in 0.29.0 it is not working.

@BTBMan
Copy link

BTBMan commented Mar 4, 2024

+1, The same problem for me, I found this #1998, but still don't know how to fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue identified by VS Code Team member as probable bug typescript typescript-multifile
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants