SQF Highlighter – Extension
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Add category) |
Lou Montana (talk | contribs) m (Fix examples) |
||
Line 209: | Line 209: | ||
|- | |- | ||
| parent block | | parent block | ||
| sqfhighlighter-'''block''' | | sqfhighlighter-'''block'''<br>contains sqfhighlighter-'''scroller''' for blocks | ||
| <sqf> | | <sqf>;</sqf> | ||
|- | |- | ||
| error message | | error message | ||
| sqfhighlighter-'''error''' | | sqfhighlighter-'''error''' | ||
| <sqf></sqf><br><sqs></sqs> | | <sqf></sqf><br><sqs></sqs> | ||
|- | |||
| wild character / bad variable | |||
| bv, bvl | |||
| <sqf> | |||
@ | |||
private _var = 3RndMag; | |||
</sqf> | |||
|- | |- | ||
| comment | | comment | ||
| | | cc | ||
| <sqf>// comment | | <sqf>// comment | ||
Line 227: | Line 234: | ||
|- | |- | ||
| string | | string | ||
| | | s | ||
| <sqf>"string"</sqf> | | <sqf>"string"</sqf> | ||
|- | |- | ||
| | | n | ||
| sqfhighlighter-'''number''' | | sqfhighlighter-'''number''' | ||
| <sqf>42 | | <sqf>42 | ||
Line 237: | Line 244: | ||
|- | |- | ||
| operator | | operator | ||
| | | o | ||
| <sqf>a + b</sqf> | | <sqf>a + b</sqf> | ||
|- | |- | ||
| keyword ({{hl|if}}, {{hl|then}}, {{hl|waitUntil}}, etc) | | keyword ({{hl|if}}, {{hl|then}}, {{hl|waitUntil}}, etc) | ||
| | | k | ||
| <sqf>if</sqf> | | <sqf>if</sqf> | ||
|- | |- | ||
| command | | command | ||
| | | c | ||
| <sqf>setDir</sqf> | | <sqf>setDir</sqf> | ||
|- | |- | ||
| function | | function | ||
| | | f | ||
| <sqf>BIS_fnc_spawnGroup</sqf> | | <sqf>BIS_fnc_spawnGroup</sqf> | ||
|- | |- | ||
| external | | function (external) | ||
| | | fe | ||
| <sqf>// not just considering BIS_ or BIN_ | | <sqf>// not just considering BIS_ or BIN_ | ||
BIS_fnc_unknownFunction | BIS_fnc_unknownFunction | ||
Line 259: | Line 266: | ||
|- | |- | ||
| local variable | | local variable | ||
| | | lv | ||
| <sqf>_localVar</sqf> | | <sqf>_localVar</sqf> | ||
|- | |- | ||
| global variable | | global variable | ||
| | | gv | ||
| <sqf>// anything will go but UNDERSCORED_ALL_CAPS | | <sqf>// anything will go but UNDERSCORED_ALL_CAPS | ||
GlobalVar = 1;</sqf> | GlobalVar = 1;</sqf> | ||
|- | |- | ||
| macro | | macro | ||
| | | m | ||
| <sqf>#define myVar 1 | | <sqf>#define myVar 1 | ||
#if | #if | ||
Line 274: | Line 281: | ||
|- | |- | ||
| constant ({{hl|#define}}d value) | | constant ({{hl|#define}}d value) | ||
| | | c | ||
| <sqf>// anything #defined only | | <sqf>// anything #defined only | ||
#define testVar 1 | #define testVar 1 | ||
Line 283: | Line 290: | ||
|- | |- | ||
| array start ({{hl|[}}) | | array start ({{hl|[}}) | ||
| | | as | ||
| <sqf>[...</sqf> | | <sqf>[ /* ... */</sqf> | ||
|- | |- | ||
| array end ({{hl|]}}) | | array end ({{hl|]}}) | ||
| | | ae | ||
| <sqf>...]</sqf> | | <sqf>/* ... */ ]</sqf> | ||
|- | |- | ||
| code start ({{hl|{<nowiki/>}}) | | code start ({{hl|{<nowiki/>}}) | ||
| | | cs | ||
| <sqf>{...</sqf> | | <sqf>{ /* ... */</sqf> | ||
|- | |- | ||
| code end ({{hl|}<nowiki/>}}) | | code end ({{hl|}<nowiki/>}}) | ||
| | | ce | ||
| <sqf>...}</sqf> | | <sqf>/* ... */ }</sqf> | ||
|- | |- | ||
| parenthese start ({{hl|{<nowiki/>}}) | | parenthese start ({{hl|{<nowiki/>}}) | ||
| | | ps | ||
| <sqf>(...</sqf> | | <sqf>( /* ... */</sqf> | ||
|- | |- | ||
| parenthese end ({{hl|}<nowiki/>}}) | | parenthese end ({{hl|}<nowiki/>}}) | ||
| | | pe | ||
| <sqf>...)</sqf> | | <sqf>/* ... */ )</sqf> | ||
|} | |} | ||
Revision as of 01:00, 29 July 2022
SQF Highlighter | |
---|---|
Description | Highlights and links SQF commands and functions |
Author | Lou Montana |
Project Start | 2022-03-08: Project start |
Release Date |
|
Version | 0.85b |
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
- SQF tag button in the wiki edit toolbar (next to B and I)
- Options:
- inline for inline code
- notrim to remove the auto trim (lines themselves will always be rtrimmed)
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 notrim>
hint "It Works!";
</sqf>
|
hint "It Works!";
|
<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 notrim>
hint "It Works!";
</sqs>
|
hint "It Works!";
|
<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 contains sqfhighlighter-scroller for blocks |
; |
error message | sqfhighlighter-error | -no SQF code provided- -no SQS code provided-
|
wild character / bad variable | bv, bvl | |
comment | cc | // comment
/*
this is
a multiline
comment
*/ |
string | s | "string" |
n | sqfhighlighter-number | 42
-6.9
10e10 |
operator | o | |
keyword (if, then, waitUntil, etc) | k | |
command | c | |
function | f | |
function (external) | fe | // not just considering BIS_ or BIN_
BIS_fnc_unknownFunction
TAG_fnc_spawnGroup |
local variable | lv | _localVar |
global variable | gv | |
macro | m | #define myVar 1
#if
#endif |
constant (#defined value) | c | // anything #defined only
#define testVar 1
testVar;
otherVar;
MY_CONSTANT; |
array start ([) | as | [ /* ... */ |
array end (]) | ae | /* ... */ ] |
code start ({) | cs | { /* ... */ |
code end (}) | ce | /* ... */ } |
parenthese start ({) | ps | ( /* ... */ |
parenthese end (}) | pe | /* ... */ ) |
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 | 2022-07-12 |