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

yo langium results in "initialize" is not exported by "node_modules/vscode/extensions.js" #1315

Closed
frademacher opened this issue Dec 7, 2023 · 10 comments
Labels
bug Something isn't working yeoman Yeoman generator related issue
Milestone

Comments

@frademacher
Copy link

Steps To Reproduce

  1. Install Langium as described at https://langium.org/docs/getting-started (my node version is v20.10.0 and my npm version is 10.2.5).
  2. Run yo langium, and use default "Hello World" values for extension name, language name, and file extensions. Also, reply Yes to the questions for VSCode extension, CLI inclusion, and web worker inclusion.

The current behavior

During the execution of yo langium, and more precisely at the following step

> hello-world@0.0.1 build:bundle
> vite --config ./vite.bundle.config.ts build

vite v4.4.12 building for production...

I run into the following error:

"initialize" is not exported by "node_modules/vscode/extensions.js", imported by "node_modules/monaco-languageclient/lib/monaco-vscode-api-services.js".
file: /home/florian/Downloads/hello-world/node_modules/monaco-languageclient/lib/monaco-vscode-api-services.js:6:9
4:  * ------------------------------------------------------------------------------------------ */
5: import { ILogService, initialize, StandaloneServices } from 'vscode/services';
6: import { initialize as initializeVscodeExtensions } from 'vscode/extensions';
            ^
7: import getLanguagesServiceOverride from '@codingame/monaco-vscode-languages-service-override';
8: import getModelServiceOverride from '@codingame/monaco-vscode-model-service-override';
...
An error occured while running langium:app#install
Error langium 

Command failed with exit code 1: npm run build:web

Unfortunately, I'm not very familiar with Node.js but could find the following oddities (at least they seem odd to me):

  • The package.json in the generated hello-world folder states that the generated Langium project depends on vscode-languageclient ~9.0.1 and monaco-languageclient ~6.6.0.
  • monaco-languageclient ~6.6.0 seems to however depend on vscode-languageclient ~8.1.0.
  • monaco-languageclient ~7.2.0 seems to plan to get rid of the erroneous import of the initialize function from vscode/extensions (possibly because vscode-languageclient ~9.0.1 doesn't provide it anymore or elsewhere).

Could it be that yo langium should generate a dependency on vscode-languageclient ~8.1.0 rather than vscode-languageclient ~9.0.1 to be compatible with monaco-languageclient ~6.6.0; or, alternatively, have generated projects depend on (the upcoming?) monaco-languageclient ~7.2.0 in case vscode-languageclient ~9.0.1 is required?

If you could use the generated hello-world Langium project please let me know. However, as stated above, I just invoke yo langium following https://langium.org/docs/getting-started to run into the above error (this behavior is repeatable).

As a side note: When executing npm list langium in the generated hello-world folder I get the following response:

hello-world@0.0.1
├─┬ langium-cli@2.1.0
│ ├─┬ langium-railroad@2.1.0
│ │ └── langium@2.1.3 deduped
│ └── langium@2.1.3 deduped
└── langium@2.1.3

The expected behavior

Behave as described at https://langium.org/docs/getting-started after the successful execution of yo langium.

@frademacher frademacher added the bug Something isn't working label Dec 7, 2023
@msujew
Copy link
Member

msujew commented Dec 7, 2023

Note that this is only relevant for developers answering the web worker question with yes. We cannot downgrade the vscode-languageserver dependency, as Langium depends on that itself.

@msujew msujew added the yeoman Yeoman generator related issue label Dec 7, 2023
@msujew
Copy link
Member

msujew commented Dec 7, 2023

cc @kaisalmen Any idea why this appears in the first place?

@kaisalmen
Copy link
Contributor

@msujew was just writing something. 🙂 @frademacher the template needs to be adjusted. I simply forgot that. A PR will come very soon. v7 of monaco-languageclient uses the newer vscode-languageclient as well.

And we need to prevent that incompatible version of @codingame/monaco-vscode-api are installed. Its versions are coupled to
vscode versioning and therefore patch versions are not what they seem to be. We should change that, too. I will open an issue there as well.

@frademacher
Copy link
Author

Thanks a lot for your prompt responses and technical clarifications @msujew @kaisalmen. I can confirm that the issue is not existent when responding with No to yo langium's question for web worker inclusion (as pointed out by Mark in #1315 (comment)). For my current endeavors, this workaround is perfectly fine, thanks :-)

@hyphappy011
Copy link

changed package.json config with "monaco-editor-wrapper": "~3.5.0", can work fine.

@tobiashochguertel
Copy link

Do we have a workaround for this issue? I don't get it so far.

@medihack
Copy link

As a new Langium user, I also stumbled across this problem. I am especially interested in the web worker integration. I already used Monaco with Chevrotain in a web worker before, but have some hopes that Langium could make some things easier. Is a fix planned for the web worker integration, or is it dependent on some 3rd party package that the Langium project doesn't have any influence on?

@kaisalmen
Copy link
Contributor

Hi @medihack this has been fixed with #1317 but there was not official release after 2.1.3. v3 got delayed a bit.

As a workaround you can apply the changes from the PR locally. Only the template adjustments are required. And then run the generator. A new official release should become available before the end of January.

@kaisalmen
Copy link
Contributor

Hi @tobiashochguertel sorry I missed your question. The workaround sketched above ⬆️ should get it going.

@msujew
Copy link
Member

msujew commented Apr 25, 2024

This has been fixed with the 3.0 release.

@msujew msujew closed this as completed Apr 25, 2024
@spoenemann spoenemann added this to the v3.0.0 milestone May 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working yeoman Yeoman generator related issue
Projects
None yet
Development

No branches or pull requests

7 participants