Skip to content

Warn on duplicate object name for Rename and Move to Schema#22409

Open
ssreerama wants to merge 5 commits into
mainfrom
sai/July/rename_duplicate_obj_warn
Open

Warn on duplicate object name for Rename and Move to Schema#22409
ssreerama wants to merge 5 commits into
mainfrom
sai/July/rename_duplicate_obj_warn

Conversation

@ssreerama

@ssreerama ssreerama commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Summary

When renaming a SQL object or moving it to a schema where a name conflict exists, the client now shows a Yes/Cancel confirmation dialog (matching the SSDT-style prompt) before applying the workspace edits. Previously the operation was silently rejected with no feedback.

Changes

Contracts (languageService.ts)

  • SqlSymbolRenameResponse — added warningMessage? property
  • SqlMoveToSchemaResponse — added warningMessage? property

Rename provider (sqlSymbolRenameProvider.ts)

  • If response.warningMessage is set, shows a showWarningMessage prompt with Yes / Cancel buttons before proceeding.

Move to Schema provider (sqlMoveToSchemaProvider.ts)

  • Same pattern: shows warning prompt and returns early on cancel.

Depends on microsoft/sqltoolsservice#2748

image 7_1_MoveToSchema_duplicate 7_1_Rename_duplicate

Copilot AI 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

This PR updates the SQL rename and move-to-schema workflows to surface server-provided name-collision warnings to the user and require explicit confirmation before applying edits, aligning behavior with SSDT-style prompts instead of failing silently.

Changes:

  • Extended the language service response contracts to optionally carry a warningMessage.
  • Added a Yes/No confirmation prompt in both Rename and Move-to-Schema providers when warningMessage is present.
  • Removed root and extension .vscode/launch.json debug configurations (not mentioned in the PR description).

Reviewed changes

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

Show a summary per file
File Description
extensions/mssql/src/models/contracts/languageService.ts Adds optional warningMessage fields to rename/move response contracts.
extensions/mssql/src/languageservice/sqlSymbolRenameProvider.ts Prompts user (Yes/No) when the service warns about a name collision before returning edits.
extensions/mssql/src/languageservice/sqlMoveToSchemaProvider.ts Prompts user (Yes/No) when the service warns about a name collision before applying edits.
extensions/mssql/.vscode/launch.json Deleted extension-level debug launch configuration.
.vscode/launch.json Deleted root-level debug launch configuration used for “Run All Extensions”.

Comment thread extensions/mssql/src/languageservice/sqlSymbolRenameProvider.ts
Comment thread extensions/mssql/src/languageservice/sqlMoveToSchemaProvider.ts
Comment thread extensions/mssql/src/languageservice/sqlSymbolRenameProvider.ts Outdated
Comment thread extensions/mssql/src/languageservice/sqlMoveToSchemaProvider.ts Outdated
Comment thread extensions/mssql/src/languageservice/sqlSymbolRenameProvider.ts Outdated
@ssreerama ssreerama self-assigned this Jul 1, 2026
@ssreerama ssreerama linked an issue Jul 1, 2026 that may be closed by this pull request
17 tasks
@ssreerama ssreerama added this to the July 2026 Release milestone Jul 1, 2026
@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown

PR Changes

Category Target Branch PR Branch Difference
vscode-mssql VSIX 79083 KB 79083 KB ⚪ 0 KB ( 0% )
sql-database-projects VSIX 6311 KB 6311 KB ⚪ 0 KB ( 0% )
data-workspace VSIX 535 KB 535 KB ⚪ 0 KB ( 0% )
keymap VSIX 7 KB 7 KB ⚪ 0 KB ( 0% )

@codecov-commenter

codecov-commenter commented Jul 1, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.55556% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 75.57%. Comparing base (4395bf6) to head (0aa5458).

Files with missing lines Patch % Lines
...sql/src/languageservice/sqlSymbolRenameProvider.ts 88.88% 2 Missing ⚠️

❗ There is a different number of reports uploaded between BASE (4395bf6) and HEAD (0aa5458). Click for more details.

HEAD has 6 uploads less than BASE
Flag BASE (4395bf6) HEAD (0aa5458)
mssql 3 1
sqlproj 3 1
data-workspace 3 1
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##             main   #22409       +/-   ##
===========================================
- Coverage   87.74%   75.57%   -12.18%     
===========================================
  Files         325      413       +88     
  Lines      113984   129655    +15671     
  Branches      560     8270     +7710     
