Skip to content

[Feature Request]: Support external configuration file for (connection) settings (mssql.configPath) #21149

@keen85

Description

@keen85

Feature Description

I propose allowing the mssql extension to optionally load connection and group specifications from a dedicated external file (e.g., mssql-connections.json) instead of storing them exclusively in VS Code's standard settings.json.

Problem and Motivation

Currently, all database connection details are stored directly in VS Code's settings.json. Since the schema for a single connection is quite verbose (~20 attributes), managing multiple environments (Dev, Test, Prod) quickly results in a "wall of text" that makes the global or workspace settings file difficult to navigate.

Furthermore, sharing connection configurations across different workspaces currently requires manual copying and pasting. This is problematic for:

  1. Cleanliness: It bloats the primary editor configuration.
  2. Portability: Users cannot easily reference a single source of truth for their SQL environments across multiple distinct projects.
  3. Version Control: It is difficult to share project-wide settings via .vscode/settings.json without also exposing personal connection aliases or environment-specific metadata.

This relates to themes discussed in #19780 regarding settings clutter and #18912 regarding dedicated config files.

Proposed Solution:
Introduce a new configuration key, "mssql.configPath", within VS Code's settings.json. This key would point to a .json or .jsonc file containing the "mssql.connections" and "mssql.connectionGroups" objects.

Configuration Precedence:

  1. High Priority: VS Code settings.json (for local/immediate overrides).
  2. Medium Priority: The external file defined in "mssql.configPath".
  3. Low Priority: Extension defaults.

Benefits:

  • Maintainability: Keeps settings.json lean and focused on editor behavior.
  • Portability: Allows a single external config file to be referenced by multiple VS Code instances or workspaces.
  • Security & Workflow: Simplifies .gitignore management, allowing users to keep connection metadata outside of the main project repository if desired.

Additional Context:
Ideally, the external file would support standard JSONC (JSON with comments) to allow users to document their various environment connections.
Also, "mssql.configPath" should resolve environment variables (e.g., ${env:USER}), VS Code variables (${workspaceFolder}), and allow relative paths.

Related Area

  • Connection dialog (SQL Server | Azure browse/Fabric browse)
  • Query editor
  • Query results panel
  • Object Explorer
  • GitHub Copilot integration
  • Preview/Edit data
  • Table Designer
  • Schema Designer
  • Schema Compare
  • Local SQL Server Container provisioning
  • SQL database in Fabric provisioning
  • DACPAC/BACPAC export/import
  • SQL Database projects
  • Query Plan Visualizer
  • Other (please describe below)

If you selected "Other", please describe the area

No response

Confirmation

  • I have searched existing feature requests and couldn't find a match
  • I want to help implement this feature

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions