Commit bcc93a4
feat(vscode): add language-specific formatter overrides to
Closes #1485
## Summary
- Re-assert `editor.defaultFormatter: oxc.oxc-vscode` inside
`[javascript]`/`[javascriptreact]`/`[typescript]`/`[typescriptreact]`
blocks in the generated `.vscode/settings.json`. Without these, a
user-level `[language]` setting (e.g. a global Prettier override)
silently wins over the workspace-level default.
- Extract the override blocks into a dedicated
`VSCODE_LANGUAGE_OVERRIDES` constant so `VSCODE_SETTINGS` keeps a single
concern.
- Update `docs/guide/ide-integration.md` to reflect the new shape and
explain why per-language blocks are required.
- Existing `deepMerge` behavior is unchanged, so a user's pre-existing
`[typescript]: prettier` block is still preserved during `vp create`
against an existing `.vscode/settings.json`.
## Approach
The main question was whether to map `[lang]` blocks per project
template or to always include the JS/TS family. Picked the latter
because
- `vp create` accepts remote templates (`github:user/repo`, arbitrary
`create-*` packages) where the language set can't be known up front — a
per-template branch ends in a JS/TS fallback for these anyway, so the
per-template path doesn't actually buy correctness for the cases it's
meant to help.
- Keeps `vp create` and `vp migrate` consistent with a single source of
truth in `VSCODE_SETTINGS`.
- Including unused `[lang]` blocks has no runtime effect (VS Code only
applies them when matching files are opened) and is evolution-safe if
the user later adds a `.ts` file to an initially JS-only project.
## Tests
- `pnpm -F vite-plus test src/utils/__tests__/editor.spec.ts` — extended
assertions verify the four `[lang]` blocks are written, and that an
existing user's `[typescript]: prettier` is preserved during merge.
---------
Co-authored-by: JongKyung Lee <118944686+jong-kyung@users.noreply.github.com>.vscode/settings.json (#1491)1 parent 6f7fbfa commit bcc93a4
3 files changed
Lines changed: 26 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
25 | 29 | | |
26 | 30 | | |
27 | 31 | | |
| |||
31 | 35 | | |
32 | 36 | | |
33 | 37 | | |
34 | | - | |
| 38 | + | |
35 | 39 | | |
36 | 40 | | |
37 | 41 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
111 | 111 | | |
112 | 112 | | |
113 | 113 | | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
114 | 117 | | |
115 | 118 | | |
116 | 119 | | |
| |||
142 | 145 | | |
143 | 146 | | |
144 | 147 | | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
145 | 151 | | |
146 | 152 | | |
147 | 153 | | |
| |||
165 | 171 | | |
166 | 172 | | |
167 | 173 | | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
168 | 177 | | |
169 | 178 | | |
170 | 179 | | |
171 | 180 | | |
172 | 181 | | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
173 | 185 | | |
174 | 186 | | |
175 | 187 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
10 | 18 | | |
11 | | - | |
12 | 19 | | |
| 20 | + | |
13 | 21 | | |
14 | 22 | | |
15 | 23 | | |
| |||
0 commit comments