vadimcn / codelldb

A native debugger extension for VSCode based on LLDB
https://marketplace.visualstudio.com/items?itemName=vadimcn.vscode-lldb
MIT License
2.42k stars 237 forks source link

VS Code doesn't clear the extension folder after upgrading or uninstalling #1044

Open lnxpgn opened 6 months ago

lnxpgn commented 6 months ago

OS: Debian Linux 12 VSCode version: 1.85.0 CodeLLDB version: 1.10.0 Compiler: rustc Debuggee:

  1. After upgrading CodeLLDB

    The folders of old versions still exist and have a file ~/.vscode/extensions/.obsolete, the content of .obsolete:

    {"vadimcn.vscode-lldb-1.9.0":true,"vadimcn.vscode-lldb-1.9.2":true}

    According to the issue, I added __metadata in

    ~/.vscode/extensions/vadimcn.vscode-lldb-1.9.0/package.json

    and

    ~/.vscode/extensions/vadimcn.vscode-lldb-1.9.2/package.json,

    like this:

    "__metadata": {
        "installedTimestamp": 1691164800000
    }

    After rebooting VS Code, the folders of old versions were deleted and .obsolete was gone.

  2. After uninstalling CodeLLDB

    The content of ~/.vscode/extensions/.obsolete:

    {"vadimcn.vscode-lldb-1.10.0":true}

    I compared the two package.json before and after Acquiring CodeLLDB platform package, the only difference:

    "__metadata": {
    "id": "bee31e34-a44b-4a76-9ec2-e9fd1439a0f6",
    "publisherId": "3b05d186-6311-4caa-99b5-09032a9d3cf5",
    "publisherDisplayName": "Vadim Chugunov",
    "targetPlatform": "undefined",
    "updated": false,
    "isPreReleaseVersion": false,
    "installedTimestamp": 1702437166757,
    "pinned": true,
    "preRelease": false
    }

    The newer package.json hasn't __metadata, I guess the file package.json from the CodeLLDB platform package overwrote the bootstrap version.

    I copied back the bootstrap version package.json that I have backed up and it has __metadata. After rebooting VS Code, it deleted the extension folder and .obsolete was gone.

    I don't have any VS Code extension development experience, hoping this information is helpful.

vadimcn commented 6 months ago

Why do you think this is an extension issue? Seems like deleting extensions is entirely in the purview of VSCode.

lnxpgn commented 6 months ago

I downloaded the CodeLLDB .vsix zip file from Github, the package.json within it hasn't a __metadta field, and didn't find any post-install scripts.

After installing the extension, but before Acquiring CodeLLDB platform package was completed, ~/.vscode/extensions/vadimcn.vscode-lldb-1.10.0/package.json has a __metadata field, I guess VS Code added the __metadta field as a internal state during installation. We can't find any documents about this field in the official VS Code documentation.

After Acquiring CodeLLDB platform package, the __metadata field in ~/.vscode/extensions/vadimcn.vscode-lldb-1.10.0/package.json was gone.

Checking ~/.vscode/extensions, every installed extension except CodeLLDB has the field.

It looks like the package.json from the CodeLLDB platform package overwrote the bootstrap version that VS Code had added the __metadta field.

By exiting VS Code during downloading the platform package to cancel Acquiring CodeLLDB platform package, I can uninstall CodeLLDB completely and VS Code deleted ~/.vscode/extensions/vadimcn.vscode-lldb-1.10.0 successfully.

Missing __metadata, especially the installedTimestamp field, in CodeLLDB's package.json leads to the issue. For this reason, I think this is a CodeLLDB issue.