Commit Graph

98 Commits

Author SHA1 Message Date
Matt Bierner cc02f7d4ce Fix some bugs and clean up how markdown change indicators are rendered 2026-05-19 22:23:55 -07:00
Matt Bierner f856c4c486 Various improvements and fixes for markdown diff rendering
For  #315174

Adding better inline diff indicators
2026-05-08 19:10:55 -07:00
Matt Bierner 962c0a02b8 Use a broadcast channel for md preview diff scroll sync
This makes scroll sync faster by using a broadcast channel instead of the normal vscode webview api. This means the two webviews can communicate with each other directly instead of having to go through the extension host and renderer each time
2026-05-07 14:41:06 -07:00
Matt Bierner 240f639bbb Add inner highlighting support in md diff preview 2026-05-07 10:14:44 -07:00
Matt Bierner 9a6cabf884 Fix some bugs around preserving location when switching current tab to md preview 2026-05-05 08:21:16 -07:00
Matt Bierner c2604688bc Merge branch 'main' into dev/mjbvz/comfortable-baboon 2026-05-04 22:29:22 -07:00
Matt Bierner 7e3a9f8165 Add basic support for custom diff editors
For #138525
Fixes #298924

Markdown logic is a bit rough still but basics work

Co-authored-by: Copilot <copilot@github.com>
2026-05-01 15:44:27 -07:00
AshtonYoon 611bf74afd markdown: fix scroll sync regressions introduced in #287050
Two regressions from the merge of #287050:

1. preview.ts: The merge retained `this.#isScrolling = false` inside
   the early-return guard of `scrollTo()`, which was intentionally
   removed in the original PR. This resets the timer-based flag on
   the very first forward-sync call, allowing subsequent editor scroll
   events to re-trigger forward sync while reverse sync is in
   progress, causing the editor to jump back up.

2. index.ts: The PR converted `onUpdateView` from a decrement-counter
   to a timer-based approach but left initialization and resize
   handlers still using `scrollDisabledCount += 1` without a
   corresponding timer reset. The old scroll handler decremented the
   counter naturally; the new handler only returns early. As a result,
   after page load `scrollDisabledCount` stays at 1 indefinitely,
   blocking all preview-to-editor sync until the user scrolls the
   editor once.

Fixes:
- Remove the erroneous `this.#isScrolling = false` from scrollTo()
- Apply the same timer-reset pattern (200ms) to initialization and
  resize handlers so scrollDisabledCount is always auto-cleared

Fixes #307762
2026-04-04 10:14:34 +09:00
Matt Bierner 243bce7593 Merge branch 'main' into fix/janky-scrolling-in-markdown-preview 2026-03-26 15:14:38 -07:00
Matt Bierner 1592b94c9a Fix any usages in the markdown preview sources
For #269213
2026-03-11 09:54:42 -07:00
Matt Bierner 7df46143a1 Experiment with switching markdown extension to use native privates
Let's try this out with one extension to start
2026-03-10 23:13:16 -07:00
Ashton Yoon 1be6ff2ae9 Merge branch 'main' into fix/janky-scrolling-in-markdown-preview 2026-03-11 13:46:36 +09:00
Matt Bierner 5d33f345e1 Merge branch 'main' into dev/mjbvz/legitimate-squirrel 2026-02-12 12:37:14 -08:00
Matt Bierner 0d9a2ef2b0 Add explicit rootDirs 2026-01-30 11:07:53 -08:00
AshtonYoon ce82477188 markdown: remove extra blank lines 2026-01-19 15:22:35 +09:00
AshtonYoon 8cfe3492f9 markdown: fix janky scrolling in preview with code blocks
Fixes #278930

This commit fixes the scroll synchronization issues between the markdown
editor and preview when scrolling through code blocks:

1. **Code block line tracking**: Added endLine calculation for fenced
   code blocks by counting newlines, enabling accurate line-to-position
   mapping within multi-line code blocks.

2. **Padding-aware scrolling**: Implemented getContentBounds() to
   calculate scroll positions excluding padding, preventing jumps when
   scrolling through code blocks with padding.

3. **Scroll loop prevention**: Changed scroll disable flags from counters
   to timer-based booleans (50ms) to prevent infinite sync loops while
   maintaining smooth bidirectional synchronization.

