Skip to content

Add VS Code configuration for development tasks and debugging#250

Open
rickbutterfield wants to merge 1 commit intov5/mainfrom
claude/add-vscode-config-rEDlw
Open

Add VS Code configuration for development tasks and debugging#250
rickbutterfield wants to merge 1 commit intov5/mainfrom
claude/add-vscode-config-rEDlw

Conversation

@rickbutterfield
Copy link
Owner

Summary

This PR adds VS Code workspace configuration files to streamline the development experience for contributors working on the BlockPreview project.

Key Changes

  • Added .vscode/tasks.json: Defines build and development tasks including:

    • Client-side npm tasks (install, build, watch) for the BlockPreview.UI project
    • .NET build task for the solution
    • .NET watch task for running the TestSite project with hot reload
    • Platform-specific task to kill the TestSite process (Windows, macOS, Linux)
    • Composite "Build" task that runs both client and .NET builds
  • Added .vscode/launch.json: Provides debugging configurations:

    • .NET Core launch configuration for the TestSite project with automatic browser opening
    • .NET Core attach configuration for debugging running processes
    • Automatic cleanup of the TestSite process after debugging stops
  • Updated .vscode/settings.json: Fixed the default solution path from src/Umbraco.Community.BlockPreview.sln to Umbraco.Community.BlockPreview.sln to match the actual project structure

Benefits

These configurations enable developers to:

  • Build both client and server components with a single command
  • Debug the TestSite application directly from VS Code
  • Run development servers with file watching for rapid iteration
  • Have a consistent development environment across team members

https://claude.ai/code/session_015JoPQr4bPMG8ZTb567haCd

Adds launch/debug configurations and build tasks modeled after the
Umbraco-CMS repository, adapted for BlockPreview's project structure.
Also fixes the default solution path in settings.json.

https://claude.ai/code/session_015JoPQr4bPMG8ZTb567haCd
Copilot AI review requested due to automatic review settings February 13, 2026 15:32
@claude
Copy link

claude bot commented Feb 13, 2026

Pull Request Review

Thank you for this contribution! This is a solid addition to the developer experience. I've reviewed the VS Code configuration changes and have the following feedback:

✅ Strengths

  1. Correct Path Fix: The settings.json fix from src/Umbraco.Community.BlockPreview.sln to Umbraco.Community.BlockPreview.sln is correct and aligns with the actual repository structure.

  2. Comprehensive Task Coverage: The tasks.json provides excellent coverage of the development workflow with tasks for both client-side (npm) and server-side (.NET) builds.

  3. Cross-Platform Support: Good inclusion of platform-specific commands for the kill-test-site task (Windows, macOS, Linux).

  4. Launch Configuration: The .NET Core launch configuration is well-structured with appropriate environment variables and automatic browser opening.

🔍 Potential Issues & Suggestions

1. Launch Configuration - Program Path

Issue: .vscode/launch.json:8

The launch configuration uses "program": "dotnet" with "args": ["run"]. This approach works but is non-standard for .NET debugging in VS Code. The typical pattern is to specify the compiled DLL directly.

Why this matters:

  • Using dotnet run means the debugger attaches to the dotnet CLI process, not directly to the application
  • May cause issues with breakpoints and step debugging
  • The standard approach provides better debugging experience

Recommendation: Consider using the standard pattern with a preLaunchTask to build before launching.

2. Kill Task Error Handling

Issue: .vscode/tasks.json:72-84

The kill-test-site task will fail with an error if no matching process exists. When debugging stops naturally (user stops the app), this task will produce an error message.

Recommendation: Add error suppression using || true for Unix systems and || exit 0 for Windows.

3. Task Grouping

Enhancement: .vscode/tasks.json:9

The composite "Build" task could be marked as the default build task by setting "isDefault": true in the group. This allows users to trigger it with Ctrl+Shift+B.

4. Missing preLaunchTask

Enhancement: .vscode/launch.json:5-19

The launch configuration doesn't have a preLaunchTask to ensure the project is built before debugging. This could lead to debugging stale code if developers forget to build first.

Recommendation: Add "preLaunchTask": "Dotnet build"

5. requireExactSource Setting

Question: .vscode/launch.json:12

The "requireExactSource": false setting allows debugging even when source files don't exactly match the compiled binary. While this can be convenient during development, it can also be confusing when breakpoints don't hit as expected.

Recommendation: Document why this is disabled or consider removing it to use the default behavior.

🎯 Code Quality & Best Practices

  • Formatting: All JSON files are properly formatted
  • Structure: Logical organization of tasks and configurations
  • Documentation: The PR description clearly explains the changes and benefits
  • Consistency: Task naming follows a consistent pattern

