Skip to content

Fix: creating SQL project inside already open workspace results in tasks definition in wrong spot#20985

Open
ssreerama wants to merge 25 commits intomainfrom
sai/bug_TaskDefWrongPlace
Open

Fix: creating SQL project inside already open workspace results in tasks definition in wrong spot#20985
ssreerama wants to merge 25 commits intomainfrom
sai/bug_TaskDefWrongPlace

Conversation

@ssreerama
Copy link
Contributor

@ssreerama ssreerama commented Jan 22, 2026

Pull Request Template – vscode-mssql

Issue: #20821

Description

This pull request refactors how SQL project build tasks are created and managed.

  • Moving away from template-based task generation to a programmatic approach.
  • The changes improve reliability, cross-platform compatibility, and error handling when updating or creating tasks.json files for SQL projects.
  • Scenarios it covers
    • When workspace exists, tasks.json will be created at workspace level, if already task.json present, then we warn the user with info that we are updating their task.json file.
    • When no workspace exists, we fall back to existing functionality that task.json will be created at project level
    • Any child projects creates under the parent project, we always update the workspace level task.json 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

image ![TaskJson_updateExtJson_After](https://github.com/user-attachments/assets/993682c5-4c2a-4f1a-9178-096fafd5dded)

@github-actions
Copy link

github-actions bot commented Jan 22, 2026

PR Changes

Category Target Branch PR Branch Difference
vscode-mssql VSIX 5911 KB 5911 KB ⚪ 0 KB ( 0% )
sql-database-projects VSIX 7877 KB 7880 KB ⚪ 3 KB ( 0% )
data-workspace VSIX 537 KB 537 KB ⚪ 0 KB ( 0% )

@codecov-commenter
Copy link

codecov-commenter commented Jan 22, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 68.27%. Comparing base (e08cb5d) to head (bfd8d76).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main   #20985   +/-   ##
=======================================
  Coverage   68.27%   68.27%           
=======================================
  Files         242      242           
  Lines       23554    23554           
  Branches     3116     3116           
=======================================
  Hits        16082    16082           
  Misses       7343     7343           
  Partials      129      129           
🚀 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.

lewis-sanchez
lewis-sanchez previously approved these changes Jan 26, 2026
@ssreerama ssreerama requested a review from Copilot February 3, 2026 21:11
Copy link
Contributor

Copilot AI left a comment

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 refactors the SQL project build task generation from a template-based approach to a programmatic approach. The main purpose is to fix an issue where tasks.json was being created inside the project folder instead of at the workspace level when creating a SQL project in an already open workspace.

Changes:

  • Replaced template-based task generation with programmatic task creation using new helper functions
  • Removed the tasksTemplate.json template file and associated loading code
  • Extracted build-related constants to improve maintainability and reduce hardcoded values
  • Added localization support for task labels and error messages

Reviewed changes

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

Show a summary per file
File Description
localization/xliff/sql-database-projects.xlf Added localization entries for new task detail message and error messages
extensions/sql-database-projects/l10n/bundle.l10n.json Added localized strings for task details and error handling
extensions/sql-database-projects/test/templates.test.ts Updated expected template count from 17 to 16 after removing tasks template
extensions/sql-database-projects/src/tools/buildHelper.ts Refactored to use extracted constants instead of hardcoded build argument strings
extensions/sql-database-projects/src/templates/templates.ts Removed loading of tasks template as it's no longer needed
extensions/sql-database-projects/src/controllers/projectController.ts Refactored task creation logic to programmatically generate tasks with proper workspace detection
extensions/sql-database-projects/src/common/utils.ts Added helper functions for creating build tasks and tasks.json structure
extensions/sql-database-projects/src/common/constants.ts Added new constants for build arguments, task configuration, and localized messages
extensions/sql-database-projects/resources/templates/tasksTemplate.json Deleted template file as part of refactoring to programmatic approach
extensions/sql-database-projects/CHANGELOG.md Added release notes for version 1.5.7

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

Copilot AI left a comment

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 10 out of 10 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI review requested due to automatic review settings February 5, 2026 22:30
Copy link
Contributor

Copilot AI left a comment

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 12 out of 12 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Benjin
Copy link
Contributor

Benjin commented Feb 6, 2026

image

Where is this message defined? I think a better way to word it would be:

A SQL Projects build task [will be | has been] added to the existing file.

Copilot AI review requested due to automatic review settings February 6, 2026 21:47
@ssreerama
Copy link
Contributor Author

image

Where is this message defined? I think a better way to word it would be:

A SQL Projects build task [will be | has been] added to the existing file.

Updated the message. It was reusing an existing message that wasn’t previously used anywhere, which is why it didn’t appear in the changes.

@ssreerama
Copy link
Contributor Author

Updated the gif and image with after addressing the proposed changes.

Copy link
Contributor

Copilot AI left a comment

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 13 out of 13 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI review requested due to automatic review settings February 6, 2026 23:00
Copy link
Contributor

Copilot AI left a comment

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 14 out of 14 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@ssreerama ssreerama requested a review from Benjin February 7, 2026 00:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

creating SQL project inside already open workspace results in tasks definition in wrong spot

4 participants