-
Notifications
You must be signed in to change notification settings - Fork 937
VsCode Tasks PR2: Adding sqlproj-build Task Definition and Problem Matcher to Extension Package #26316
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
Conversation
There was a problem hiding this 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 pull request adds support for SQL database project tasks in the VS Code extension by implementing a new task provider, updating task definitions and problem matchers in the package configuration, and adding unit tests to validate the functionality.
- Introduced SqlDatabaseProjectTaskProvider to create tasks for building .sqlproj files with optional code analysis.
- Updated extension activation to register the new task provider.
- Added corresponding constants and package.json configurations for task definitions and a problem matcher.
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
extensions/sql-database-projects/src/test/tasks/sqlDatabaseProjectTaskProvider.test.ts | Added unit tests to validate task creation and task properties for .sqlproj files. |
extensions/sql-database-projects/src/tasks/sqlDatabaseProjectTaskProvider.ts | Implemented a task provider to dynamically create build and build-with-code-analysis tasks. |
extensions/sql-database-projects/src/extension.ts | Updated extension activation to register the new task provider. |
extensions/sql-database-projects/src/common/constants.ts | Added constants for task types, shell command parameters, and problem matcher identifiers. |
extensions/sql-database-projects/package.json | Configured task definitions and problem matchers to integrate with the VS Code tasks system. |
Comments suppressed due to low confidence (2)
extensions/sql-database-projects/src/common/constants.ts:561
- The documentation in the task definition indicates that runCodeAnalysis is optional with a default of true, but the implementation in getTask defaults it to false. Consider aligning the default behavior between the documentation and the implementation.
"runCodeAnalysis": {
extensions/sql-database-projects/src/tasks/sqlDatabaseProjectTaskProvider.ts:142
- [nitpick] There appears to be an extra whitespace between the constants in the shell command construction when runCodeAnalysis is true. Consider removing the extra space to ensure consistent command formatting.
const shellCommand = runCodeAnalysis ? `${constants.dotnetBuild} ${constants.runCodeAnalysisParam}` : `${constants.dotnetBuild}`;
extensions/sql-database-projects/src/test/tasks/sqlDatabaseProjectTaskProvider.test.ts
Outdated
Show resolved
Hide resolved
…jectTaskProvider.test.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
extensions/sql-database-projects/src/test/tasks/sqlDatabaseProjectTaskProvider.test.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this 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 pull request adds task provider support for SQL database projects in VS Code by introducing a new task provider for building .sqlproj files with optional code analysis, updating related constants and package definitions, and including unit tests to validate the functionality.
- Adds the SqlDatabaseProjectTaskProvider to create build tasks.
- Updates the extension activation to register the new task provider.
- Defines task constants, problem matcher, and task definitions in constants.ts and package.json.
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
extensions/sql-database-projects/src/test/tasks/sqlDatabaseProjectTaskProvider.test.ts | Unit tests to validate task creation logic and properties for .sqlproj files |
extensions/sql-database-projects/src/tasks/sqlDatabaseProjectTaskProvider.ts | Implements the logic for building SQL project tasks and handles file watching |
extensions/sql-database-projects/src/extension.ts | Registers the new task provider during extension activation |
extensions/sql-database-projects/src/common/constants.ts | Introduces new constants pertinent to SQL project tasks and problem matching |
extensions/sql-database-projects/package.json | Defines problem matchers and task definitions for SQL project tasks |
extensions/sql-database-projects/src/tasks/sqlDatabaseProjectTaskProvider.ts
Outdated
Show resolved
Hide resolved
extensions/sql-database-projects/src/tasks/sqlDatabaseProjectTaskProvider.ts
Outdated
Show resolved
Hide resolved
extensions/sql-database-projects/src/tasks/sqlDatabaseProjectTaskProvider.ts
Outdated
Show resolved
Hide resolved
extensions/sql-database-projects/src/tasks/sqlDatabaseProjectTaskProvider.ts
Outdated
Show resolved
Hide resolved
extensions/sql-database-projects/src/tasks/sqlDatabaseProjectTaskProvider.ts
Outdated
Show resolved
Hide resolved
extensions/sql-database-projects/src/test/tasks/sqlDatabaseProjectTaskProvider.test.ts
Outdated
Show resolved
Hide resolved
@@ -22,7 +22,7 @@ export function activate(context: vscode.ExtensionContext): Promise<SqlDatabaseP | |||
context.subscriptions.push(TelemetryReporter); | |||
|
|||
// Register the Sql project task provider | |||
const workspaceFolders = vscode.workspace.workspaceFolders && vscode.workspace.workspaceFolders.length > 0 ? vscode.workspace.workspaceFolders : undefined; | |||
const workspaceFolders = vscode.workspace.workspaceFolders && vscode.workspace.workspaceFolders?.length > 0 ? vscode.workspace.workspaceFolders : undefined; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was just mentioning that vscode.workspace.workspaceFolders
isn't needed anymore now that you have ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, it shouldn't as we are using the optional chaining, but I believe typescript is validating it differently compared to null-condition operator (like in c#). It seems we are checking the same thing twice, but since the workspaceFolders can return a list | undefined, first check is required to verify if the folders exists then only go for second check to get the lenght, otherwise it could check for undefined?.length which is causing the runtime error
"'vscode.workspace.workspaceFolders.length' is possibly 'undefined'.ts(18048)"
This pull request introduces task provider support for SQL database projects in Visual Studio Code. It adds functionality to define, register, and manage tasks for building
.sqlproj
files, including tasks with optional code analysis. It also includes tests to validate the new functionality. Below are the most important changes grouped by theme:Task Provider Implementation:
SqlDatabaseProjectTaskProvider
class to provide tasks for.sqlproj
files. It supports creating build tasks and build-with-code-analysis tasks, leveragingvscode.Task
andvscode.ShellExecution
. The class also includes file system watchers to dynamically update tasks when.sqlproj
files are added, modified, or removed. (extensions/sql-database-projects/src/tasks/sqlDatabaseProjectTaskProvider.ts
)Configuration and Constants:
package.json
file for.sqlproj
tasks, enabling integration with the VS Code task system. (extensions/sql-database-projects/package.json
)constants.ts
. These constants are used throughout the task provider implementation. (extensions/sql-database-projects/src/common/constants.ts
) [1] [2]Extension Activation:
SqlDatabaseProjectTaskProvider
as a task provider when the extension is activated. (extensions/sql-database-projects/src/extension.ts
) [1] [2]Unit Tests:
SqlDatabaseProjectTaskProvider
to ensure tasks are created correctly for.sqlproj
files. The tests validate task properties, such as task names, problem matchers, and execution commands. (extensions/sql-database-projects/src/test/tasks/sqlDatabaseProjectTaskProvider.test.ts
)# Pull Request Template – Azure Data StudioDescription
This PR adds the ability of creating sql-proj build and build with code analysis tasks during the project creation and can be run from 'Run tasks' option.
Code Changes Checklist
npm run test
)Reviewers: Please read our reviewer guidelines