Skip to content

Add JSONC support for .vscode configuration files - #270933

Open
Parham MohammadAlizadeh (Prhmma) wants to merge 3 commits into
microsoft:mainfrom
Prhmma:feature/jsonc-vscode-configs
Open

Add JSONC support for .vscode configuration files#270933
Parham MohammadAlizadeh (Prhmma) wants to merge 3 commits into
microsoft:mainfrom
Prhmma:feature/jsonc-vscode-configs

Conversation

@Prhmma

@PrhmmaParham MohammadAlizadeh (Prhmma) commented Oct 11, 2025

Copy link
Copy Markdown

Add JSONC support for .vscode configuration files

Fixes#269824

  • Support settings.jsonc, tasks.jsonc, launch.jsonc, mcp.jsonc, and extensions.jsonc
  • Maintain backward compatibility with .json files, taking precedence
  • Update configuration loading to try .json first, then .jsonc as a fallback
  • Add comprehensive test coverage for JSONC file resolution
  • Update split settings editor to handle both .json and .jsonc patterns
  • Enhance workspace extension recommendations to support both formats

Manually tested with local instance, it works

@PrhmmaParham MohammadAlizadeh (Prhmma) changed the title Add JSONC support for .vscode configuration filesWIP | Add JSONC support for .vscode configuration filesOct 11, 2025
@PrhmmaParham MohammadAlizadeh (Prhmma) changed the title WIP | Add JSONC support for .vscode configuration filesAdd JSONC support for .vscode configuration filesOct 11, 2025
@mschoettle

Copy link
Copy Markdown

Parham MohammadAlizadeh (@Prhmma)Raymond Zhao (@rzhao271) What's the status of this? It would be great to get support for this

@Prhmma

Copy link
Copy Markdown
Author

Parham MohammadAlizadeh (@Prhmma)Raymond Zhao (@rzhao271) What's the status of this? It would be great to get support for this

It is ready for review,

@mschoettle

Copy link
Copy Markdown

Can you bring it up to date with main and resolve conflicts?

…configs
# Conflicts:
#	src/vs/workbench/services/configuration/browser/configuration.ts
@vs-code-engineering

Copy link
Copy Markdown
Contributor

📬 CODENOTIFY

The following users are being notified based on files changed in this PR:

Raymond Zhao (@rzhao271)

Matched files:

  • src/vs/workbench/contrib/preferences/common/preferencesContribution.ts

@Prhmma

Copy link
Copy Markdown
Author

Can you bring it up to date with main and resolve conflicts?

merge conflict resolved

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds .jsonc fallback support for workspace configuration files while preserving .json precedence.

Changes:

  • Resolves settings, tasks, launch, MCP, and extension recommendations from .jsonc.
  • Updates editor and recommendation workflows for JSONC resources.
  • Adds JSONC loading and precedence tests.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 6 comments.

Show a summary per file
FileDescription
preferences.tsDefines settings JSONC candidates.
workspaceExtensionsConfig.tsLoads and edits extensions.jsonc.
configurationService.test.tsTests JSONC configuration loading.
jsonEditingService.tsAdds JSONC write fallback.
configuration.ts (common)Defines configuration candidates.
configuration.ts (browser)Resolves and watches JSONC files.
preferencesContribution.tsRegisters the split editor for JSONC.
extensionRecommendationsService.test.tsTests JSONC recommendations.
extensionsActions.tsOpens existing extensions.jsonc.

Comment threadsrc/vs/workbench/services/preferences/common/preferences.ts
Comment on lines +325 to +330
private getResourceCandidates(resource: URI): URI[] {
const candidates = [resource];
const path = resource.path;
if (path.endsWith('.json')) {
candidates.push(resource.with({ path: `${path.slice(0, -'.json'.length)}.jsonc` }));
}
Comment on lines +109 to +112
if (!await this.fileService.exists(targetResource)) {
const jsoncAlternative = this.getJsoncAlternative(targetResource);
if (jsoncAlternative && await this.fileService.exists(jsoncAlternative)) {
targetResource = jsoncAlternative;
Comment threadsrc/vs/workbench/contrib/preferences/common/preferencesContribution.ts Outdated
Comment threadsrc/vs/workbench/contrib/extensions/browser/extensionsActions.ts Outdated
Sign up for freeto 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.

Support naming settings.json as settings.jsonc (and others)

6 participants

@Prhmma@mschoettle@rzhao271@hafisslgk25@Parham-alizadeh