Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,19 @@ Qiq Templates Support is an IntelliJ-based plugin that brings syntax highlightin

- **Syntax highlighting** for Qiq control structures, escape modifiers (`{{= }}`, `{{h }}`, etc.), and HTML blocks.
- **PHP language injection** inside Qiq tokens and inline `<?php ?>` islands so that autocompletion, inspections, and formatting work as expected.
- **Type-aware escape directives**: `{{h }}`, `{{a }}`, `{{j }}`, `{{u }}`, `{{c }}` are routed through typed runtime stubs so PhpStorm flags wrong argument types (`{{h $array }}`, `{{h $objectWithoutToString }}`, etc.).
- **Composer-aware stub selection**: the strict (Qiq 1.x) or relaxed (Qiq 2.x / 3.x) escape signature is chosen automatically from `composer.lock`.
- **Cross-template rename refactoring**: renaming a PHP property, method, or local variable propagates into every Qiq template that references it. Triggering Shift+F6 from inside a Qiq template (`{{h $article->title }}`) also works.
- **Cross-template navigation**: Cmd/Ctrl+click (Go to Declaration) on `setLayout()`, `render()`, `include()`, or custom helpers to open the referenced template file.
- **Enter/typing handlers** that auto-complete Qiq block closers and keep indentation consistent.
- **Template discovery**: resolves relative paths by walking up from the current file, project roots, and PHP server document roots.

## Settings

Open **Settings (Preferences) → Languages & Frameworks → Qiq Templates** for project-level options:

- **Inject `declare(strict_types=1)` into Qiq templates** *(off by default)* — when enabled, scalar literal misuses such as `{{h true }}`, `{{h 123 }}`, or `{{h null }}` surface as PhpStorm type warnings. Useful when your project renders templates under PHP strict types; off by default to match Qiq's runtime, which performs implicit scalar→string casts.

## Installation

The project uses Gradle with the JetBrains IntelliJ Platform Plugin tooling.
Expand Down
12 changes: 10 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,20 @@ intellijPlatform {
pluginConfiguration {
name.set("Qiq Templates Support")
id.set("io.github.jingu.idea-qiq-plugin")
version.set("0.5.0")
version.set("0.6.0")
ideaVersion {
sinceBuild.set("241")
untilBuild.set("261.*")
}
description.set("Syntax highlighting and simple navigation for Qiq templates")
description.set(
"Qiq template support for PhpStorm: HTML-aware syntax highlighting, full PHP " +
"injection inside Qiq tags and inline <?php ?> blocks, cross-template rename " +
"refactoring (Shift+F6 works both from PHP and from inside templates), and " +
"type-checked escape directives — wrong types passed to {{h }}, {{a }}, " +
"{{j }}, {{u }}, {{c }} are flagged at edit time by PhpStorm's own Type " +
"Compatibility inspection, with strict / relaxed signatures auto-selected " +
"from composer.lock."
)
vendor {
name.set("Yoshitaka Jingu")
url.set("https://github.com/jingu/idea-php-qiq-plugin")
Expand Down
20 changes: 16 additions & 4 deletions src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
<lang.commenter
language="Qiq"
implementationClass="io.github.jingu.idea_qiq_plugin.editor.QiqCommenter"/>
<typedHandler implementation="io.github.jingu.idea_qiq_plugin.editor.QiqTypedHandler"/>
<enterHandlerDelegate implementation="io.github.jingu.idea_qiq_plugin.editor.QiqEnterHandler"/>

<!-- Color Settings Page -->
<colorSettingsPage implementation="io.github.jingu.idea_qiq_plugin.ui.QiqColorSettingsPage"/>
Expand Down Expand Up @@ -76,8 +78,6 @@
id="settings.qiq"
key="settings.qiq.display.name"
bundle="messages.QiqBundle"/>
<typedHandler implementation="io.github.jingu.idea_qiq_plugin.editor.QiqTypedHandler"/>
<enterHandlerDelegate implementation="io.github.jingu.idea_qiq_plugin.editor.QiqEnterHandler"/>
</extensions>

<!-- PHP ライブラリスタブの登録(任意) -->
Expand All @@ -93,9 +93,21 @@
</actions>
<change-notes><![CDATA[
<ul>
<li><b>PhpStorm 2026.1 Support</b>
<li><b>Type-aware escape directives</b>
<ul>
<li><code>{{h }}</code>, <code>{{a }}</code>, <code>{{j }}</code>, <code>{{u }}</code>, <code>{{c }}</code> are routed through typed runtime stubs so PhpStorm flags wrong argument types (arrays, objects without <code>__toString</code>, etc.).</li>
<li>The strict (Qiq 1.x) or relaxed (Qiq 2.x / 3.x) escape signature is selected automatically from <code>composer.lock</code>.</li>
</ul>
</li>
<li><b>Cross-template rename refactoring</b>
<ul>
<li>Renaming a PHP property, method, or local variable now propagates into Qiq template references.</li>
<li>Shift+F6 triggered from inside a Qiq template (e.g. on <code>title</code> in <code>{{h $article-&gt;title }}</code>) opens the rename dialog and updates both the PHP declaration and every template usage.</li>
</ul>
</li>
<li><b>Strict Types setting</b>
<ul>
<li>Extended compatibility to PhpStorm 2026.1 (build 261).</li>
<li>New project setting under <i>Settings &gt; Languages &amp; Frameworks &gt; Qiq Templates</i> that injects <code>declare(strict_types=1)</code> into Qiq templates so scalar literal misuses such as <code>{{h true }}</code> or <code>{{h 123 }}</code> surface as type warnings. Off by default.</li>
</ul>
</li>
</ul>
Expand Down
Loading