Skip to content

Migrate live templates to declarative XML for dynamic loading - #9207

Merged
auto-submit[bot] merged 2 commits into
flutter:mainfrom
jwren:flutter-verifier-03-templates-dynamic
Nov 24, 2026
Merged

auto-submit[bot] merged 2 commits into
flutter:mainfrom
jwren:flutter-verifier-03-templates-dynamic

Conversation

@jwren

@jwren jwren commented Nov 3, 2026

Copy link
Copy Markdown
Member

Summary

Eliminates two deprecated live-template API usages and removes the last non-dynamic extension point in flutter-intellij, unlocking full Dynamic Plugin eligibility (252–262) without IDE restarts:

  • Declarative <defaultLiveTemplates> & Dynamic Plugin Gate: Deletes FlutterLiveTemplatesProvider (DefaultLiveTemplatesProvider implementation, which registered the non-dynamic com.intellij.defaultLiveTemplatesProvider extension) in favor of <defaultLiveTemplates file="liveTemplates/flutter_miscellaneous.xml"/> in plugin.xml, and uncomments VerifyPluginTask.FailureLevel.NOT_DYNAMIC in build.gradle.kts.
  • DartToplevelTemplateContextType: Migrates from the deprecated 3-arg DartTemplateContextType(String, String, Class) constructor to the 1-arg DartTemplateContextType("Top-level") constructor with baseContextId="DART" in plugin.xml, and removes the now-obsolete DartTemplateContextType.<init> sed normalization in tool/check_verifier_baselines.sh.
  • Adds unit tests in FlutterLiveTemplatesTest verifying declarative registration of all 7 Flutter live templates (stless, stful, inh, stanim, thof, ihof, mdof), DART_TOPLEVEL -> DART context inheritance, and PSI context matching (top-level vs. class body, comments, and non-Dart files).
  • Ratchets the 3 resolved entries (DefaultLiveTemplatesProvider, DartTemplateContextType.<init>, and Dynamic Plugin Status) out of tool/baseline/{252,253,261}/verifier-baseline.txt, and updates src/io/flutter/template/ABOUT.md and CHANGELOG.md.

Part of #8361

Verification

  • ./gradlew compileJava compileKotlin compileTestJava compileTestKotlin test --tests io.flutter.template.FlutterLiveTemplatesTest (Passed)
  • ./gradlew test (Full test suite passed)
  • ./gradlew verifyPluginProjectConfiguration verifyPluginStructure verifyPluginSignature verifyPlugin (Dynamic Plugin Eligibility: Plugin can probably be enabled or disabled without IDE restart across 252, 253, 261, and 262; FailureLevel.NOT_DYNAMIC active; 3 findings removed per IDE)

Review the contribution guidelines below:

  • I’ve reviewed the contributor guide and applied the relevant portions to this PR.
  • I've included the required information in the description above.
  • My up-to-date information is in the AUTHORS file.
  • I've updated CHANGELOG.md if appropriate.
Contribution guidelines:

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request migrates Flutter live templates and the DART_TOPLEVEL context registration to declarative XML extensions in plugin.xml to support dynamic plugin loading without IDE restarts. It removes the deprecated FlutterLiveTemplatesProvider implementation, simplifies DartToplevelTemplateContextType to avoid deprecated APIs, and enables the NOT_DYNAMIC failure level verification in build.gradle.kts. Additionally, it updates baseline verifications, simplifies the baseline checking script, and introduces comprehensive unit tests in FlutterLiveTemplatesTest.java. I have no feedback to provide as there are no review comments.

com.intellij.defaultLiveTemplatesProvider was the sole remaining
non-dynamic extension point blocking dynamic plugin installation and
unloading without IDE restarts. Replace FlutterLiveTemplatesProvider
with declarative <defaultLiveTemplates> and enforce NOT_DYNAMIC gate.

Also migrate DartToplevelTemplateContextType from the deprecated 3-arg
DartTemplateContextType constructor to the 1-arg overload paired with
baseContextId="DART" in plugin.xml, and ratchet 252-262 baselines.

Part of: flutter#8361
Tested: ./gradlew test verifyPlugin
@jwren
jwren force-pushed the flutter-verifier-03-templates-dynamic branch from a8a2fed to c50787c Compare November 13, 2026 21:16
@jwren
jwren marked this pull request as ready for review November 13, 2026 21:16
@jwren
jwren requested review from helin24 and pq as code owners November 13, 2026 21:16

@pq pq left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This is awesome. Thanks!

@jwren jwren added the autosubmit When this label is applied to a PR, the PR will be submitted as soon as all checks are green. label Nov 24, 2026
@auto-submit
auto-submit Bot merged commit 947a812 into flutter:main Nov 24, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autosubmit When this label is applied to a PR, the PR will be submitted as soon as all checks are green.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants