Problem description
I followed the vscode tutorial on creating an extension, but I cannot reproduce the behavior of "the command popping up in the Command Palette", nor can I get breakpoints to hit.
My steps
- I followed the tutorial verbatim, that is
yo codeNew Extenion (TypeScript)- ...
- all the way to package manager:
npm
- Open the project with
code - Press F5 (let's ignore the small error that I got that there's no problem matcher installed. It went away after installing the recommended extensions (
eamodio/vscode-tsl-problem-matcherandMicrosoft/vscode-eslint). - The Extension host pops up. There's no error.
- ctrl+shift+p, hello
Unfortunately the command hello world doesn't pop up in the list.
Neither are the breakpoints hit in extension.ts (like in this part of the tutorial).
The breakpoints are unhittable, i.e. their interior is white rather than red.
It seems the extension is not being loaded. What am I doing wrong? How can I fix it?
What I tried
I retried many attempts, triple checking my spellings and following of the tutorial. I tried a PC restart. I tried with and without webpack bundling. I reran tsc. I downgraded typescript to 4.7.4 (as later on it warns that 4.8.2 isn't officially supported)
Some possibly relevant version numbers: Windows 10, npm 8.5.5, yo 4.3.0, vscode 1.69.2
Check the version of
engines.vscodeinpackage.json:The template generated by
yorequires the latest vscode the be installed. Change it in thepackage.jsonor upgrade vscode.More detailed explanation
I diagnosed the issue by compiling the extension into a VSIX (
npm install -g vsce && vsce package). After installing it, I expect the command to be listed in the Command Palette, but don't expect the breakpoint to be hit.Upon manually installing the vsix in the Extension development host (extensions -> triple dot -> Install from VSIX), vscode prompted the error
That gives a hint. In the
package.jsonthere wasbut that version is higher than I currently have installed. After changing that to my version, everything started working as advertised.