redhat-developer / yaml-language-server

Language Server for YAML Files
MIT License
1.06k stars 260 forks source link

Consider extracting yaml-language-service from yaml-language-server #524

Open remcohaszing opened 3 years ago

remcohaszing commented 3 years ago

Summary

I would like to be able to depend on the language service part without pulling in the language server part and all of its dependencies.

Relevant information

I’m working on monaco-yaml. monaco-yaml depends on the YAML language service part in this package, but not on the language server. Currently a build process is needed to include the language service, but ideally I would like to be able to simply add it as a dependency without pulling in the language server part and its dependencies.

I believe extracting the language service also helps to better separate the two parts. monaco-yaml still depends on an older version of yaml-language-server, but I noticed the latest version of the language service also uses some imports from the language server.

I understand if this gets rejected, because it adds an additional maintenance burden, but I wanted to ask anyway to see what you think of it. I think using a yarn mono repository reduces the additional maintenance a lot.

evidolob commented 3 years ago

@remcohaszing I'm not clear, what language service do you want to extract? Do you mean languageservice folder?

remcohaszing commented 3 years ago

Yes. I would like the languageservice folder to be published as a separate package. I imagine it would be called yaml-language-service. The yaml-language-server package would then depend on yaml-language-service.

This is similar to vscode-json-languageserver which depends on vscode-json-languageservice

fantonangeli commented 1 year ago

Hi all, We also have a similar issue in KIE-Tools. Our package Serverless Logic Web Tools, which is a web-app, we needed to validate a YAML using a schema. Using yaml-language-server from the Jest everything works, but Webpack cannot compile and we have errors with importing libraries, mainly prettier. I tried importing yaml-language-server using CJS, ESM or UMD formats but it didn't work.

To solve the issue I bundled yaml-language-server with Esbuild, like @remcohaszing in monaco-yaml, in a different package and used that package in Webpack. https://github.com/kiegroup/kie-tools/tree/main/packages/yaml-language-server I tried also to create a bundle with Webpack, but I had issues with some dependencies, mostly vscode-json-languageservice and ajv.

The idea of @remcohaszing of the monorepo with 2 packages (yaml-language-server and yaml-language-service) should give us the possibility to use the language service part without other dependencies.

What do you think? Please, let me know if there is anything I can do.

Other information

The version of yaml-language-serveris "1.11.1-7853bfd.0"

Logs file: webpack.log

In my fork there is the code giving the error: https://github.com/fantonangeli/kie-tools/tree/yaml-language-server-no-bundle-prettier-error

elvin-hwang commented 11 months ago

Hi, any update on this issue? We would also like to request the same feature due to the size of the bundle being increased by ~11MB due to the prettier dependency, although listed as optionalDependency (using npm ci --no-optional is not an option for our build).

remcohaszing commented 11 months ago

@elvin-hwang The language service part uses Prettier. This issue isn’t related to what you describe. See #933 instead.