eclipse-langium / langium

Next-gen language engineering / DSL framework
https://langium.org/
MIT License
665 stars 61 forks source link

'vscode' in 'dependencies' instead of 'devDependencies' #1414

Closed anthonyjclark closed 3 months ago

anthonyjclark commented 3 months ago

When following the Building an Extension tutorial, I ran into the following error message:

❯ vsce package
(node:55696) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
 ERROR  You should not depend on 'vscode' in your 'dependencies'. Did you mean to add it to 'devDependencies'?

Langium version: langium@3.0.0

Steps To Reproduce

  1. Follow the tutorials starting from the beginning
  2. Encounter error on step running the vsce package command

The current behavior

The error described above.

The expected behavior

Building an extension for VS Code.

Possible Solution

I was able to fix the issue by moving this line:

    "dependencies": {
        ...
        "vscode": "npm:@codingame/monaco-vscode-api@1.83.16"
        ...
    }

To devDependencies.

The error seems to have been introduced by #1205.

msujew commented 3 months ago

That's not an error (at least not one on our side). The vscode dependency used in there is a very special runtime dependency that implements the whole vscode API on top of monaco. It is not intended to be used in vscode extensions.

In order to build a vscode extension, you will need to split the generated project into multiple npm workspaces. It might make sense to add this to the yeoman generator by default, but the behavior exhibited here is correct. One could argue that vsce is at fault here, since it shows a false positive.

anthonyjclark commented 3 months ago

Thank you for the input. I am not sure I understand your comment about splitting into different npm workspaces, but I will look into it.