Skip to content

Cannot set ⇧⌘V to match GitHub-style pasting for URLs into Markdown #249893

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

Open
lgarron opened this issue May 27, 2025 · 2 comments
Open

Cannot set ⇧⌘V to match GitHub-style pasting for URLs into Markdown #249893

lgarron opened this issue May 27, 2025 · 2 comments
Assignees
Labels
editor-clipboard Editor clipboard issues

Comments

@lgarron
Copy link

lgarron commented May 27, 2025

Type: Bug

  1. Try to include something like the following in keybindings.json:
{
  // …
  {
    "key": "shift+cmd+v",
    "command": "-markdown.showPreview",
    "when": "!notebookEditorFocused && editorLangId == 'markdown'"
  },
  {
    "key": "shift+cmd+v",
    "command": "editor.action.pasteAs",
    "args": {
  	    "kind": "text.plain"
    },
    "when": "inputFocus"
  }
}
  1. Copy a URL to the clipboard and paste it over text in a Markdown document using ⇧⌘V.

Expected: I can match exactly what happens when pasting into GitHub issues:

  1. Pasting using ⌘V pastes using "smart with selection".
  2. Pasting using ⇧⌘V always pastes the URL directly, overriding any selected text if it exists.

Observed: Smart links are still pasted using "smart with selection".

It seems that the heuristics from #188871 (comment) are overriding the behaviour of "paste as plain text" when the plain text resembles a URL.

The settings note that it's possible to change the paste after the fact. I do not want that. I would like to paste the URL directly as intended without fixing it up afterwards. I am very happy with how GItHub implements it, and I would like to match that in order to decrease cognitive load from context switching.

Perhaps I'm missing something, but I have not been able to make this work using information at #188871 (comment) or anything I've tried with editor.action.pasteAs or editor.action.clipboardPasteAction.

This occurs with extensions disabled.

VS Code version: Code 1.100.2 (848b80a, 2025-05-14T21:47:40.416Z)
OS version: Darwin arm64 24.5.0
Modes:

System Info
Item Value
CPUs Apple M1 Max (10 x 2400)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) 28, 16, 16
Memory (System) 64.00GB (2.90GB free)
Process Argv --crash-reporter-id 88d577d0-2e7d-4290-872a-7cef906b73f7
Screen Reader no
VM 0%
Extensions (40)
Extension Author (truncated) Version
Bookmarks ale 13.5.0
django-html bib 1.3.0
markdown-preview-github-styles bie 2.1.0
biome bio 2025.5.251939
vscode-fish bma 1.0.39
ruff cha 2025.22.0
custom-window-zoom cra 1.1.4
vscode-markdownlint Dav 0.60.0
binary-plist dni 0.11.4
gitlens eam 17.1.1
swap fau 0.1.0
codespaces Git 1.17.3
vscode-github-actions git 0.27.1
vscode-pull-request-github Git 0.110.0
go gol 0.46.1
applescript idl 0.27.1
color-picker-universal Jer 2.8.5
jjk jjk 0.7.0
openscad-language-support Lea 2.0.0
vscode-apache mrm 1.2.0
vscode-json5 mrm 1.0.0
debugpy ms- 2025.8.0
python ms- 2025.6.1
vscode-pylance ms- 2025.5.1
remote-containers ms- 0.413.0
remote-ssh ms- 0.120.0
remote-ssh-edit ms- 0.87.0
remote-explorer ms- 0.5.0
test-adapter-converter ms- 0.2.1
vsliveshare ms- 1.0.5948
bun-vscode ove 0.0.28
toggle-case Pra 0.1.2
vscode-yaml red 1.18.0
rust-analyzer rus 0.3.2474
rewrap stk 1.16.3
even-better-toml tam 0.21.2
shellcheck tim 0.37.7
vscode-status-bar-format-toggle tom 3.2.0
vscode-java-dependency vsc 0.24.1
markdown-all-in-one yzh 3.6.3
A/B Experiments
vsliv368cf:30146710
vspor879:30202332
vspor708:30202333
vspor363:30204092
vscod805cf:30301675
binariesv615:30325510
c4g48928:30535728
azure-dev_surveyone:30548225
vscrpc:30673769
962ge761:30959799
h48ei257:31000450
pythontbext0:30879054
cppperfnew:31000557
dwnewjupyter:31046869
pythonrstrctxt:31112756
nativeloc1:31192215
5fd0e150:31155592
dwcopilot:31170013
6074i472:31201624
dwoutputs:31242946
customenabled:31248079
hdaa2157:31222309
copilot_t_ci:31222730
e5gg6876:31282496
pythoneinst12:31285622
bgtreat:31268568
4gafe986:31271826
c7cif404:31314491
996jf627:31283433
pythonrdcb7:31303018
usemplatestapi:31297334
0aa6g176:31307128
7bj51361:31289155
747dc170:31275177
pylancecolor:31314202
aj953862:31281341
generatesymbolt:31295002
convertfstringf:31295003
gendocf:31295004

@lgarron
Copy link
Author

lgarron commented May 27, 2025

It would also be helpful if editor.action.pasteAs or editor.action.clipboardPasteAction had any sort of documentation.

Looking up information about editor.action.pasteAs results mainly in finding #183681 , which suggest that the appropriate field to set in "args" is "id". But this seems to be incorrect. The builtin JSON schema checker tells me that "kind" is apparently the correct field now, but I'm not really confident in this.

@lgarron
Copy link
Author

lgarron commented May 27, 2025

@mjbvz, apologies if a direct ping is not appropriate, but I'd appreciate help understanding if this is an actual bug or if I need to learn more about VS Code internals to fix the behaviour in settings!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
editor-clipboard Editor clipboard issues
Projects
None yet
Development

No branches or pull requests

3 participants