Smart IDEs (such as VSCode or IntelliJ) require special configuration for TypeScript to work when using Plug’n’Play installs. This page is a collection of settings for each editor we’ve looked into.
The editor SDKs and settings can be generated using yarn dlx @yarnpkg/sdks. Its detailed documentation can be found on the dedicated page.
Generate both the base SDK and the editor settings:
yarn dlx @yarnpkg/sdks vscode vim ...Generate the base SDK, but no editor settings:
yarn dlx @yarnpkg/sdks baseUpdate all installed SDKs & editor settings:
yarn dlx @yarnpkg/sdksTools currently supported
Section titled “Tools currently supported”| Supported extension | Enabled if … is found in your package.json dependencies |
|---|---|
| Builtin VSCode TypeScript Server | typescript |
| astro-vscode | astro |
| vscode-eslint | eslint |
| prettier-vscode | prettier |
| relay | relay |
If you’d like to contribute more, take a look here!
Editor setup
Section titled “Editor setup”CoC nvim
Section titled “CoC nvim”-
Install vim-rzip
-
Run the following command, which will generate a
.vim/coc-settings.jsonfile:
yarn dlx @yarnpkg/sdks vimThe SDK comes with a typescript-language-server wrapper which enables you to use the ts-ls LSP client.
- Run the following command, which will generate a new directory called
.yarn/sdks:
yarn dlx @yarnpkg/sdks base- Create a
.dir-locals.elwith the following content to enable Flycheck and LSP support, and make sure LSP is loaded after local variables are applied to trigger theeval-after-load:
((typescript-mode . ((eval . (let ((project-directory (car (dir-locals-find-file default-directory)))) (setq lsp-clients-typescript-server-args `("--tsserver-path" ,(concat project-directory ".yarn/sdks/typescript/bin/tsserver") "--stdio")))))))Neovim Native LSP
Section titled “Neovim Native LSP”-
Install vim-rzip
-
Run the following command, which will generate a new directory called
.yarn/sdks:
yarn dlx @yarnpkg/sdks baseTypeScript support should then work out of the box with nvim-lspconfig and theia-ide/typescript-language-server.
VSCode
Section titled “VSCode”-
Install the ZipFS extension, which is maintained by the Yarn team.
-
Run the following command, which will generate a
.vscode/settings.jsonfile:
yarn dlx @yarnpkg/sdks vscode-
For safety reason VSCode requires you to explicitly activate the custom TS settings:
- Press ctrl+shift+p in a TypeScript file
- Choose “Select TypeScript Version”
- Pick “Use Workspace Version”
Your VSCode project is now configured to use the exact same version of TypeScript as the one you usually use, except that it will be able to properly resolve the type definitions.