microsoft / microsoft/vscode-mssql
[Feature Request]: Support external configuration file for (connection) settings (`mssql.configPath`)
- Dominant language
- TypeScript
- Stars
- 1.9k
- Forks
- 610
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 97
Description
### 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
- [x] 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
- [x] I have searched existing feature requests and couldn't find a match
- [ ] I want to help implement this feature
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the existing mssql.connections and mssql.connectionGroups entries in VS Code settings.json, then compare them with the proposed external mssql-connections.json or JSONC file. Define how mssql.configPath handles precedence, relative paths, and variable expansion; done means both connection objects can be loaded externally while local settings still override them.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript, vscode
- Domain
- databases, developer-experience
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100