Skip to content

feat(vscode): add language-specific formatter overrides to .vscode/settings.json#1491

Merged
fengmk2 merged 5 commits intovoidzero-dev:mainfrom
hamsurang:feat/create-vscode-per-language-formatter
Apr 28, 2026
Merged

feat(vscode): add language-specific formatter overrides to .vscode/settings.json#1491
fengmk2 merged 5 commits intovoidzero-dev:mainfrom
hamsurang:feat/create-vscode-per-language-formatter

Conversation

@oilater
Copy link
Copy Markdown
Contributor

@oilater oilater commented Apr 27, 2026

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.

@netlify
Copy link
Copy Markdown

netlify Bot commented Apr 27, 2026

Deploy Preview for viteplus-preview ready!

Name Link
🔨 Latest commit 021ec3b
🔍 Latest deploy log https://app.netlify.com/projects/viteplus-preview/deploys/69f075713de9dee791f92909
😎 Deploy Preview https://deploy-preview-1491--viteplus-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@oilater oilater changed the title feat(create): add language-specific formatter overrides to .vscode/settings.json feat(vscode): add language-specific formatter overrides to .vscode/settings.json Apr 27, 2026
@oilater oilater force-pushed the feat/create-vscode-per-language-formatter branch from cd780e5 to b210a53 Compare April 27, 2026 15:14
@jong-kyung
Copy link
Copy Markdown
Collaborator

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 👍

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/cli/src/utils/__tests__/editor.spec.ts
@jong-kyung
Copy link
Copy Markdown
Collaborator

@fengmk2 Could you re-run the CI? It seems to be a network issue on setup-node.

@fengmk2
Copy link
Copy Markdown
Member

fengmk2 commented Apr 28, 2026

@oilater @jong-kyung Thanks!!

@fengmk2 fengmk2 merged commit bcc93a4 into voidzero-dev:main Apr 28, 2026
59 of 61 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Enhancement] Generate language-specific overrides in .vscode/settings.json

3 participants