Currently enhancing an extension that is almost finished, but facing a challenge in adding visual cues for lengthy operations. Initially suspected a missing async/await in the code, but struggling to identify the cause. The progress indicator isn't displaying until after the operation completes, and isolating the method blocking the UI thread (commenting it out resolves the issue) led me to discover that the culprit is from an external package in use.
Below is a condensed snippet of the code I'm working with:
import { composeAndValidate } from "@apollo/federation";
vscode.window.withProgress(
{
location: vscode.ProgressLocation.Notification,
title: 'Composing',
cancellable: false
},
async progress => {
const sdls = await getSdls()
//The call to composeAndValidate is blocking UI thread
const results = composeAndValidate(sdls);
...some other code
})
//Somewhere else
async function getSdls(){
... async stuff
return [{name: 'test', typeDefs: 'type Query { me: String }`}];
}
Seems like delving deeper into the @apollo/federation
library may be necessary, though no Promises are visibly used in those methods (yet to explore further on the graphql-js
side). Any suggestions on investigating ways to unblock the UI thread? While most scenarios operate smoothly, larger designs within my extension result in a ~3s delay without triggering VS Code's termination, just causing temporary confusion.