antfu / vscode-vite

One step faster for Vite in VS Code ⚡️
https://marketplace.visualstudio.com/items?itemName=antfu.vite
452 stars 25 forks source link

Usage in MonoRepo - Setting "project root" #11

Open armenr opened 3 years ago

armenr commented 3 years ago

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
antfu commented 3 years ago

Sounds reasonable, pr welcome, thanks.

armenr commented 3 years ago

@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

antfu commented 3 years ago

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

armenr commented 3 years ago

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