Skip to content

Transferring active connection when opening a new SQL file #19503

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Jun 11, 2025

Conversation

Benjin
Copy link
Contributor

@Benjin Benjin commented May 28, 2025

Pull Request Template – vscode-mssql

Description

Fixes #19477

Automatically transfers connection from the active SQL file to a newly-opened SQL file.

Code Changes Checklist

  • New or updated unit tests added
  • All existing tests pass (npm run test)
  • Code follows contributing guidelines
  • Telemetry/logging updated if relevant
  • No regressions or UX breakage

Reviewers: Please read our reviewer guidelines

Copy link

github-actions bot commented May 30, 2025

PR Changes

Category Main Branch PR Branch Difference
Code Coverage 59.26% 59.19% ⚪ 0.00%
VSIX Size 15359 KB 15375 KB ⚪ 16 KB ( 0% )
Webview Bundle Size 3712 KB 3712 KB ⚪ 0 KB ( 0% )

@richardtallent-erm
Copy link

I'm glad to see this here, since it seems to be related to my issue (#19477)! However, the way this code seems to be set up (and I freely admit ignorance of the VSC codebase), it's unclear what would happen if a new tab were opened while a query is pending or running in the existing tab.

It's fine to transfer connections when there is no active query work going on. But if I have a query pending or running in Tab 1 and I open an SQL file creating Tab 2 (or just open a new query tab), I would want my query to continue running in Tab 1 and show its results there, but I would also want Tab 2 to auto-connect to the same database fluently. Ideally in a way that doesn't make me pause my work to wait for it to connect or update IntelliSense in order to run the new query. And certainly in a way that doesn't require me to manually choose the connection again (the current state).

@aasimkhan30
Copy link
Contributor

@richardtallent-erm ,
The way this code works, it doesn’t reuse the exact same connection between files. Instead, it gets the connection credentials and establishes a new connection for the new file.

As a result:
• Each file is connected independently.
• Ongoing queries in the original file won’t be interrupted.
• Disconnecting one file won’t affect the other; the second file remains connected.

@Benjin Benjin merged commit 3836f32 into main Jun 11, 2025
5 checks passed
@Benjin Benjin deleted the dev/benjin/portConnectionOpenScript branch June 11, 2025 16:21
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.

[Feature Request]: Keep same connection when opening a file
3 participants