TypeFox / monaco-languageclient

Repo hosts npm packages for monaco-languageclient, vscode-ws-jsonrpc, monaco-editor-wrapper, @typefox/monaco-editor-react and monaco-languageclient-examples
https://www.npmjs.com/package/monaco-languageclient
MIT License
1.05k stars 178 forks source link

monaco-languageclient and associated packages do not work when using bun as a package manager #632

Closed zzullick closed 1 month ago

zzullick commented 5 months ago

Hello, I attempted to use the @typefox/monaco-editor-react and monaco-languageclient packages, and kept having trouble getting the editor to initialize and very slow loading times when initially attempting to load the application. The vscode services appear to partially load then hang forever, when looking at the console output with the services debugLogging enabled.

I was initially using bun to install packages and run the dev server (vite) with the commands bun i and bun run dev respectively. I tried switching to npm i and npm run dev and it worked as expected.

Versions used:

    "@codingame/monaco-vscode-python-default-extension": "~3.2.3",
    "@typefox/monaco-editor-react": "^3.0.2",
    "monaco-editor": "npm:@codingame/monaco-vscode-editor-api@~3.2.3",
    "monaco-languageclient": "^8.1.1",
    "pyright": "^1.1.357",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "vscode": "npm:@codingame/monaco-vscode-api@~3.2.3"

Specifically, it stops at this point and hangs:

Initializing vscode services. Caller: monaco-editor (89) [services.ts:76:24](http://localhost:5174/node_modules/monaco-languageclient/src/vscode/services.ts)
Loading service: fileService [services.ts:54:20](http://localhost:5174/node_modules/monaco-languageclient/src/vscode/services.ts)
Loading service: textFileService [services.ts:54:20](http://localhost:5174/node_modules/monaco-languageclient/src/vscode/services.ts)
Loading service: filesConfigurationService [services.ts:54:20](http://localhost:5174/node_modules/monaco-languageclient/src/vscode/services.ts)
Loading service: elevatedFileService [services.ts:54:20](http://localhost:5174/node_modules/monaco-languageclient/src/vscode/services.ts)
Loading service: labelService [services.ts:54:20](http://localhost:5174/node_modules/monaco-languageclient/src/vscode/services.ts)
Loading service: configurationService [services.ts:54:20](http://localhost:5174/node_modules/monaco-languageclient/src/vscode/services.ts)
Loading service: contextService [services.ts:54:20](http://localhost:5174/node_modules/monaco-languageclient/src/vscode/services.ts)
Loading service: textResourceConfigurationService [services.ts:54:20](http://localhost:5174/node_modules/monaco-languageclient/src/vscode/services.ts)
Loading service: workspaceEditingService [services.ts:54:20](http://localhost:5174/node_modules/monaco-languageclient/src/vscode/services.ts)
Loading service: workspacesService [services.ts:54:20](http://localhost:5174/node_modules/monaco-languageclient/src/vscode/services.ts)
Loading service: textResourcePropertiesService [services.ts:54:20](http://localhost:5174/node_modules/monaco-languageclient/src/vscode/services.ts)
Loading service: themeService [services.ts:54:20](http://localhost:5174/node_modules/monaco-languageclient/src/vscode/services.ts)
Loading service: textMateTokenizationFeature [services.ts:54:20](http://localhost:5174/node_modules/monaco-languageclient/src/vscode/services.ts)
Loading service: languageService [services.ts:54:20](http://localhost:5174/node_modules/monaco-languageclient/src/vscode/services.ts)
Loading service: ILanguageStatusService [services.ts:54:20](http://localhost:5174/node_modules/monaco-languageclient/src/vscode/services.ts)
Loading service: textModelService [services.ts:54:20](http://localhost:5174/node_modules/monaco-languageclient/src/vscode/services.ts)

​ Are there any known workarounds or additional configuration necessary to being able to use bun as a package manager for these packages? Happy to provide a repro if helpful. Thanks!

kaisalmen commented 5 months ago

@zzullick I have not used bun so far, so I can't tell. It could verify well be that vite+bun doesn't work well, but again I can't tell, because I had no reason to try bun so far.

When you use the vite dev server for the first or use the debug mode that invalidates the cache on start-up it takes a couple of seconds to process all the dependencies, afterwards loading times are quick.

Mw3y commented 2 months ago

@zzullick have you tried upgrading bun to the latest version? I'm currently using it and not having any issue.

kaisalmen commented 1 month ago

have you tried upgrading bun to the latest version? I'm currently using it and not having any issue.

@Mw3y thank you for reporting this. I will close this issue now.