The fix ensures smooth scrolling through code blocks without jumping or
stuttering in both directions (editor ↔ preview).
2026-01-12 12:39:02 +09:00
MohamedEmirHajji 7da4bbe808 Markdown preview: filter hidden elements from scroll sync (fix microsoft#281247) 2025-12-10 17:01:55 +01:00
MohamedEmirHajji e04a029f0e Markdown preview: filter hidden elements from scroll sync (fix #281247) 2025-12-10 15:54:00 +01:00
Matt Bierner 1cc342a089 Merge branch 'main' into dev/mjbvz/legitimate-squirrel 2025-10-14 23:01:21 -07:00
Matt Bierner 98b069c041 Work towards getting isolated built-in extension compiles
For #271167

This makes it so our built-in extensions can mostly be built using `tsc` on the command line. Previously the extensions were picking up a lot of typing info from the root `node_modules` that meant they weren't truly independent
2025-10-13 11:03:20 -07:00
Matt Bierner a8101c12b5 Fix any cases in md extension
For #269213
2025-10-03 14:15:39 -07:00
Matt Bierner 598304ba4d Merge pull request #269665 from mjbvz/dev/mjbvz/delicious-sloth
Add lint rule for `as any` and bulk ignore all existing breaks
2025-10-03 01:31:51 -07:00
Copilot 3a1b1ed83c Disable double-click to reveal source for .copilotmd files in markdown preview (#267517)
* Initial plan

* Disable double-click behavior for .copilotmd files in markdown preview

Co-authored-by: joaomoreno <22350+joaomoreno@users.noreply.github.com>

* Update extensions/markdown-language-features/preview-src/index.ts

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: joaomoreno <22350+joaomoreno@users.noreply.github.com>
Co-authored-by: João Moreno <joaomoreno@users.noreply.github.com>
2025-10-03 08:27:59 +00:00
Matt Bierner 360c9fd134 Add lint rule for as any and bulk ignore all existing breaks
For #269213

This adds a new eslint rule for `as any` and `<any>({... })`. We'd like to remove almost all of these, however right now the first goal is to prevent them in new code. That's why with this first PR I simply add `eslint-disable` comments for all breaks

Trying to get this change in soon after branching off for release to hopefully minimize disruption during debt week work
2025-10-02 23:38:33 -07:00
Matt Bierner 73e6d6a0a2 Enable a few more stylistic eslint options for my extensions 2025-08-14 10:42:20 -07:00
Matt Bierner 30b93b1217 Bump extensions to target es2024
I reviewed the various changes and library additions of es2024 and it seems they are widely supported across node and modern browsers
2025-08-05 10:40:33 -07:00
heoh 53a4ef7018 Fix markdown preview scroll crawls at EOF (fix #249278) 2025-06-12 03:56:11 +09:00
Matt Bierner 42c4a17dd9 Merge pull request #240508 from notoriousmango/copy-image-handle-error
fix: use the copy command for images with CORS errors in the markdown preview
2025-03-25 13:35:14 -07:00
Matt Bierner 23812e0d8f Make sure scripts in md preview are properly evaluated
Fixes #243454

This restores the previous behavior. If the default security settings are used, scripts will still block blocked by the CSP. If you fully disable the security settings, then we'll try to run them
2025-03-17 11:45:49 -07:00
Seong Min Park de60000148 Merge branch 'main' into copy-image-handle-error 2025-03-16 16:04:34 +09:00
Matt Bierner 0a66642a04 Don't duplicate body in md preview
Fixes #243340
2025-03-12 09:07:34 -07:00
notoriousmango 0928609c9b use selection to copy from web view 2025-02-12 19:09:31 +09:00
Matt Bierner d70e0e2fe0 Merge pull request #236406 from mjbvz/confidential-trout
Small cleanup follow up on #236145
2024-12-17 12:22:16 -08:00
Matt Bierner a47b13ebc2 Small cleanup follow up on #236145
- Don't send content as json
- Reuse existing load helper
2024-12-17 11:59:05 -08:00
Matt Bierner 4559089128 Merge pull request #234649 from notoriousmango/feat-open-image
Add 'open image' context in markdown preview
2024-12-17 11:55:25 -08:00
Parasaran ca72122751 fix 235221: Encode and decode markdown content to escape illegal chars 2024-12-17 23:32:42 +05:30
Parasaran da1d8b9c8e fix 235221: Passing the markdown content to the webview via meta tag and purifying it before use 2024-12-17 22:57:12 +05:30
notoriousmango f7c3b1b474 use openDocumentLink 2024-12-15 00:11:54 +09:00
notoriousmango 0b243279cc open image 2024-11-26 19:53:31 +09:00
Sandeep Somavarapu 841d51da29 write our own little gulp-eslint which takes the eslint from our workspace root (#230115) 2024-09-30 15:36:25 +02:00
Gianluca Cappai 59f6431095 Fix open html anchor link in markdown preview (#228633)
use node.getAttribute instead of node.href

Co-authored-by: Gianluca Cappai <gcappai.dev@@gmail.com>
Co-authored-by: Matt Bierner <matb@microsoft.com>
2024-09-18 14:37:55 -07:00
Matt Bierner 5ee455116f Add codeql comments and small fix (#185931) 2023-06-23 02:40:39 +02:00
MeghanKulkarni 67cc0965b3 allow images in markdown preview editor to be copied (#184432)
* allow images in markdown preview editor to be copied

* resolved feedback

* added findPreview method

* removed copy image command from showPreview

* clean up

---------

Co-authored-by: Meghan Kulkarni <t-mekulkarni@microsoft.com>
2023-06-07 18:08:22 +00:00
Matt Bierner 87a6bda310 Fix opening encoded markdown fragment in preview (#178465)
Fixes #178340
2023-03-28 08:59:30 +02:00
Matt Bierner 1379bf3f15 Fix markdown webview state updates (#178153)
Fixes #164071

Also fixes the webview not scrolling when the resources changes
2023-03-23 17:51:09 +00:00
Matt Bierner 924ee8b4d8 Don't scroll sync to elements inside collapsed details sections (#176541)
Fixes #176538

Turns out that `getClientBoundingRect` returns weird bounds for elements inside of a collapsed details section
2023-03-08 21:06:26 +01:00
Matt Bierner 3ca5284e44 Clean up markdown preview messaging (#176458)
- Add properties directly to message
- Add `ImageInfo` type
- Don't use state to pass around imageInfo
2023-03-07 17:28:13 -08:00
Matt Bierner 6a44101bb1 Type markdown preview webview message (#176444)
Simply types messages. Will clean up types in next pass
2023-03-07 14:23:17 -08:00
Matt Bierner 83c4e0f5c4 Reset markdown scroll progress on resource change (#176437)
Reset scroll progress on resource change

Fixes #164071
2023-03-07 23:12:46 +01:00
Matt Bierner d0ad7c09bb Fix details blocks being auto closed on markdown preview changes (#176330)
Fixes #175353
2023-03-07 02:36:38 +01:00