feat: support the <context> core tag#558
Conversation
🦋 Changeset detectedLatest commit: 73eb83a The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 6 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (21)
📒 Files selected for processing (16)
WalkthroughThis pull request adds support for the Marko 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/language-tools/src/extractors/script/index.ts`:
- Around line 416-424: The nested `<context>` capture from
`#getContextProvideTag` is being treated as if it were declared in the outer
template scope, which makes `withContext(context, ...)` reference an
out-of-scope identifier when the provider is emitted inside a generated
callback. Update `packages/language-tools/src/extractors/script/index.ts` so
`didProvide` only reflects providers in the current function scope, or hoist a
template-scope capture variable and assign to it from the nested provider path
in the `didProvide`/`didReturn` flow around `#extractor.write`,
`varShared("withContext")`, and `varLocal("context")`. Ensure the nested
callback code at the provider generation sites uses the hoisted capture instead
of a local `var context`.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: f4d58d01-01dc-4eb3-b2ad-48819a64cbad
⛔ Files ignored due to path filters (18)
packages/language-server/src/__tests__/fixtures/script/context-tag/__snapshots__/context-tag.expected/components/mode-provider.htmlis excluded by!**/__snapshots__/**and included by**packages/language-server/src/__tests__/fixtures/script/context-tag/__snapshots__/context-tag.expected/components/mode-provider.mdis excluded by!**/__snapshots__/**and included by**packages/language-server/src/__tests__/fixtures/script/context-tag/__snapshots__/context-tag.expected/components/mode-provider.tsis excluded by!**/__snapshots__/**and included by**packages/language-server/src/__tests__/fixtures/script/context-tag/__snapshots__/context-tag.expected/components/show-mode.htmlis excluded by!**/__snapshots__/**and included by**packages/language-server/src/__tests__/fixtures/script/context-tag/__snapshots__/context-tag.expected/components/show-mode.mdis excluded by!**/__snapshots__/**and included by**packages/language-server/src/__tests__/fixtures/script/context-tag/__snapshots__/context-tag.expected/components/show-mode.tsis excluded by!**/__snapshots__/**and included by**packages/language-server/src/__tests__/fixtures/script/context-tag/__snapshots__/context-tag.expected/components/show-theme-relative.htmlis excluded by!**/__snapshots__/**and included by**packages/language-server/src/__tests__/fixtures/script/context-tag/__snapshots__/context-tag.expected/components/show-theme-relative.mdis excluded by!**/__snapshots__/**and included by**packages/language-server/src/__tests__/fixtures/script/context-tag/__snapshots__/context-tag.expected/components/show-theme-relative.tsis excluded by!**/__snapshots__/**and included by**packages/language-server/src/__tests__/fixtures/script/context-tag/__snapshots__/context-tag.expected/components/show-theme.htmlis excluded by!**/__snapshots__/**and included by**packages/language-server/src/__tests__/fixtures/script/context-tag/__snapshots__/context-tag.expected/components/show-theme.mdis excluded by!**/__snapshots__/**and included by**packages/language-server/src/__tests__/fixtures/script/context-tag/__snapshots__/context-tag.expected/components/show-theme.tsis excluded by!**/__snapshots__/**and included by**packages/language-server/src/__tests__/fixtures/script/context-tag/__snapshots__/context-tag.expected/components/theme-provider.htmlis excluded by!**/__snapshots__/**and included by**packages/language-server/src/__tests__/fixtures/script/context-tag/__snapshots__/context-tag.expected/components/theme-provider.mdis excluded by!**/__snapshots__/**and included by**packages/language-server/src/__tests__/fixtures/script/context-tag/__snapshots__/context-tag.expected/components/theme-provider.tsis excluded by!**/__snapshots__/**and included by**packages/language-server/src/__tests__/fixtures/script/context-tag/__snapshots__/context-tag.expected/index.htmlis excluded by!**/__snapshots__/**and included by**packages/language-server/src/__tests__/fixtures/script/context-tag/__snapshots__/context-tag.expected/index.mdis excluded by!**/__snapshots__/**and included by**packages/language-server/src/__tests__/fixtures/script/context-tag/__snapshots__/context-tag.expected/index.tsis excluded by!**/__snapshots__/**and included by**
📒 Files selected for processing (15)
.changeset/context-tag-support.mdpackages/language-server/src/__tests__/context-from-complete.test.tspackages/language-server/src/__tests__/fixtures/script/context-tag/components/mode-provider.markopackages/language-server/src/__tests__/fixtures/script/context-tag/components/show-mode.markopackages/language-server/src/__tests__/fixtures/script/context-tag/components/show-theme-relative.markopackages/language-server/src/__tests__/fixtures/script/context-tag/components/show-theme.markopackages/language-server/src/__tests__/fixtures/script/context-tag/components/theme-provider.markopackages/language-server/src/__tests__/fixtures/script/context-tag/index.markopackages/language-server/src/service/marko/complete/AttrValue.tspackages/language-server/src/service/marko/complete/Import.tspackages/language-server/src/service/marko/document-links.tspackages/language-server/src/service/marko/util/context-from-attr.tspackages/language-server/src/service/marko/util/tag-shorthand-completions.tspackages/language-tools/marko.internal.d.tspackages/language-tools/src/extractors/script/index.ts
The from= attribute gets tag-name ("<my-tag>") and relative path
completions plus document links, and a consumer's tag variable is
typed as exactly the provided value of the template from= resolves
to (a provide threads its value's type out through the template's
return type; conditional and nested provide sites still type
exactly, and writable assignments check against the provided type).
25a8edb to
73eb83a
Compare
Adds editor support for the new
<context>core tag (marko-js/marko#3336):from=completion: tag-name shorthand ("<my-tag>") completes like an import shorthand (shared machinery), and relative paths complete through the existing file completion. Both forms also get document links.from=resolves to. A provide-mode<context>threads its value's type out through the template's return type, so conditional and nested provide sites still type exactly (reading an unprovided context is a runtime error, not a validundefined), and writable consumer assignments check against the provided type.Includes a changeset, completion tests, and a hover/diagnostics fixture.
🤖 Generated with Claude Code
https://claude.ai/code/session_01SsZZbkMsjMbDCQLxkrbqE9
Generated by Claude Code