Applies gitlens.advanced.abbreviateShaOnCopy to copyRemoteFileUrlToClipboard#5223
Open
01luyicheng wants to merge 3 commits into
Open
Applies gitlens.advanced.abbreviateShaOnCopy to copyRemoteFileUrlToClipboard#522301luyicheng wants to merge 3 commits into
01luyicheng wants to merge 3 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the “Copy Remote File URL …” command family to respect the existing gitlens.advanced.abbreviateShaOnCopy setting, abbreviating commit SHAs in generated remote URLs when copying to the clipboard.
Changes:
- Imports
shortenRevision()and applies it to theshapassed into the remote URL builder whenargs.clipboardis true andadvanced.abbreviateShaOnCopyis enabled. - Wires configuration access into
OpenFileOnRemoteCommand.execute()to drive the new behavior.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| range: range, | ||
| sha: sha ?? undefined, | ||
| sha: | ||
| sha != null && args.clipboard && configuration.get('advanced.abbreviateShaOnCopy') |
…ipboard Closes gitkraken#2160 When copying a remote file URL to the clipboard, if the user has enabled the gitlens.advanced.abbreviateShaOnCopy setting, the SHA in the URL will now be abbreviated (shortened) just like when copying a SHA directly. This affects the following commands: - gitlens.copyRemoteFileUrlToClipboard - gitlens.copyRemoteFileUrlWithoutRange - gitlens.copyRemoteFileUrlFrom
1a6550d to
9b0ad08
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
This PR applies the
gitlens.advanced.abbreviateShaOnCopysetting to thegitlens.copyRemoteFileUrlToClipboardcommand (and related clipboard commands), so that when copying a remote file URL to the clipboard, the SHA in the URL will be abbreviated if the user has enabled this setting.Fixes #2160
Changes
OpenFileOnRemoteCommand.execute()insrc/commands/openFileOnRemote.tsargs.clipboardistrueandconfiguration.get('advanced.abbreviateShaOnCopy')is enabled, the SHA is shortened usingshortenRevision()before being passed to the remote provider URL builderAffected Commands
gitlens.copyRemoteFileUrlToClipboardgitlens.copyRemoteFileUrlWithoutRangegitlens.copyRemoteFileUrlFromChecklist
copyShaToClipboardcommand