Skip to content

Commit

Permalink
enh(sqf) improve function name highlighting (slightly broader) (#3181)
Browse files Browse the repository at this point in the history
* Refactored SQF function regex with simpler method

Should clean up highlights for functions named "ace_medical_fnc_addStatus" or etc

* Added the myTag_component example for SQF

* Updating SQF function markup test
  • Loading branch information
JonBons committed May 10, 2021
1 parent 952fa0a commit ba35648
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ Grammars:
- enh(nginx) improving highlighting of some sections [Josh Goebel][]
- fix(vim) variable names may not be zero length [Josh Goebel][]
- enh(sqf) Updated keywords to Arma 3 v2.02 (#3084) [R3voA3][]
- enh(sqf) Refactored function regex to match CBA component func naming scheme (#3181) [JonBons][]
- enh(nim) highlight types properly (not as built-ins) [Josh Goebel][]
- (chore) throttle deprecation messages (#3092) [Mihkel Eidast][]
- enh(c) Update keyword list for C11/C18 (#3010) [Josh Goebel][]
Expand Down Expand Up @@ -125,6 +126,7 @@ Dev Improvements:
[Josh Goebel]: https://github.com/joshgoebel
[Ryan Mulligan]: https://github.com/ryantm
[R3voA3]: https://github.com/R3voA3
[JonBons]: https://github.com/JonBons
[Wei Su]: https://github.com/swsoyee
[Jared Luboff]: https://github.com/jaredlll08
[NullVoxPopuli]: https://github.com/NullVoxPopuli
Expand Down
2 changes: 1 addition & 1 deletion src/languages/sqf.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default function(hljs) {
// https://community.bistudio.com/wiki/Functions_Library_(Arma_3)#Adding_a_Function
const FUNCTION = {
className: 'title',
begin: /[a-zA-Z][a-zA-Z0-9]+_fnc_\w*/
begin: /[a-zA-Z]\w+_fnc_\w+/
};

// In SQF strings, quotes matching the start are escaped by adding a consecutive.
Expand Down
1 change: 1 addition & 0 deletions test/detect/sqf/default.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ _unit addAction ["Eat Energy Bar", {
// 4 - means something...
Z_obj_vip = nil;
[_boat, ["Black", 1], true] call BIS_fnc_initVehicle;
[_boat] call myTag_component_fnc_initVehicle;
}];
1 change: 1 addition & 0 deletions test/markup/sqf/default.expect.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@
<span class="hljs-comment">// 4 - means something...</span>
Z_obj_vip = <span class="hljs-literal">nil</span>;
[<span class="hljs-variable">_boat</span>, [<span class="hljs-string">&quot;Black&quot;</span>, <span class="hljs-number">1</span>], <span class="hljs-literal">true</span>] <span class="hljs-built_in">call</span> <span class="hljs-title">BIS_fnc_initVehicle</span>;
[<span class="hljs-variable">_boat</span>] <span class="hljs-built_in">call</span> <span class="hljs-title">myTag_component_fnc_initVehicle</span>;
}];
1 change: 1 addition & 0 deletions test/markup/sqf/default.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ _unit addAction ["Eat Energy Bar", {
// 4 - means something...
Z_obj_vip = nil;
[_boat, ["Black", 1], true] call BIS_fnc_initVehicle;
[_boat] call myTag_component_fnc_initVehicle;
}];

0 comments on commit ba35648

Please sign in to comment.