Add support for projects managed with Yarn (#13644)

TODO:
- [ ] File a PR with Yarn to add Zed to the list of supported IDEs.

Fixes: https://github.com/zed-industries/zed/issues/10107
Fixes: https://github.com/zed-industries/zed/issues/13706
Release Notes:

- Improved experience in projects using Yarn. Run `yarn dlx
@yarnpkg/sdks base` in the root of your project in order to elevate your
experience.

---------

Co-authored-by: Saurabh <79586784+m4saurabh@users.noreply.github.com>
This commit is contained in:
Piotr Osiewicz
2024-07-11 14:56:07 +02:00
committed by GitHub
co-authored by Saurabh
parent 291d64c803
commit 2727f55772
9 changed files with 320 additions and 24 deletions
+1
View File
@@ -62,6 +62,7 @@
- [Uiua](./languages/uiua.md)
- [Vue](./languages/vue.md)
- [YAML](./languages/yaml.md)
- [Yarn](./languages/yarn.md)
- [Zig](./languages/zig.md)
# Developing Zed
+4
View File
@@ -142,3 +142,7 @@ You can configure ESLint's `rulesCustomizations` setting:
}
}
```
## Yarn integration
See [Yarn documentation](./yarn.md) for a walkthrough of configuring your project to use Yarn.
+5 -1
View File
@@ -3,7 +3,8 @@
TypeScript and TSX support are available natively in Zed.
- Tree Sitter: [tree-sitter-typescript](https://github.com/tree-sitter/tree-sitter-typescript)
- Language Server: [typescript-language-server](https://github.com/typescript-language-server/typescript-language-server)
- Language Server: [vtsls](https://github.com/yioneko/vtsls)
- Alternate Language Server: [typescript-language-server](https://github.com/typescript-language-server/typescript-language-server)
## Inlay Hints
@@ -41,3 +42,6 @@ Use
to override these settings.
See https://github.com/typescript-language-server/typescript-language-server?tab=readme-ov-file#inlay-hints-textdocumentinlayhint for more information.
## Yarn integration
See [Yarn documentation](./yarn.md) for a walkthrough of configuring your project to use Yarn.
+8
View File
@@ -0,0 +1,8 @@
# Yarn
[Yarn](https://yarnpkg.com/) is a versatile package manager that improves dependency management and workflow efficiency for JavaScript and other languages. It ensures a deterministic dependency tree, offers offline support, and enhances security for reliable builds.
## Setup
1. Run `yarn dlx @yarnpkg/sdks base` to generate a `.yarn/sdks` directory.
2. Set your language server (e.g. VTSLS) to use Typescript SDK from `.yarn/sdks/typescript/lib` directory in [LSP initialization options](../configuring-zed.md#lsp). The actual setting for that depends on language server; for example, for VTSLS you should set [`typescript.tsdk`](https://github.com/yioneko/vtsls/blob/6adfb5d3889ad4b82c5e238446b27ae3ee1e3767/packages/service/configuration.schema.json#L5).
3. Voilla! Language server functionalities such as Go to Definition, Code Completions and On Hover documentation should work.