Closed char0n closed 9 months ago
Looking at https://github.com/CodinGame/monaco-vscode-api/commit/a295d70ecda03f990fa2ea769973092bc8fa115d it seems it's been removed.
This documentation https://github.com/CodinGame/monaco-vscode-api#vscode-api-usage doesn't seem to be aligned with the actual code.
I figured I need to use:
import 'vscode/localExtensionHost';`
But it seems, that things will starts working only after I perform some action (like opening a command palette):
https://github.com/CodinGame/monaco-vscode-api/assets/193286/6317e9ff-0c93-427a-b7d3-47df01b39a23
I did dig deeper and the issue is with monaco service initialization. The simplest code to reproduce:
import { initialize as initializeMonacoServices } from 'vscode/services';
import 'vscode/localExtensionHost';
console.dir('initializing');
await initializeMonacoServices({});
console.dir('initialized');
initialized
is never printed and the promise returned from initializeMonacoServices
never resolves. Any idea what would be the problem?
Following seems to work; I'm performing some random service action which allows initialization to fall through (resolve).
import { initialize as initializeMonacoServices, StandaloneServices, IQuickInputService, } from 'vscode/services';
import 'vscode/localExtensionHost';
console.dir('initializing');
setTimeout(() => {
StandaloneServices.get(IQuickInputService).quickAccess.show('>', {
itemActivation: 0,
});
}, 0);
await initializeMonacoServices({});
console.dir('initialized');
Working on way to improve the changelog
This documentation https://github.com/CodinGame/monaco-vscode-api#vscode-api-usage doesn't seem to be aligned with the actual code.
Right, will fix
initialized is never printed and the promise returned from initializeMonacoServices never resolves. Any idea what would be the problem?
No idea, I'm interested if you find the cause of it
No idea, I'm interested if you find the cause of it
I fails in vscode/lifecycle.js
in
async function startup(instantiationService) {
specifically in:
await instantiationService.invokeFunction(async (accessor) => {
await Promise.all(( serviceInitializePostParticipants.map(participant => participant(accessor))));
});
This will never resolve. If I remove this code, everything works as expected.
The serviceInitializePostParticipants
list contains following single item:
It'll be fixed soon in #285
in the meantime, you can add this workaround:
import { IExtensionService } from 'vscode/vscode/vs/workbench/services/extensions/common/extensions'
import { registerServiceInitializeParticipant } from 'vscode/lifecycle'
registerServiceInitializeParticipant(accessor => accessor.get(IExtensionService))
import { IExtensionService } from 'vscode/vscode/vs/workbench/services/extensions/common/extensions' import { registerServiceInitializeParticipant } from 'vscode/lifecycle' registerServiceInitializeParticipant(accessor => accessor.get(IExtensionService))
I can confirm, the workaround works. Thanks!
Hi @CGNonofr,
It seems that following import now longer works:
initialize
is no longer part of that file. Affected version is@codingame/monaco-vscode-api@=1.83.15
.