microsoft / vscode-generator-code

Visual Studio Code extension generator
Other
1.31k stars 225 forks source link

Fixes needed for typescript/esbuild combination. $esbuild-watch not recognised. #493

Closed AndrewNelis closed 2 months ago

AndrewNelis commented 2 months ago

Hi,

(I searched but couldn't find any information about this before!)

When I created a new project and selected "typescript" using the "esbuild" system, the project is created successfully but pressing F5 to run the task results in an issue. VSCode does not recognise the problem matcher $esbuild-watch defined here:

https://github.com/microsoft/vscode-generator-code/blob/741c08a5f6232014aedab37485ab72edfac9c8e1/generators/app/templates/ext-command-ts/vscode-esbuild/vscode/tasks.json#L24

I was able to work around this by turning the "problemMatcher" key in tasks.json to the following;

            "problemMatcher": {
                "base": "$esbuild",
                "severity": "error",
                "applyTo": "closedDocuments",
                "source": "esbuild",
                "fileLocation": "relative",
                "background": {
                    "activeOnStart": true,
                    "beginsPattern": {
                    "regexp": "\\[watch\\] build started"
                    },
                    "endsPattern": {
                    "regexp": "\\[watch\\] build finished"
                    }
                }
            },

I don't know if I'm missing plugin here? I could not find mention of needing to install anything in the yo docs.

Hope this is of some help to someone.

$ npm --version
10.8.3
$ node --version
v20.12.2
$ code --version
1.93.0
4849ca9bdf9666755eb463db297b69e5385090e3
x64
$ npx yo --version
5.0.0
AndrewNelis commented 2 months ago

And then today, the above failed and I was able to just use $ts-esbuild-watch as the problemMatcher value.

This seems like a user error.

sovietspaceship commented 1 month ago

It's caused by missing the connor4312.esbuild-problem-matchers extension listed in .vscode\extensions.json. When you generate the project it also prints "To run the extension you need to install the recommended extension 'connor4312.esbuild-problem-matchers'." which I completely missed, which is why I found this issue.