microsoft / microsoft/vscode

Markdown Preview does not reveal the clicked Search result when it is the default editor for .md files

Open
#336,059 0 comments 0 reactions 1 assignee Claimed by @hediet View on GitHub
Dominant language
TypeScript
Stars
193k
Forks
42.4k
PR merge metrics
PR metrics pending

Description

Type: Bug

1. Make the built-in Markdown Preview the default editor for Markdown files: `"workbench.editorAssociations": { "*.md": "vscode.markdown.preview.editor" }`.
2. Open a folder that contains a long `.md` file, with a word that appears only far down in the file.
3. Open Search (`Ctrl+Shift+F`) and search for that word.
4. Click the match in the Search view.

Current Behavior:

The file opens in the Markdown Preview scrolled to the top. The match is neither revealed nor highlighted, so in a long document the search result gives no indication of where the text is. Clicking a second match in the same file does not move the preview either.

Expected Behavior:

The Markdown Preview scrolls to the source line of the clicked match, as a text editor does. The preview already maps source lines to scroll positions (`markdown.preview.scrollPreviewWithEditor`), so it has what it needs to reveal the line. Highlighting the match would be better still.

Notes:

This is the built-in preview, so no extension API is involved. #289785 and #301887 describe the same gap for extension custom editors. Here it affects VS Code's own editor, which users can now make the default for `.md` files. The same probably applies to other navigation that carries a target position, such as Go to Symbol in Workspace and links with a `#L12` fragment.

The new Markdown Editor (`vscode.markdown.editor`) does reveal the clicked match, so only the Markdown Preview is affected.

VS Code version: Code 1.137.0 (645f29cc3176500b4b5762ba887cf2a7f0ffdf2c, 2026-09-08T13:43:59-07:00)
OS version: Windows_NT x64 10.0.26200
Modes:

System Info

|Item|Value|
|---|---|
|CPUs|Intel(R) Core(TM) i7-10510U CPU @ 1.80GHz (8 x 2304)|
|GPU Status|2d_canvas: enabled
GPU0: VENDOR= 0x8086, DEVICE=0x9b41 [Intel(R) UHD Graphics], DRIVER_VENDOR=Intel, DRIVER_VERSION=26.20.100.6999 *ACTIVE*
GPU1: VENDOR= 0x10de, DEVICE=0x1d13 [NVIDIA GeForce MX250], DRIVER_VERSION=32.0.15.8266
GPU2: VENDOR= 0x1414, DEVICE=0x008c [Microsoft Basic Render Driver], DRIVER_VERSION=10.0.26100.9278
Machine model name:
Machine model version:
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
trees_in_viz: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgpu: enabled
webnn: disabled_off|
|Load (avg)|undefined|
|Memory (System)|15.87GB (2.87GB free)|
|Process Argv|--crash-reporter-id 760ac707-846c-4aaa-a922-4ff4e4e63d62|
|Screen Reader|no|
|VM|0%|
Extensions (18)

Name|Identifier|Author|Version
---|---|---|---
Claude Code for VS Code|anthropic.claude-code|Anthropic|2.1.270
Markdown Preview Mermaid Support|bierner.markdown-mermaid|bierner|1.32.1
Compare View|chekweitan.compare-view|chekweitan|0.14.1
Git History|donjayamanne.githistory|donjayamanne|0.6.20
Prettier - Code formatter|esbenp.prettier-vscode|esbenp|12.4.0
flatbuffers|gaborv.flatbuffers|gaborv|0.3.1
GitHub Pull Requests|github.vscode-pull-request-github|GitHub|0.166.0
PlantUML|jebbs.plantuml|jebbs|2.18.1
TabSanity|jedmao.tabsanity|jedmao|0.0.11
clangd|llvm-vs-code-extensions.vscode-clangd|llvm-vs-code-extensions|0.6.0
PDF Viewer|mathematic.vscode-pdf|mathematic|0.2.5
Compare Folders|moshfeu.compare-folders|moshfeu|0.30.0
WSL|ms-vscode-remote.remote-wsl|ms-vscode-remote|0.104.3
PowerShell|ms-vscode.powershell|ms-vscode|2025.4.0
XLSX, CSV, TSV & Markdown Editor|muhammad-ahmad.xlsx-viewer|muhammad-ahmad|1.9.98
pioarduino IDE|pioarduino.pioarduino-ide|pioarduino|1.4.4
Folder Color|sergeyegorov.folder-color|SergeyEgorov|3.0.0
Markdown PDF|yzane.markdown-pdf|yzane|2.2.0

A/B Experiments

```
vsliv368:30146709
binariesv615:30325510
nativeloc1:31344060
dwcopilot:31170013
dwoutputs:31242946
copilot_t_ci:31333650
e5gg6876:31282496
pythonrdcb7:31342333
6518g693:31463988
aj953862:31281341
envsactivate1:31551504
cloudbuttont:31379625
3efgi100_wstrepl:31403338
ddidt:31399633
ec5jj548:31422691
cp_cls_t_966_ss:31526232
4je02754:31466945
c3h7c220:31478652
cp_cls_c_1081:31454833
conptydll_true:31498968
core-renderer-profiling-on:31440367
e9c30283:31461165
c9b86496:31447327
capico_axe_098a3278:31582664
ei9d7968:31496641
chat:31457767
8hig5102:31480529
89g7j272:31518289
i2gc6536:31499202
52612955:31516516
ec1eg703:31520046
ddid_t:31478206
hmra_i5g22:31518061
7df3h592:31512476
cp_cls_t_1082:31535311
logging_enabled_new:31498466
j0d79568:31499440
jb_cp_cls_t_632:31543129
56dj4588:31512888
32d76977:31512328
ha629193:31508444
jh5f2457_c:31540921
jbcp_cls_pctr_t:31531130
cp_intellij_t_nes:31548657
jf4hg949:31526829
ahp-both-windows:31556933
ihg5j128:31534457
7g2b5551:31542111
nes-ex-cf-euporie-03:31542868
enable_editor_pane_layout:31569726
allow-none:31555437
36h42362:31564511
c7c27ce7:31554789
1h923230:31564177
treatment-23-1:31555779
unuse_dynamic_mcp:31555281
0d8dfbc3:31570291
nemo-v2:31565334
0c1h4866:31566224
session-mark-done:31558131
5b8j3302:31564601
mangle-name-control:31572633
signed-out-control:31581177
intellij_nes_preview_t:31580086
39a5d156:31574986
2bfb8b39:31576696
outline:31581109
aw-autom-on:31582550
revealsession_control_7ed7e840:31582193
permission_prompt_treatment:1332566
ccr_pr_nudge_adoption:1319471
vsc_wsm_c:1340633
jidc7660:1370295
h5e14506:1348996
cfee5631:1379228
3aced641:1389836

```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.