aurelia / aurelia/cli

Wrong VSCode `launch.json` after `au new -u -s http2,dotnet-core,typescript,htmlmin-min,vscode,scaffold-navigation`

Open
#1,135 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
402
Forks
134
PR merge metrics
No merged PRs in 30d

Description

**I'm submitting a bug report**

* **Library Version:**
Local aurelia-cli v1.0.2

**Please tell us about your environment:**
Windows 10

PS C:\code\test\au-css\aurelia-app> node -v
v12.3.1
PS C:\code\test\au-css\aurelia-app> npm -v
6.9.0

* **Browser:**
Chrome

* **Language:**
TypeScript

* **Loader/bundler:**
Webpack

**Current behavior:**

1. `au new aurelia-app -u -s http2,dotnet-core,typescript,htmlmin-min,vscode,scaffold-navigation`

The following `launch.json` is created:

```
{
"version": "0.2.0",
"configurations": [
{
"name": "Chrome",
"type": "chrome",
"request": "launch",
"url": "http://localhost:8080",
"webRoot": "${workspaceRoot}/src",
"userDataDir": "${workspaceRoot}/.chrome",
"sourceMapPathOverrides": {
"webpack:///./src/*": "${webRoot}/*"
}
}
]
}
```

Ideally, since I created this as an ASP.NET Core application, I should be able to open the new application in VSCode and press F5 to launch and debug the application. However, this `launch.json` file isn't correct for an ASP.NET Core application.

To get around the problem, I perform the following steps:

1. delete `launch.json`
1. shut down VSCode.
1. start VSCode
1. VSCode prompts again to create the file:
![image](https://user-images.githubusercontent.com/333022/60820456-72254e00-a16f-11e9-9e34-53c98b84787e.png)

1. VSCode produces the correct `launch.json`:

```
{
// Use IntelliSense to find out which attributes exist for C# debugging
// Use hover for the description of the existing attributes
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
"version": "0.2.0",
"configurations": [
{
"name": ".NET Core Launch (web)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/bin/Debug/netcoreapp2.1/project.dll",
"args": [],
"cwd": "${workspaceFolder}",
"stopAtEntry": false,
// Enable launching a web browser when ASP.NET Core starts. For more information: https://aka.ms/VSCode-CS-LaunchJson-WebBrowser
"serverReadyAction": {
"action": "openExternally",
"pattern": "^\\s*Now listening on:\\s+(https?://\\S+)"
},
"env": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"sourceFileMap": {
"/Views": "${workspaceFolder}/Views"
}
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach",
"processId": "${command:pickProcess}"
}
]
}
```

* **What is the expected behavior?**
VSCode should probably create the correct JSON file out of the box.

* **What is the motivation / use case for changing the behavior?**
It's not a very good developer experience for someone who is just getting started with Aurelia. It's not necessarily Aurelia's fault, but _something_ is causing the wrong file to be created.

I suppose the reason for the existing `launch.json` file could be to support an `au run` scenario, but that doesn't feel like the typical development workflow for someone using VSCode.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing `au new aurelia-app -u -s http2,dotnet-core,typescript,htmlmin-min,vscode,scaffold-navigation` on the reported setup and inspect the generated `.vscode/launch.json`. Compare it with the VSCode-generated ASP.NET Core configuration shown in the issue; done means the scaffold creates an appropriate configuration for this application type without breaking the documented `au run` workflow.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js, typescript, vscode
Domain
cli, developer-experience
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.