Repository navigation
Conversation
…s/language-tools) volar-service-typescript only read the deprecated per-language `typescript.format.*` / `javascript.format.*` settings when formatting embedded script blocks, ignoring the unified `js/ts.format.*` settings. VS Code's built-in TS extension reads `js/ts.format.*` first and only falls back to the language-specific sections when the unified value is not configured. Mirror that behavior so Vue script blocks format consistently with regular TS/JS files.
|
Stumbled upon this great PR while investigating why I wonder if it would make sense to also update |
Thanks HiDeoo, its AI mostly, I pointed it to an issue downstream and didn't realize it did |
|
Superseded by a broader PR that applies the unified Thanks @HiDeoo for the nudge. Closing in favor of the new PR. |
Problem
Volar's TypeScript formatting service only reads the deprecated per-language format settings (
typescript.format.*/javascript.format.*) when formatting embedded script blocks. The unifiedjs/ts.format.*settings are ignored, so a Vue<script setup lang="ts">block formats differently from a regular.tsfile when only the unified settings are configured.Closes vuejs/language-tools#6150
What VS Code does
VS Code's built-in TypeScript extension reads the unified
js/ts.format.*settings first and only falls back to the language-specific sections (typescript.format.*/javascript.format.*) when the unified value is not configured — seereadUnifiedConfig.Change
getFormatCodeSettingsnow also readsjs/ts.formatand gives those values precedence over the language-specific sections, while still falling back to the deprecated settings.One caveat worth noting for reviewers:
LanguageServiceEnvironment.getConfigurationonly returns resolved values (including registered defaults), with noinspect()-style "was this explicitly set" signal. So we approximate the unified-wins fallback by preferring a unified value only when it differs from its registered default. This behaves identically to VS Code in practice; the only theoretical divergence is explicitly setting a unified key to its exact default while also setting the deprecated counterpart to a different value.Test plan
Added unit tests covering:
js/ts.format.*settings are honoredtypescript.format.*/javascript.format.*