Skip to content

feat: complete template paths in setLayout/render/extends/include#20

Open
jingu wants to merge 1 commit into
feat/helper-completionfrom
feat/template-path-completion
Open

feat: complete template paths in setLayout/render/extends/include#20
jingu wants to merge 1 commit into
feat/helper-completionfrom
feat/template-path-completion

Conversation

@jingu
Copy link
Copy Markdown
Owner

@jingu jingu commented May 29, 2026

Summary

Completes template paths in the first string argument of Qiq's template-referencing calls — setLayout('...'), render('...'), extends('...'), include('...') — inside Qiq templates. Pairs with the existing Go to Declaration on those same arguments.

  • New QiqTemplatePathCompletionContributor (PHP completion.contributor): when the caret is in the first string arg of one of those calls in a Qiq file, offers the template files found under QiqSettingsService.resolveTemplateRoots(contextFile) as root-relative paths with the Qiq extension stripped (layout/base.qiq.phplayout/base).
  • Sets the prefix matcher to the in-quote text before the caret so partial paths like layout/ba match/replace correctly.
  • Recursive VFS walk is capped (2000 entries) and honors ProgressManager.checkCanceled().

Test plan

  • ./gradlew test — incl. new QiqTemplatePathCompletionContributorTest (pure stripTemplateExtension cases: longest-suffix-first, .qiq/.php, non-templates, case-insensitivity, configured order)
  • ./gradlew buildPlugin
  • Manual: type inside {{ setLayout('') }} / render('') → available template paths offered

Notes

🤖 Generated with Claude Code

Add a PHP CompletionContributor that, inside a Qiq template, completes the
first string argument of setLayout()/render()/extends()/include() with the
template files found under the resolved template roots
(QiqSettingsService.resolveTemplateRoots), listed as root-relative paths with
the Qiq extension stripped (layout/base.qiq.php -> layout/base). Pairs with
the existing Go to Declaration on the same arguments.

The extension-stripping logic is a pure companion function
(stripTemplateExtension) with unit tests; the VFS walk and completion firing
are left to manual / HeavyPlatformTestCase verification.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@jingu jingu force-pushed the feat/template-path-completion branch from ad99a52 to 4f3884a Compare May 29, 2026 08:23
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.

1 participant