Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Qiq Template Syntax

VS Code syntax highlighting for Qiq PHP template files (.qiq.php).

Features

  • Full syntax highlighting for Qiq {{ }} template tags with embedded PHP
  • Standard <?php ?> and <?= ?> tag highlighting
  • HTML highlighting outside of tags
  • Bracket matching and auto-closing for {{ }}
  • Code folding for Qiq control structures (if/endif, foreach/endforeach, etc.)

Supported Tag Types

Tag Description
{{ code }} Non-echoing PHP (if, foreach, etc.)
{{= $var }} Raw (unescaped) echo
{{h $var }} HTML-escaped echo
{{a $var }} Attribute-escaped echo
{{u $var }} URL-encoded echo
{{c $var }} CSS-escaped echo
{{j $var }} JS-escaped echo

Whitespace control is supported with ~ on either side:

<ul>
{{~ foreach ($items as $item): ~}}
    <li>{{h $item}}</li>
{{~ endforeach ~}}
</ul>

Installation

Clone or download this repository into VS Code's extensions folder:

git clone https://github.com/qiqphp/vscode-qiq ~/.vscode/extensions/qiq-syntax

Then reload VS Code (Cmd+Shift+P / Ctrl+Shift+P > "Developer: Reload Window").

To uninstall, remove the extension folder:

rm -rf ~/.vscode/extensions/qiq-syntax

Note on GitHub / GFM

GitHub-Flavored Markdown does not recognize qiq as a language, so ```qiq fenced code blocks will not be syntax-highlighted on GitHub. Workarounds:

  • Use ```php fencing for partial highlighting (HTML and <?php ?> tags will highlight, but {{ }} Qiq tags will not)
  • Use no language identifier for plain, unhighlighted code blocks

Development

To work on the extension, clone the repo and symlink it into VS Code's extensions folder:

git clone https://github.com/qiqphp/vscode-qiq
ln -s /path/to/vscode-qiq ~/.vscode/extensions/qiq-syntax

Running Tests

npm install
npm test

Tests use vscode-tmgrammar-test to verify grammar scopes against annotated .test.qiq.php fixture files in test/.

About

Qiq syntax highlighter for VSCode.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages