feat: Add copy link to tag support #403
Open
+102
−28
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add Tag Support for Permalinks
Summary
This PR adds support for creating permalinks to Git tags, alongside the existing branch, commit, and default branch options. Tags provide a more readable alternative to commit hashes for versioned releases.
Changes
New Features
tagoption for thegitweblinks.linkTypesetting to use tags by defaultFiles Modified
src/types.ts- Added'tag'toLinkTypeandLinkTargetRef.typeunionssrc/constants.ts- AddedcopySelectionToTagcommand constantsrc/settings.ts- Handle'tag'ingetDefaultLinkType()src/link-handler.ts- Added'tag'case ingetRef()usinggit describe --exact-match --tags HEADsrc/commands/get-link-command.ts- Added "Current tag" preset and "Tags" section in quick picksrc/commands/index.ts- RegisteredcopySelectionToTagcommandpackage.json- Added command definition and'tag'tolinkTypeenumTest Updates
The quick pick item indices in
get-link-command.test.tswere updated to account for the new structure:Previous structure (10 items):
New structure (12 items):
This shifted the branch item indices by 1 (from
[4,5,6]to[5,6,7]) and commit item indices by 2 (from[8,9,10]to[10,11,12]).Implementation Details
git describe --exact-match --tags HEADfor the current taggit tag -l --format='%(refname:short) %(objectname:short) %(objectname)'{{ ref }}placeholder contains the tag name)