Skip to content

Support region extraction in {@example} directive - #4253

Merged
szakarias merged 3 commits into
dart-lang:mainfrom
szakarias:example-region-support
Jun 16, 2026
Merged

szakarias merged 3 commits into
dart-lang:mainfrom
szakarias:example-region-support

Conversation

@szakarias

Copy link
Copy Markdown
Collaborator

No description provided.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds support for extracting specific regions (using #region and #endregion markers) and filtering out hidden lines (using #hide) in example files referenced by the @example directive. It also introduces a new warning for missing example regions and updates the test suite accordingly. The review feedback highlights two key areas for improvement: first, using Uri.tryParse instead of Uri.parse to prevent potential crashes on malformed paths; second, using regular expressions instead of simple substring checks to avoid false positives when filtering region and hide markers.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@szakarias
szakarias force-pushed the example-region-support branch 2 times, most recently from aac634a to c48b15f Compare June 10, 2026 11:24
@szakarias
szakarias force-pushed the example-region-support branch from c48b15f to 6df3065 Compare June 11, 2026 08:13
@szakarias szakarias changed the title wip Support region extraction in {@example} directive Jun 11, 2026
@szakarias
szakarias marked this pull request as ready for review June 11, 2026 08:15
@szakarias
szakarias requested a review from sigurdm June 11, 2026 08:34

@sigurdm sigurdm left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, a few design questions, but I could live with the current design

@szakarias szakarias mentioned this pull request Jun 15, 2026
@szakarias
szakarias merged commit 6396d51 into dart-lang:main Jun 16, 2026
18 checks passed
copybara-service Bot pushed a commit to dart-lang/sdk that referenced this pull request Jul 7, 2026
Holding back `core` after a reverted roll.
Holding back `tools` due to breaking changes in `package:api_summary`.
HOlding back `protobuf` for a clean package roll instead of changing test
expectations.

Revisions updated by `dart tools/rev_sdk_deps.dart`.

dartdoc (https://github.com/dart-lang/dartdoc/compare/77a52b6..1d56f26):
  1d56f263  Thu Jun 18 11:23:46 2026 +0200  Sarah Zakarias  Document example directive (dart-lang/dartdoc#4261)
  6396d510  Tue Jun 16 09:42:24 2026 +0200  Sarah Zakarias  Support region extraction in {@example} directive (dart-lang/dartdoc#4253)
  a8cca825  Mon Jun 15 14:34:08 2026 +0200  Sarah Zakarias  Filter invalid annotations on primary constructor parameters (dart-lang/dartdoc#4254)
  869c9ff2  Mon Jun 15 14:17:49 2026 +0200  Sarah Zakarias  Require analyzer 13.0.2 and replace deprecated getChildAssumingFolder and getChildAssumingFile (dart-lang/dartdoc#4255)
  a63e6b6f  Mon Jun 15 11:45:21 2026 +0200  Sarah Zakarias  Bump to 9.0.5 (dart-lang/dartdoc#4256)
  541deb50  Fri Jun 12 12:45:25 2026 +0200  dependabot[bot]  Bump analyzer_testing from 0.2.6 to 0.3.0 (dart-lang/dartdoc#4252)
  d0fac90e  Thu Jun 4 12:51:30 2026 +0200  Lasse R.H. Nielsen  Stop using modifiers on parameters. (dart-lang/dartdoc#4251)
  3f681eda  Wed Jun 3 03:45:24 2026 +0000  dependabot[bot]  Bump the github-actions group with 2 updates (dart-lang/dartdoc#4250)
  7fdcad70  Mon Jun 1 11:33:57 2026 +0200  Sarah Zakarias  Primary constructors: add more tests (dart-lang/dartdoc#4249)
  900e7975  Fri May 29 13:02:43 2026 +0200  Sarah Zakarias  Add tests for abbreviated constructor declarations (dart-lang/dartdoc#4247)
  cde60fd7  Fri May 29 11:37:34 2026 +0200  Sarah Zakarias  Add tests for private named parameters in primary constructors (dart-lang/dartdoc#4248)
  b0e4160c  Wed May 27 10:28:47 2026 +0200  Sarah Zakarias  Add tests for primary constructor bodies and comment references (dart-lang/dartdoc#4246)
  5896fce7  Fri May 22 14:50:38 2026 +0200  Sarah Zakarias  Add baseline tests for Primary Constructors field induction and metadata propagation. (dart-lang/dartdoc#4245)
  8a7a54cf  Thu May 21 13:22:47 2026 +0200  Lasse R.H. Nielsen  Fixes crash when seeing a `this;` in a body. (dart-lang/dartdoc#4244)

ecosystem (https://github.com/dart-lang/ecosystem/compare/319ff81..848b3bf):
  848b3bf  Tue Jun 23 22:54:56 2026 -0700  Polina Cherkasova  Explain goal and usage of the table 'Package publishing'. (dart-lang/ecosystem#417)
  63c7b4f  Tue Jun 23 00:22:40 2026 -0700  Kevin Moore  chore: inline find-comment/create-or-update-comment (dart-lang/ecosystem#413)
  911a6bf  Thu Jun 4 13:07:22 2026 -0700  Kevin Moore  fix(firehose): skip changelog and breaking changes checks for unpublished packages (dart-lang/ecosystem#420)
  f443df6  Wed Jun 3 02:48:10 2026 +0000  dependabot[bot]  Bump the github-actions group with 3 updates (dart-lang/ecosystem#419)
  ded86f4  Tue May 12 15:06:43 2026 -0700  Kevin Moore  firehose: Improve documentation, especially around publish (dart-lang/ecosystem#415)

http (https://github.com/dart-lang/http/compare/c140dc0..5d94ef5):
  5d94ef5  Tue Jun 23 09:45:15 2026 -0700  Brian Quinlan  chore(cronet_http): prepare 1.9.0 (dart-lang/http#1924)
  99a8c99  Tue Jun 23 09:17:19 2026 -0700  Brian Quinlan  Upgrade cronet_http to JNI 1.0 and JNIGen 0.16.0 (dart-lang/http#1940)
  bef40af  Tue Jun 23 02:43:32 2026 +0300  Hasan M. Hallak  Fix(http): Release the underlying connection when an AbortableRequest is aborted before its body is read (dart-lang/http#1935)
  89cec60  Mon Jun 1 06:07:07 2026 +0000  dependabot[bot]  chore(deps): bump the github-actions group with 2 updates (dart-lang/http#1933)
  ab3d00d  Fri May 29 20:51:56 2026 +0200  Daco Harkes  fix(cupertino_http): Build hook code assets check (dart-lang/http#1930)
  8227c9d  Thu May 28 10:51:23 2026 -0700  Brian Quinlan  fix(cupertino_http): non-apple build (dart-lang/http#1927)
  73b1a4c  Thu May 28 10:25:18 2026 -0700  Brian Quinlan  doc(cupertino_http): fix code examples (dart-lang/http#1923)
  d06f6b1  Wed May 27 12:06:33 2026 -0700  Brian Quinlan  doc(cupertino_http): not a plugin (dart-lang/http#1922)
  645ec68  Tue May 26 09:13:11 2026 -0700  Brian Quinlan  [cupertino_http] prepare v3.0.0 release (dart-lang/http#1921)
  0a84117  Mon May 18 18:11:39 2026 -0700  Nate Bosch  Preserve header case in `IOClient` (dart-lang/http#1918)
  95b4830  Mon May 18 16:15:08 2026 -0700  Brian Quinlan  feat(cupertino): throw on close with active requests (dart-lang/http#1910)
  2d9110e  Mon May 18 14:43:33 2026 -0700  Brian Quinlan  chore(cronet): upgrade to latest cronet (dart-lang/http#1916)

i18n (https://github.com/dart-lang/i18n/compare/2ae32fd..d0683bd):
  d0683bde  Mon Jun 29 10:10:51 2026 +0200  dependabot[bot]  Bump the github-actions group across 1 directory with 7 updates (dart-lang/i18n#1063)
  9788e631  Mon Jun 29 09:52:02 2026 +0200  Moritz  Intl4X version updates. (dart-lang/i18n#1065)
  b6f9fbd4  Mon Jun 22 00:53:40 2026 -0700  Copybara-Service  Merge pull request `#1058` from dart-lang:upgrade_analyzer
  3c3d35ce  Mon Jun 22 10:07:10 2026 +0300  Moritz  run format on dev
  22b808d7  Mon Jun 22 10:05:24 2026 +0300  Moritz  use broader types
  588013a5  Fri Jun 19 15:28:26 2026 +0200  Moritz  Upgrade analyzer
  3be91bcd  Thu Apr 23 10:37:41 2026 +0200  Martin Kustermann  Add @pragma(wasm:prefer-inline)` to `Intl` methods (dart-lang/i18n#1060)

shelf (https://github.com/dart-lang/shelf/compare/74d58bc..71248e7):
  71248e7  Thu Jun 25 14:43:33 2026 +0200  Sigurd Meldgaard  Upgrade analyzer to <15.0.0 in shelf_router_generator (dart-lang/shelf#533)
  b4c3878  Tue Jun 16 15:52:16 2026 -0700  Kevin Moore  chore: unify and fix analysis options across packages (dart-lang/shelf#528)
  4448fb4  Tue Jun 16 13:53:22 2026 -0700  Kevin Moore  chore: bump pkg:shelf min SDK to Dart 3.9 (dart-lang/shelf#530)
  aade3a8  Tue Jun 2 12:03:25 2026 +0000  dependabot[bot]  Bump the github-actions group with 2 updates (dart-lang/shelf#529)

test (https://github.com/dart-lang/test/compare/4724c3e..bd92e63):
  bd92e633  Fri Jun 26 18:31:05 2026 -0700  Nate Bosch  Prepare to publish (dart-lang/test#2686)

vector_math (https://github.com/google/vector_math.dart/compare/7bf60fb..cf3b5db):
  cf3b5db  Fri Jun 5 09:17:16 2026 -0700  John McCutchan  Update README.md (google/vector_math.dart#370)
  edb7d53  Wed Jun 3 16:44:40 2026 -0400  stuartmorgan-g  Note repo move in README

web (https://github.com/dart-lang/web/compare/19d0315..eb8c3fc):
  eb8c3fc  Mon Jun 15 21:23:46 2026 -0700  Srujan Gaddam  Only pass langVersion if snapshot (dart-lang/web#561)
  01ead68  Fri Jun 12 18:44:56 2026 -0700  Kevin Moore  js_interop_gen: support the latest pkg:analyzer (dart-lang/web#547)
  60a77a2  Fri Jun 12 12:24:45 2026 -0700  Kevin Moore  fix(web): restore accidentally reverted helpers and workflows from `#554` (dart-lang/web#558)
  6b3c0cd  Thu Jun 11 20:34:50 2026 -0700  Kevin Moore  feat(js_interop_gen): support automatically generated WebIDL typings via dogfooded generator (dart-lang/web#554)
  76442e5  Thu Jun 11 20:33:46 2026 -0700  Kevin Moore  feat(js_interop_gen): support nested typealiases, namespace parent resolutions, and aliased variable exports in compiler core (dart-lang/web#553)

[email protected]

Change-Id: I94ad2ba6ba65d5fba3774d33ee2d78dad2286235
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/520981
Reviewed-by: Brian Quinlan <[email protected]>
Commit-Queue: Nate Bosch <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants