SQF Highlighter – Extension
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Add bug) |
Lou Montana (talk | contribs) (Add v2) |
||
Line 2: | Line 2: | ||
! colspan="2" style="padding: 1.5em" | SQF Highlighter | ! colspan="2" style="padding: 1.5em" | SQF Highlighter | ||
|- | |- | ||
! | ! | Description | ||
| Highlights and links SQF commands and functions | | Highlights and links SQF commands and functions | ||
|- | |- | ||
! | ! | Author | ||
| {{User|Lou Montana}} | | {{User|Lou Montana}} | ||
|- | |- | ||
! | ! | Version | ||
| 0. | | 0.85b | ||
|- | |- | ||
! | ! | Release Date | ||
| 2022-03-12: First upload | | | ||
* 2022-03-12: First upload | |||
* 2022-07-11: "v2" (0.85b), new parser | |||
|- | |- | ||
! | ! | Project Start | ||
| 2022-03-08: Project start | | 2022-03-08: Project start | ||
|} | |} | ||
This extension highlights and automatically links SQF commands and functions. | This extension highlights and automatically links [[SQF Syntax|SQF]] commands and functions. It also covers [[SQS Syntax|SQS]] (free of charge). | ||
== Features == | |||
* [[SQF Syntax]] support | |||
* [[SQS Syntax]] support | |||
* "Copy code to clipboard" button on hover | |||
* {{hl|#define}}d constant value on mouse hover | |||
Line 23: | Line 33: | ||
* Unzip the directory to {{hl|wiki/extensions/SQFHighlighter}} | * Unzip the directory to {{hl|wiki/extensions/SQFHighlighter}} | ||
* Add | * Add <syntaxhighlight lang="php" inline>wfLoadExtension( 'SQFHighlighter' );</syntaxhighlight> to {{hl|LocalSettings.php}} | ||
* There are no settings - the extension creates full path links unless the host is one of the following (then relative links are created): | * There are no settings - the extension creates full path links unless the host is one of the following (then relative links are created): | ||
** {{hl|community.bistudio.com}} | ** {{hl|community.bistudio.com}} | ||
Line 33: | Line 43: | ||
Using <nowiki><sqf></nowiki> tags will auto-generate syntax highlighting '''and''' links to the pages. | Using <nowiki><sqf></nowiki> tags will auto-generate syntax highlighting '''and''' links to the pages. | ||
{| style="min-width: 50em" | {| class="wikitable valign-top" style="min-width: 50em" | ||
|+ Examples | |+ Examples | ||
! colspan="2" | [[SQF Syntax]] | |||
|- | |||
! Code | ! Code | ||
! Result | ! Result | ||
|- | |- | ||
| <syntaxhighlight lang="html"><sqf/></syntaxhighlight> | |||
| <sqf/> | | <sqf/> | ||
|- | |- | ||
| <syntaxhighlight lang="html"><sqf></sqf></syntaxhighlight> | |||
| <sqf></sqf> | | <sqf></sqf> | ||
|- | |- | ||
| <syntaxhighlight lang="html"><sqf> </sqf></syntaxhighlight> | |||
| <sqf> </sqf> | | <sqf> </sqf> | ||
|- | |- | ||
| <syntaxhighlight lang="html"><sqf>hint "It Works!";</sqf></syntaxhighlight> | |||
| <sqf>hint "It Works!";</sqf> | | <sqf>hint "It Works!";</sqf> | ||
|- | |- | ||
| < | | <syntaxhighlight lang="html">This is <sqf inline>hint "It Works!";</sqf> absolutely inline.</syntaxhighlight> | ||
| This is <sqf inline>hint "It Works!";</sqf> absolutely inline. | |||
|- | |||
| <syntaxhighlight lang="html"> | |||
<sqf> | |||
// your code here | // your code here | ||
hint "good!"; | hint "good!"; | ||
</sqf></ | </sqf> | ||
</syntaxhighlight> | |||
| <sqf> | | <sqf> | ||
// your code here | // your code here | ||
hint "good!"; | hint "good!"; | ||
</sqf> | </sqf> | ||
|- | |- | ||
| <syntaxhighlight lang="html"> | |||
<sqf> | |||
#define fadeInDuration 3 | #define fadeInDuration 3 | ||
Line 80: | Line 98: | ||
sleep 10; | sleep 10; | ||
[] call BIS_fnc_endMission; | [] call BIS_fnc_endMission; | ||
</sqf></ | </sqf> | ||
</syntaxhighlight> | |||
| <sqf> | | <sqf> | ||
#define fadeInDuration 3 | #define fadeInDuration 3 | ||
Line 103: | Line 122: | ||
[] call BIS_fnc_endMission; | [] call BIS_fnc_endMission; | ||
</sqf> | </sqf> | ||
|- | |||
! colspan="2" | [[SQS Syntax]] | |||
|- | |||
! Code | |||
! Result | |||
|- | |||
| <syntaxhighlight lang="html"><sqs/></syntaxhighlight> | |||
| <sqs/> | |||
|- | |||
| <syntaxhighlight lang="html"><sqs></sqs></syntaxhighlight> | |||
| <sqs></sqs> | |||
|- | |||
| <syntaxhighlight lang="html"><sqs> </sqs></syntaxhighlight> | |||
| <sqs> </sqs> | |||
|- | |||
| <syntaxhighlight lang="html"><sqs>hint "It Works!"</sqs></syntaxhighlight> | |||
| <sqs>hint "It Works!";</sqs> | |||
|- | |||
| <syntaxhighlight lang="html">This is <sqs inline>hint "It Works!"</sqs> absolutely inline.</syntaxhighlight> | |||
| This is <sqs inline>hint "It Works!"</sqs> absolutely inline. | |||
|- | |||
| <syntaxhighlight lang="html"><sqs> | |||
#loop | |||
@ alive player | |||
; you ok | |||
hint "OK" | |||
~1 | |||
@ not alive player | |||
~1 | |||
hint "you ded" | |||
; you not ok | |||
goto "loop" | |||
</sqs></syntaxhighlight> | |||
| <sqs> | |||
#loop | |||
@ alive player | |||
; you ok | |||
hint "OK" | |||
~1 | |||
@ not alive player | |||
~1 | |||
hint "you ded" | |||
; you not ok | |||
goto "loop" | |||
</sqs> | |||
|} | |} | ||
Line 120: | Line 184: | ||
| error message | | error message | ||
| sqfhighlighter-'''error''' | | sqfhighlighter-'''error''' | ||
| <sqf></sqf> | | <sqf></sqf><br><sqs></sqs> | ||
|- | |- | ||
| comment | | comment | ||
Line 182: | Line 246: | ||
| sqfhighlighter-'''const''' | | sqfhighlighter-'''const''' | ||
| <sqf>// anything #defined or anything UNDERSCORED_ALL_CAPS | | <sqf>// anything #defined or anything UNDERSCORED_ALL_CAPS | ||
#define testVar | #define testVar 1 | ||
testVar; | testVar; | ||
Line 217: | Line 281: | ||
{| class="wikitable sortable" | {| class="wikitable sortable" | ||
! class="unsortable" | Version | |||
! class="unsortable" | Issue | ! class="unsortable" | Issue | ||
! Report Date | ! Report Date | ||
! Fix Date | ! Fix Date | ||
|- | |- | ||
! rowspan="5" | v1 | |||
| comment blocks still highlight words as global variables for now | | comment blocks still highlight words as global variables for now | ||
| 2022-03-15 | | 2022-03-15 | ||
Line 231: | Line 297: | ||
| single-quote strings have issues with other formatting between quotes | | single-quote strings have issues with other formatting between quotes | ||
| 2022-03-15 | | 2022-03-15 | ||
| | | w/ '''v2''' | ||
|- | |- | ||
| negative numbers should see the minus sign coloured as well<br>''in the end, they should not'' | | negative numbers should see the minus sign coloured as well<br>''in the end, they should not'' | ||
Line 239: | Line 305: | ||
| numbers in variables are highlighted as numbers (e.g {{hl|unit'''1'''}}) | | numbers in variables are highlighted as numbers (e.g {{hl|unit'''1'''}}) | ||
| 2022-03-22 | | 2022-03-22 | ||
| w/ '''v2''' | |||
|- | |||
! rowspan="1" | v2 | |||
| preprocessor instructions are not considered if not at the very beginning of the line (and the parsing of the whole line may be wrong) | |||
| 2022-07-11 | |||
| {{n/a}} | | {{n/a}} | ||
|} | |} | ||
{{Feature|informative| | {{Feature|informative|Report issues on [https://discord.gg/arma Discord], in the {{hl|#community_wiki}} channel!}} |
Revision as of 14:17, 12 July 2022
SQF Highlighter | |
---|---|
Description | Highlights and links SQF commands and functions |
Author | Lou Montana |
Version | 0.85b |
Release Date |
|
Project Start | 2022-03-08: Project start |
This extension highlights and automatically links SQF commands and functions. It also covers SQS (free of charge).
Features
- SQF Syntax support
- SQS Syntax support
- "Copy code to clipboard" button on hover
- #defined constant value on mouse hover
Installation
- Unzip the directory to wiki
/extensions /SQFHighlighter - Add
wfLoadExtension( 'SQFHighlighter' );
to LocalSettings.php - There are no settings - the extension creates full path links unless the host is one of the following (then relative links are created):
- community.bistudio.com
- community.bohemia.net
Usage
Using <sqf> tags will auto-generate syntax highlighting and links to the pages.
SQF Syntax | |
---|---|
Code | Result |
<sqf/>
|
-no SQF code provided-
|
<sqf></sqf>
|
-no SQF code provided-
|
<sqf> </sqf>
|
-no SQF code provided-
|
<sqf>hint "It Works!";</sqf>
|
hint "It Works!"; |
This is <sqf inline>hint "It Works!";</sqf> absolutely inline.
|
This is hint "It Works!"; absolutely inline. |
<sqf>
// your code here
hint "good!";
</sqf>
|
|
<sqf>
#define fadeInDuration 3
waitUntil { not alive player };
hint DEATH_MESSAGE;
cutText ["", "Black", playerRespawnTime];
private _deathTime = time;
Deaths = Deaths + 1;
/*
wait for resurrection
*/
waitUntil { alive player && { preloadCamera getPosATL player } };
sleep 3;
cutText ["Welcome!", "Black in", fadeInDuration];
// after 10s, end the mission
sleep 10;
[] call BIS_fnc_endMission;
</sqf>
|
#define fadeInDuration 3
waitUntil { not alive player };
hint DEATH_MESSAGE;
cutText ["", "Black", playerRespawnTime];
private _deathTime = time;
Deaths = Deaths + 1;
/*
wait for resurrection
*/
waitUntil { alive player && { preloadCamera getPosATL player } };
sleep 3;
cutText ["Welcome!", "Black in", fadeInDuration];
// after 10s, end the mission
sleep 10;
[] call BIS_fnc_endMission; |
SQS Syntax | |
Code | Result |
<sqs/>
|
-no SQS code provided-
|
<sqs></sqs>
|
-no SQS code provided-
|
<sqs> </sqs>
|
-no SQS code provided-
|
<sqs>hint "It Works!"</sqs>
|
hint "It Works!"; |
This is <sqs inline>hint "It Works!"</sqs> absolutely inline.
|
This is hint "It Works!" absolutely inline. |
<sqs>
#loop
@ alive player
; you ok
hint "OK"
~1
@ not alive player
~1
hint "you ded"
; you not ok
goto "loop"
</sqs>
|
CSS Classes
All elements are <span> but the parent block that is a <div>.
Element | CSS class | Overview |
---|---|---|
parent block | sqfhighlighter-block | |
error message | sqfhighlighter-error | -no SQF code provided- -no SQS code provided-
|
comment | sqfhighlighter-comment | // comment
/*
this is
a multiline
comment
*/ |
string | sqfhighlighter-string | "string" |
number | sqfhighlighter-number | 42
-6.9
10e10 |
operator | sqfhighlighter-operator | |
keyword (if, then, waitUntil, etc) | sqfhighlighter-keyword | |
command | sqfhighlighter-command | |
function | sqfhighlighter-function | |
external function | sqfhighlighter-function-ext | // not just considering BIS_ or BIN_
BIS_fnc_unknownFunction
TAG_fnc_spawnGroup |
local variable | sqfhighlighter-localvar | _localVar |
global variable | sqfhighlighter-globalvar | |
macro | sqfhighlighter-macro | #define
#if
#endif |
constant (#defined value) | sqfhighlighter-const | // anything #defined or anything UNDERSCORED_ALL_CAPS
#define testVar 1
testVar;
otherVar;
MY_CONSTANT; |
array start ([) | sqfhighlighter-arraystart | [... |
array end (]) | sqfhighlighter-arrayend | ...] |
code start ({) | sqfhighlighter-codestart | {... |
code end (}) | sqfhighlighter-codeend | ...} |
parenthese start ({) | sqfhighlighter-parenthesestart | (... |
parenthese end (}) | sqfhighlighter-parentheseend | ...) |
Known Issues
Version | Issue | Report Date | Fix Date |
---|---|---|---|
v1 | comment blocks still highlight words as global variables for now | 2022-03-15 | 2022-03-17 |
#if are considered as keywords | 2022-03-15 | 2022-03-17 | |
single-quote strings have issues with other formatting between quotes | 2022-03-15 | w/ v2 | |
negative numbers should see the minus sign coloured as well in the end, they should not |
2022-03-15 | 2022-03-17 | |
numbers in variables are highlighted as numbers (e.g unit1) | 2022-03-22 | w/ v2 | |
v2 | preprocessor instructions are not considered if not at the very beginning of the line (and the parsing of the whole line may be wrong) | 2022-07-11 | N/A |