Search code examples
javascripttypescriptdebuggingvscode-extensionsvscode-debugger

Extension Not Loading in Visual Studio Code - No Debug Messages Displayed


I’m developing an extension for Visual Studio Code, and I’m encountering an issue where the extension doesn’t seem to load, and I’m not seeing any debug messages I’ve added. Here are the details of my problem:

package.json:

"main": "./out/extension.js",
    "contributes": {
        "commands": [
        {
            "command": "name.function",
            "title": "Function Name"
        }
    ],
    "viewsContainers": {
        "activitybar": [
            {
                "id": "FunctionName",
                "title": "Function Name",
                "icon": "media/icon/icon.svg"
            }
        ]
    },
   "views": {
        "FunctionName": [
        {
                "type": "webview",
                "id": "name.function",
                "name": "Function Name"
            }
        ]
    }
},

The Problem:

I’ve added the following line to extension.ts to check if the extension is loading:

console.log('Debug1A');
vscode.window.showInformationMessage('Debug1B');

Despite this, I’m not seeing any messages in the output or UI. I’ve checked the following:

  • launch.json Configuration: The configuration seems correct, and I’m running the extension in a debug session.
  • Compiled Files: The extension.js file exists in the ./out directory, and the TypeScript files compile without errors.

I removed the ActivationEvents because in the terminal it told me they would be generated automatically

"activationEvents": [
    "onCommand:name.function",
    "onView:name.function"
],

Any help or suggestions would be greatly appreciated!


Solution

  • I found the solution to my issue. The problem was that my extension version in package.json was "1.0", but VS Code requires a three-part version. After changing it to "1.0.0", the extension loaded correctly.

    I missed this issue because I was checking the "Extension Host" output, not the "Window" output in the "OUTPUT" panel, where the version issue was actually reported.

    Yes, I found this completely at random because I didn't know where else to look.