Skip to content

Fix VSIX extension ID extraction for updateTasksId when extensionId input not provided #1217

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

Copilot
Copy link

@Copilot Copilot AI commented Jun 3, 2025

Problem

The updateTasksId feature couldn't derive the extension ID from VSIX-packaged extensions when the extensionId input parameter was not explicitly provided. This caused task IDs to be generated using undefined instead of the actual extension ID from the VSIX file.

Root Cause

The code was reading the extension ID from extension.vsomanifest (JSON format), but this file doesn't contain the actual extension ID - it only has contribution metadata. The real extension ID is stored in extension.vsixmanifest (XML format).

// Before (broken):
const extensionId = `${(tl.getInput("extensionId", false) || manifest.id)}${extensionTag}`;
// manifest.id was undefined from JSON manifest

Solution

Added a new getVsixExtensionId() function that:

  1. Detects when we're processing a VSIX directory (has both .vsomanifest and .vsixmanifest)
  2. Extracts the extension ID from the XML manifest using x2js parser
  3. Falls back gracefully to the original behavior if VSIX manifest isn't available

The extension ID resolution now follows this priority:

  1. extensionId input parameter (highest priority - existing behavior)
  2. VSIX manifest XML file (extension.vsixmanifest) - NEW
  3. JSON manifest file (extension.vsomanifest) - fallback (existing behavior)

Changes

  • Added x2js dependency to Common v4 and v5 packages
  • Implemented getVsixExtensionId() function in both versions
  • Modified updateTaskManifests() to use VSIX extension ID when available
  • Added debug logging to help troubleshoot extension ID resolution

Testing

Created comprehensive tests that demonstrate:

  • ✅ Old behavior: Extension ID was undefined (broken)
  • ✅ New behavior: Extension ID correctly extracted as my-awesome-extension from VSIX manifest
  • ✅ Backward compatibility maintained when extensionId input is provided
  • ✅ Graceful fallback when VSIX manifest not available

Impact

This fix ensures that updateTasksId works correctly for VSIX-packaged extensions without requiring users to manually specify the extensionId parameter, as the extension ID can now be automatically derived from the VSIX file itself.

Fixes #205.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits June 3, 2025 12:31
Co-authored-by: jessehouwing <4173387+jessehouwing@users.noreply.github.com>
Co-authored-by: jessehouwing <4173387+jessehouwing@users.noreply.github.com>
Co-authored-by: jessehouwing <4173387+jessehouwing@users.noreply.github.com>
@Copilot Copilot AI changed the title [WIP] PublishExtension cannot derive the ID of a VSIX-packaged extension, so updateTasksId doesn't work Fix VSIX extension ID extraction for updateTasksId when extensionId input not provided Jun 3, 2025
@Copilot Copilot AI requested a review from jessehouwing June 3, 2025 12:42
Copilot finished work on behalf of jessehouwing June 3, 2025 12:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PublishExtension cannot derive the ID of a VSIX-packaged extension, so updateTasksId doesn't work
2 participants