🔒 Security Considerations

No security concerns identified. These are development-only configuration files that won't be included in the NuGet package.

🧪 Testing Recommendations

To validate these configurations work as expected:

  1. Test the launch configuration actually attaches the debugger correctly
  2. Verify breakpoints hit as expected in both C# and when debugging Razor views
  3. Test the kill-test-site task behavior when the process is/isn't running
  4. Verify cross-platform functionality (especially Windows vs Unix path handling)

📝 Summary

This is a valuable contribution that will improve the contributor experience. The main recommendations are:

  1. Fix the launch configuration to use the standard .NET debugging pattern
  2. Add error suppression to the kill-test-site task
  3. Add a preLaunchTask to ensure builds happen before debugging

The current implementation will work but may cause confusion for developers familiar with standard VS Code .NET debugging patterns.

Recommendation: Request changes to address the launch configuration issue (#1), the others are optional enhancements.

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 adds VS Code workspace configuration files to improve the development experience for contributors working on BlockPreview, an Umbraco community package. The configurations enable streamlined building, running, and debugging of both the client-side TypeScript/Lit components and the .NET backend. The PR also corrects an existing path issue in the settings file where the solution path was incorrectly pointing to a src/ subdirectory.

Changes:

  • Added comprehensive VS Code tasks for building and running client (npm/Vite) and server (.NET) components
  • Added VS Code launch configurations for debugging the TestSite application
  • Fixed incorrect default solution path from src/Umbraco.Community.BlockPreview.sln to Umbraco.Community.BlockPreview.sln

Reviewed changes

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

File Description
.vscode/tasks.json Defines npm and .NET build/watch tasks, composite Build task, and platform-specific process cleanup task
.vscode/settings.json Corrects the default solution path to point to the root-level .sln file
.vscode/launch.json Adds .NET Core launch and attach configurations for debugging with automatic browser opening and cleanup

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

Comment on lines +8 to +10
"program": "dotnet",
"args": ["run"],
"cwd": "${workspaceFolder}/examples/Umbraco.Community.BlockPreview.TestSite",
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The launch configuration uses "program": "dotnet" with "args": ["run"], which will work since the cwd is set to the project directory. However, the standard and more reliable approach for .NET debugging in VS Code is to point the program field directly to the compiled DLL:
"program": "${workspaceFolder}/examples/Umbraco.Community.BlockPreview.TestSite/bin/Debug/net10.0/Umbraco.Community.BlockPreview.TestSite.dll"

This approach:

  1. Provides better debugging performance (no additional dotnet CLI overhead)
  2. Makes it clearer what's being debugged
  3. Follows VS Code .NET extension conventions

If using this approach, remove the args field and add a preLaunchTask to build first.

Suggested change
"program": "dotnet",
"args": ["run"],
"cwd": "${workspaceFolder}/examples/Umbraco.Community.BlockPreview.TestSite",
"program": "${workspaceFolder}/examples/Umbraco.Community.BlockPreview.TestSite/bin/Debug/net10.0/Umbraco.Community.BlockPreview.TestSite.dll",
"cwd": "${workspaceFolder}/examples/Umbraco.Community.BlockPreview.TestSite",
"preLaunchTask": "build-test-site",

Copilot uses AI. Check for mistakes.
"label": "Build",
"detail": "Builds the client and solution",
"promptOnClose": true,
"group": "build",
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The composite "Build" task should be marked as the default build task. Change line 8 from "group": "build" to "group": {"kind": "build", "isDefault": true} to make it the default build task that can be executed with Ctrl+Shift+B (or Cmd+Shift+B on macOS).

Suggested change
"group": "build",
"group": { "kind": "build", "isDefault": true },

Copilot uses AI. Check for mistakes.
"command": "pkill -f Umbraco.Community.BlockPreview.TestSite"
},
"windows": {
"command": "taskkill /IM Umbraco.Community.BlockPreview.TestSite.exe /F"
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Windows taskkill command is likely incorrect. When running dotnet run or debugging through VS Code, the process name is "dotnet.exe", not "Umbraco.Community.BlockPreview.TestSite.exe". The command should be:
"command": "taskkill /IM dotnet.exe /F"

However, this has the downside of killing ALL dotnet.exe processes. A more precise approach would use PowerShell to filter by working directory or command line arguments. The pkill commands on Linux/macOS also have the same issue - they may kill other instances of the application if multiple are running.

Suggested change
"command": "taskkill /IM Umbraco.Community.BlockPreview.TestSite.exe /F"
"command": "powershell -NoProfile -Command \"Get-CimInstance Win32_Process | Where-Object { $_.Name -eq 'dotnet.exe' -and $_.CommandLine -match 'Umbraco.Community.BlockPreview.TestSite' } | ForEach-Object { Stop-Process -Id $_.ProcessId -Force }\""

Copilot uses AI. Check for mistakes.
Comment on lines +21 to +30
{
"label": "Client Build",
"detail": "Runs npm run build for BlockPreview.UI",
"promptOnClose": true,
"group": "build",
"type": "npm",
"script": "build",
"path": "src/Umbraco.Community.BlockPreview.UI/",
"problemMatcher": []
},
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The "Client Build" task may fail if npm packages haven't been installed yet. Consider adding "Client Install" as a dependency of "Client Build" by adding a "dependsOn" field:
"dependsOn": ["Client Install"]

This ensures packages are installed before attempting to build. Alternatively, document that "Client Install" needs to be run manually before the first build.

Copilot uses AI. Check for mistakes.
"args": ["run"],
"cwd": "${workspaceFolder}/examples/Umbraco.Community.BlockPreview.TestSite",
"stopAtEntry": false,
"requireExactSource": false,
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The launch configuration is missing a preLaunchTask to build the project before debugging. Add a preLaunchTask field that references the "Dotnet build" task to ensure the project is built before launching the debugger. Without this, debugging may fail if the project hasn't been built yet or if changes have been made since the last build.

Suggested change
"requireExactSource": false,
"requireExactSource": false,
"preLaunchTask": "Dotnet build",

Copilot uses AI. Check for mistakes.
},
"env": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding a "console" field to specify where console output should be displayed. For web applications, the recommended value is "internalConsole" to show output in VS Code's Debug Console. Add:
"console": "internalConsole"

