vscode-vite icon indicating copy to clipboard operation
vscode-vite copied to clipboard

Usage in MonoRepo - Setting "project root"

Open armenr opened this issue 4 years ago • 4 comments

Coming from Vetur + Quasar to Volar + Vite VSCode plugin + Vitesse and I absolutely love how much more stable (and less fussy) this setup is.

With Vetur, we were able to configure settings for where certain config files and directories were (relative to the project), specifically for monorepos.

I'm currently using a pretty standard monorepo + "workspace" setup --> so the Vite plugin in VSCode cannot correctly find my vite.config.ts file or correctly "read" that this is a Vite project (to get the benefit of automatically starting the server, using the embedded browser view, and debug tools...etc).

I've not been able to find source code or documentation for configuring this plugin to work if I have the following monorepo setup.

├── README.md
├── TODO.md
├── amplify
│   ├── #current-cloud-backend
│   │   ├── amplify-meta.json
│   │   ├── auth
│   │   ├── backend-config.json
│   │   └── tags.json
│   ├── backend
│   │   ├── amplify-meta.json
│   │   ├── auth
│   │   ├── backend-config.json
│   │   └── tags.json
│   ├── cli.json
│   └── team-provider-info.json
├── amplify.yml
├── cz.yaml
├── node_modules
├── package.json
├── packages
│   └── client
│       ├── LICENSE
│       ├── README.md
│       ├── android
│       ├── capacitor.config.json
│       ├── components.d.ts
│       ├── dist
│       ├── generateCapacitorConfig.js
│       ├── index.html
│       ├── ios
│       ├── locales
│       ├── node_modules
│       ├── package.json
│       ├── pnpm-lock.yaml
│       ├── public
│       ├── src
│       ├── tsconfig.json
│       ├── vite.config.ts
│       └── windi.config.ts
└── pnpm-workspace.yaml

armenr avatar Jul 27 '21 20:07 armenr

Sounds reasonable, pr welcome, thanks.

antfu avatar Jul 28 '21 12:07 antfu

@antfu - can you point me in the direction of where to start from (in the code)? It might save me just a bit of time navigating the codebase on my own! :) I've never really worked on a VSCode extension before, but I'm happy to try

armenr avatar Jul 29 '21 19:07 armenr

Define config: https://github.com/antfu/vscode-vite/blob/57f6c6b6978b635bd25ab511744a8b5219fcf2f1/package.json#L66

Read config: https://github.com/antfu/vscode-vite/blob/main/src/config.ts

antfu avatar Jul 30 '21 02:07 antfu

@antfu - Got it! I will try to get a PR done this weekend :)

armenr avatar Jul 30 '21 21:07 armenr