===========================================
- Hits       100020    97992     -2028     
- Misses      13964    31663    +17699     
Flag Coverage Δ
data-workspace 77.10% <ø> (ø)
mssql 75.38% <95.55%> (-13.74%) ⬇️
sqlproj 77.26% <ø> (-0.30%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...sql/src/languageservice/sqlMoveToSchemaProvider.ts 87.76% <100.00%> (-12.24%) ⬇️
...ions/mssql/src/models/contracts/languageService.ts 92.74% <100.00%> (-7.26%) ⬇️
...sql/src/languageservice/sqlSymbolRenameProvider.ts 94.20% <88.88%> (+3.65%) ⬆️

... and 302 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ssreerama ssreerama force-pushed the sai/July/rename_duplicate_obj_warn branch from 78d452c to f1812be Compare July 1, 2026 16:54
Copilot AI review requested due to automatic review settings July 1, 2026 16:57

Copilot AI 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

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

Comment thread extensions/mssql/src/languageservice/sqlSymbolRenameProvider.ts
Comment thread extensions/mssql/src/languageservice/sqlSymbolRenameProvider.ts
Comment thread extensions/mssql/src/languageservice/sqlMoveToSchemaProvider.ts
Comment thread extensions/mssql/src/languageservice/sqlMoveToSchemaProvider.ts
Comment thread extensions/mssql/src/languageservice/sqlMoveToSchemaProvider.ts
Comment thread extensions/mssql/test/unit/sqlSymbolRenameProvider.test.ts Outdated
Copilot AI review requested due to automatic review settings July 1, 2026 18:04

Copilot AI 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

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

Comment thread extensions/mssql/test/unit/sqlSymbolRenameProvider.test.ts
Comment thread extensions/mssql/test/unit/sqlSymbolRenameProvider.test.ts
Comment thread extensions/mssql/src/models/contracts/languageService.ts
Comment thread extensions/mssql/src/models/contracts/languageService.ts
Copilot AI review requested due to automatic review settings July 1, 2026 18:11

Copilot AI 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

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

Comment thread extensions/mssql/src/models/contracts/languageService.ts
Comment thread extensions/mssql/test/unit/sqlSymbolRenameProvider.test.ts
Comment thread extensions/mssql/test/unit/sqlSymbolRenameProvider.test.ts
@ssreerama ssreerama force-pushed the sai/July/rename_duplicate_obj_warn branch from 5b376f1 to 65e58b6 Compare July 1, 2026 18:20
Copilot AI review requested due to automatic review settings July 1, 2026 21:49

Copilot AI 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

Copilot reviewed 4 out of 4 changed files in this pull request and generated 8 comments.

Comment on lines +178 to +184
/**
* When non-null, a message to surface to the user.
* If isWarning is true, show a confirmation dialog; otherwise show a blocking error.
*/
message?: string | null;
/** True when message is a confirmation warning; false (default) when it is a hard rejection. */
isWarning?: boolean;
Comment on lines +214 to +220
/**
* When non-null, a message to surface to the user.
* If isWarning is true, show a confirmation dialog; otherwise show a blocking error.
*/
message?: string | null;
/** True when message is a confirmation warning; false (default) when it is a hard rejection. */
isWarning?: boolean;
Comment on lines +155 to +170
// Hard rejection — surface the error message and abort.
if (response.message && !response.isWarning) {
throw new Error(response.message);
}

// Name collision warning — ask the user before proceeding.
if (response.message && response.isWarning) {
const choice = await vscode.window.showWarningMessage(
response.message,
{ modal: true },
msgYes,
);
if (choice !== msgYes) {
return new vscode.WorkspaceEdit(); // user declined — apply nothing silently
}
}
Comment on lines +190 to +200
// Warn if an object with the same name already exists in the target schema.
if (response.message && response.isWarning) {
const choice = await vscode.window.showWarningMessage(
response.message,
{ modal: true },
msgYes,
);
if (choice !== msgYes) {
return; // user declined — do nothing silently
}
}
Comment on lines +370 to +372
message:
"A schema object with the name [Orders] already exists. Would you like to continue?",
isWarning: true,
Comment on lines +405 to +407
message:
"A schema object with the name [Orders] already exists. Would you like to continue?",
isWarning: true,
Comment on lines +830 to +832
message:
"A schema object with the name [hr].[MyTable] already exists. Would you like to continue?",
isWarning: true,
Comment on lines +859 to +861
message:
"A schema object with the name [hr].[MyTable] already exists. Would you like to continue?",
isWarning: true,
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]: warn on object name duplication during rename/refactor

3 participants