This provides a better debugging experience for ASP.NET Core applications.

Suggested change
}
},
"console": "internalConsole"

Copilot uses AI. Check for mistakes.
Comment on lines +77 to +83
"command": "pkill -f Umbraco.Community.BlockPreview.TestSite"
},
"linux": {
"command": "pkill -f Umbraco.Community.BlockPreview.TestSite"
},
"windows": {
"command": "taskkill /IM Umbraco.Community.BlockPreview.TestSite.exe /F"
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The kill-test-site task should include error handling to prevent failures when the process isn't running. Add "ignoreExitCode": true to the problemMatcher configuration or modify the commands to ignore errors:

  • Windows: "command": "taskkill /IM Umbraco.Community.BlockPreview.TestSite.exe /F || exit 0"
  • Linux/macOS: "command": "pkill -f Umbraco.Community.BlockPreview.TestSite || true"

This prevents the postDebugTask from failing when the process has already terminated, which would show an error message to the user unnecessarily.

Suggested change
"command": "pkill -f Umbraco.Community.BlockPreview.TestSite"
},
"linux": {
"command": "pkill -f Umbraco.Community.BlockPreview.TestSite"
},
"windows": {
"command": "taskkill /IM Umbraco.Community.BlockPreview.TestSite.exe /F"
"command": "pkill -f Umbraco.Community.BlockPreview.TestSite || true"
},
"linux": {
"command": "pkill -f Umbraco.Community.BlockPreview.TestSite || true"
},
"windows": {
"command": "taskkill /IM Umbraco.Community.BlockPreview.TestSite.exe /F || exit 0"

Copilot uses AI. Check for mistakes.
Comment on lines +42 to +71
"label": "Dotnet build",
"detail": "Dotnet build of solution",
"promptOnClose": true,
"group": "build",
"command": "dotnet",
"type": "process",
"args": [
"build",
"${workspaceFolder}/Umbraco.Community.BlockPreview.sln",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "Dotnet watch",
"detail": "Dotnet run and watch of TestSite",
"promptOnClose": true,
"command": "dotnet",
"type": "process",
"args": [
"watch",
"run",
"--project",
"${workspaceFolder}/examples/Umbraco.Community.BlockPreview.TestSite/Umbraco.Community.BlockPreview.TestSite.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Task naming is inconsistent. Tasks use "Client" as a prefix (e.g., "Client Build", "Client Install", "Client Watch") but then use "Dotnet" with a lowercase "n". For consistency, consider either:

  • Using "Dotnet Build" and "Dotnet Watch" (current style)
  • Using ".NET Build" and ".NET Watch" (matching the official product name)
  • Using "Server Build" and "Server Watch" (parallel to "Client")

The most common convention in VS Code configurations is to use ".NET" to match Microsoft's official branding.

Copilot uses AI. Check for mistakes.
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.

3 participants