Jump to content
K-Town

Arma Intellij Plugin - Smart Editing for Header and SQF Files

Recommended Posts

10 hours ago, celludriel said:

null
java.lang.StackOverflowError
	at com.intellij.openapi.progress.impl.CoreProgressManager.doCheckCanceled(CoreProgressManager.java:140)
	at com.intellij.openapi.progress.ProgressManager.checkCanceled(ProgressManager.java:207)
	at com.intellij.openapi.progress.ProgressIndicatorProvider.checkCanceled(ProgressIndicatorProvider.java:49)
	at com.intellij.psi.impl.source.tree.AstBufferUtil$BufferVisitor.visitLeaf(AstBufferUtil.java:90)
	at com.intellij.psi.impl.source.tree.LeafElement.acceptTree(LeafElement.java:186)
	at com.intellij.psi.impl.source.tree.RecursiveTreeElementWalkingVisitor$1.visit(RecursiveTreeElementWalkingVisitor.java:66)
	at com.intellij.psi.impl.source.tree.RecursiveTreeElementWalkingVisitor$1.visit(RecursiveTreeElementWalkingVisitor.java:58)
	at com.intellij.util.WalkingState.walkChildren(WalkingState.java:65)
	at com.intellij.util.WalkingState.elementStarted(WalkingState.java:52)
	at com.intellij.psi.impl.source.tree.RecursiveTreeElementWalkingVisitor.visitNode(RecursiveTreeElementWalkingVisitor.java:85)
	at com.intellij.psi.impl.source.tree.RecursiveTreeElementWalkingVisitor.visitComposite(RecursiveTreeElementWalkingVisitor.java:80)
	at com.intellij.psi.impl.source.tree.AstBufferUtil$BufferVisitor.visitComposite(AstBufferUtil.java:114)
	at com.intellij.psi.impl.source.tree.CompositeElement.acceptTree(CompositeElement.java:160)
	at com.intellij.psi.impl.source.tree.AstBufferUtil.toBuffer(AstBufferUtil.java:40)
	at com.intellij.psi.impl.source.tree.AstBufferUtil.toBuffer(AstBufferUtil.java:35)
	at com.intellij.psi.impl.source.tree.CompositeElement.textToCharArray(CompositeElement.java:313)
	at com.intellij.psi.impl.source.tree.CompositeElement.getText(CompositeElement.java:265)
	at com.intellij.extapi.psi.ASTDelegatePsiElement.getText(ASTDelegatePsiElement.java:147)
	at com.kaylerrenslow.a3plugin.lang.header.psi.HeaderPsiUtilForGrammar.getKey(HeaderPsiUtilForGrammar.java:24)

Hope this is enough of a stacktrace, but this seems to happen often, this was the hpp file being checked

 


class EquipmentModuleSpacer{
	title = "";
	values[] = { "" };
	texts[] = { "" };
	default = "";
};

class EquipmentModuleOptionsTitle{
	title = $STR_PARAMS_FAR_REVIVE_OPTIONS;
	values[] = { "" };
	texts[] = { "" };
	default = "";
};

class EquipmentModuleUseRandomAiLoadouts{
	title = $STR_PARAMS_USE_RANDOM_UI_LOADOUT;
	values[] = {1,0};
	texts[] = { $STR_OPTION_YES, $STR_OPTION_NO };
	default = 1;
};

 

he points out $STR_OPTION_YES to be an error

 

I'm surprised this wasn't caught earlier. Anyways, this was a simple bug. I already fixed it. :D

  • Like 1

Share this post


Link to post
Share on other sites
if(!isDedicated) exitWith {};

params ["_marker", "_type"];

private ["_mhq", "_coord", "_deployLabel", "_selfDestructLabel"];

_coord = getmarkerpos _marker;

{
	[["_x: %1", _x]] call CTISHR_fnc_ctiLog;		
	_typeVehicle = typeOf _x;
	[["_typeVehicle: %1", _typeVehicle]] call CTISHR_fnc_ctiLog;
	if( _x in allDead ) then {
		deleteVehicle _x;
	};
} forEach (_coord nearObjects 10);

_mhq = createVehicle [_type, _coord, [], 0, "can_collide"];

waitUntil { !isNil("_mhq") };

// Clear all cargo from the vehicle
clearMagazineCargoGlobal _mhq;
clearWeaponCargoGlobal _mhq;
clearItemCargoGlobal _mhq;
clearBackpackCargoGlobal _mhq;

_mhq setDir (markerDir _marker);
_mhq setVariable ["markerName", _marker, true];
_mhq setVariable ["type", _type, true];
_mhq setVariable ["MhqDeployed", false, true];

[[_mhq, _marker], "custom\modules\SimpleMhqModule\scripts\mhqPositionMarker.sqf"] remoteExec ["execVM", -2, true];

_deployLabel = format ["<t color='#11ff11'>%1</t>", (localize "STR_MHQ_DEPLOY")];
[_mhq, [_deployLabel, { [_this select 0] call MHQ_fnc_mhqDeployAction; }, [], 6, false, false, "", "(speed (vehicle _target)) < 1 && (getPosATL _target) select 2 < 2"]] remoteExec ["addAction", 0, true];

_selfDestructLabel = format ["<t color='#ff1111'>%1</t>", (localize "STR_MHQ_SELFDESTRUCT")];
[_mhq, [_selfDestructLabel, { [_this select 0] call MHQ_fnc_mhqSelfDestructAction; }, [], 6, false, false, "", "(speed (vehicle _target)) < 1 && (getPosATL _target) select 2 < 2"]] remoteExec ["addAction", 0, true];

[_mhq] execVM "custom\modules\SimpleMhqModule\scripts\mhqAliveMonitor.sqf";

_mhq

I get a compile error on line 7 expecting ) or ; but I'm pretty sure this code is correct.

Share this post


Link to post
Share on other sites
5 hours ago, celludriel said:

if(!isDedicated) exitWith {};

params ["_marker", "_type"];

private ["_mhq", "_coord", "_deployLabel", "_selfDestructLabel"];

_coord = getmarkerpos _marker;

{
	[["_x: %1", _x]] call CTISHR_fnc_ctiLog;		
	_typeVehicle = typeOf _x;
	[["_typeVehicle: %1", _typeVehicle]] call CTISHR_fnc_ctiLog;
	if( _x in allDead ) then {
		deleteVehicle _x;
	};
} forEach (_coord nearObjects 10);

_mhq = createVehicle [_type, _coord, [], 0, "can_collide"];

waitUntil { !isNil("_mhq") };

// Clear all cargo from the vehicle
clearMagazineCargoGlobal _mhq;
clearWeaponCargoGlobal _mhq;
clearItemCargoGlobal _mhq;
clearBackpackCargoGlobal _mhq;

_mhq setDir (markerDir _marker);
_mhq setVariable ["markerName", _marker, true];
_mhq setVariable ["type", _type, true];
_mhq setVariable ["MhqDeployed", false, true];

[[_mhq, _marker], "custom\modules\SimpleMhqModule\scripts\mhqPositionMarker.sqf"] remoteExec ["execVM", -2, true];

_deployLabel = format ["<t color='#11ff11'>%1</t>", (localize "STR_MHQ_DEPLOY")];
[_mhq, [_deployLabel, { [_this select 0] call MHQ_fnc_mhqDeployAction; }, [], 6, false, false, "", "(speed (vehicle _target)) < 1 && (getPosATL _target) select 2 < 2"]] remoteExec ["addAction", 0, true];

_selfDestructLabel = format ["<t color='#ff1111'>%1</t>", (localize "STR_MHQ_SELFDESTRUCT")];
[_mhq, [_selfDestructLabel, { [_this select 0] call MHQ_fnc_mhqSelfDestructAction; }, [], 6, false, false, "", "(speed (vehicle _target)) < 1 && (getPosATL _target) select 2 < 2"]] remoteExec ["addAction", 0, true];

[_mhq] execVM "custom\modules\SimpleMhqModule\scripts\mhqAliveMonitor.sqf";

_mhq

I get a compile error on line 7 expecting ) or ; but I'm pretty sure this code is correct.

 

As of right now, commands are required to be camelCase. In the coming version, commands will no longer need to be camel case.

 

Change 

_coord = getmarkerpos _marker;

into

_coord = getMarkerPos _marker;

 

  • Like 1

Share this post


Link to post
Share on other sites

I'm getting a syntax error on a place it shouldn't

 

for[{_i=0}, {_i < _x select 1}, {_i=_i+1}] do {
    player removeItem (_x select 0);
};

 

It says there is an error at {_i=0} while in this case it is valid syntax, the error goes aways if I add ; after the 0.  I think the plugin misses some syntax for old plain for loops ?

Share this post


Link to post
Share on other sites
On 3/26/2017 at 2:20 PM, celludriel said:

I'm getting a syntax error on a place it shouldn't

 


for[{_i=0}, {_i < _x select 1}, {_i=_i+1}] do {
    player removeItem (_x select 0);
};

 

It says there is an error at {_i=0} while in this case it is valid syntax, the error goes aways if I add ; after the 0.  I think the plugin misses some syntax for old plain for loops ?

 

As of right now, assignment statements requirement semicolons. In the coming version, it will no longer be the case.

 

Change to this:

for[{_i=0;}, {_i < _x select 1}, {_i=_i+1;}] do {
    player removeItem (_x select 0);
};

 

  • Like 1

Share this post


Link to post
Share on other sites

Hello everyone. I got a nice teaser screenshot for you. This is a dialog (imported from a .h file) displayed in the Arma Dialog Creator editor. The importing feature still has its issues, but I'm really happy with the early results! As usual, this is still WIP and yes, I'm still working on the plugin. :)

 

CN1IkTQ.png

  • Like 3

Share this post


Link to post
Share on other sites

looks great and yeah import feature is big :icon14:

  • Like 1

Share this post


Link to post
Share on other sites

Quick update.

 

I have decided to rewrite the entire plugin, which means that the next release won't happen for quite a while (unless there is command spec update).

 

This new rewrite will come with much needed features. These features include:

  • Preprocessor support (this is the primary reason for the rewrite)
  • Case insensitivity
    • In SQF, variable names and commands are not case sensitive. Example: bis_fnc_mp == BIS_fnc_MP
  • Better documentation of the code so other people can contribute
    • Not only will better documentation allow others to contribute, the plugin will be easier to maintain.
    • Ideally, I will rip out 3 less hairs working on the plugin after the documentation improves
  • Optimized declaration and scope finding for variables
  • Type checking beta
    • I'm about 70% done with converting the commands. This will be a huge update.
    • This is the second reason for the rewrite. I can't imagine doing this with the old code (nightmares!).
    • Even though I've gone through over 1,000 commands by hand to convert them, I'm expecting issues.
  • Arma Dialog Creator integration
    • ADC Still Isn't Done Yet™, but it was made with the plugin in mind the entire time. The first integration will be very basic.
    • After some time, I would like to integrate IntelliJ's code editor and other things into ADC.

As you can imagine, this is a huge checklist. The rewrite is already underway and once the preprocessor is "done", progress will happen much quicker (hopefully)

since some of the features listed above are already kind-of implemented in the previous versions.

 

Thanks for your support. :)

 

On a side note, there has been a lot of unique SQF syntax checkers being released lately. What's up with that? lol

  • Like 4

Share this post


Link to post
Share on other sites

Ok one more update. :)

 

Version 1.0.8 has been released. It includes the much needed fix for commands not being camelCase being a syntax error.

This update is available on Github, but it may take a day or 2 for it to be made available on Jetbrains' plugin repository.

 

Cheers.

  • Like 1

Share this post


Link to post
Share on other sites

Dev update. The dialog creator has been making tremendous progress lately. The static control now has roughly 98% support (including the style setting) and the import functionality works surprisingly well. I've been pretty much ignoring the plugin lately, however, the header preprocessor is already implemented and thoroughly tested. The preprocessor supports all of the macros (#define, #ifdef, #ifndef, #else, #include, #undef) as well as __EXEC and __EVAL. The preprocessor is also completely modular and outputs the preprocessed result into 1 file. The preprocessor will be used for both the dialog creator and the plugin, and is also open source.

 

I've also decided that the plugin will not have preprocessor support for SQF, but it will have it for header files (.h, .hh, etc). Why is that? Header files are only referenced in SQF files and by Arma's engine. Any time a config function lookup is needed for SQF, I can preprocess the config file behind the scenes. In order for there to be syntactical analysis of SQF, which includes things like checking for semicolons and private variables, the file needs to be preprocessed dynamically. If not dynamically, I would need to create a system that links the preprocessed file between the file that is being edited in IntelliJ. The thought of doing preprocessing dynamically or getting the text indexes to line up across a preprocessor system and Intellij, while having decent error reporting, is already making me go bald. I'm sure you all will understand. :)

 

However, the preprocessor is improved for SQF. There won't be any errors for something like THING##var or  #include "file". The false positive errors that could be created are from statements with the preprocessor intertwined like "DEFINE_VAR createVehicle OTHER_STUFF".

 

Also, should I keep doing these dev updates?

  • Like 2

Share this post


Link to post
Share on other sites

Good read. Keep it coming :)

  • Like 1

Share this post


Link to post
Share on other sites

Development update again.

 

The dialog creator has finally reached a point in development that I'm happy to release Actually Soon™. In the coming weeks, I'll be rigorously testing the application to make sure there aren't any horrendous bugs.

I will also be writing the documentation for the application on the wiki.

 

The application will launch with support for the following controls:

  • id=0 - "Static"
    • Fully supported, with a few "style" settings not supported
  • id=1 - "Button"
    • Fully supported
  • id=2 - "Edit"
    • Fully supported, but the preview will not let you type anything or select any text
  • id=4 - "Combo"
    • Fully supported
  • id=5 - "Listbox"
    • Fully supported
  • id=8 - "Progress Bar"
    • Fully supported
  • id=13 - "Structured Text"
    • Has required & optional properties configurable, but lacks all most all of the visual implementation
  • id=16 - "Shortcut Button"
    • Fully supported

I would love to support more controls in the future, but I don't want to fall into development hell ;). Also, there are a couple of very noticeable visual bugs that I'll probably never fix:

  • The fonts of the controls can be changed, but never will visually change (this would require licensing for each font and access to the font files to fix this issue)
  • When a tint color can be applied to an image, the tint will be placed where there is transparency as well (see https://github.com/kayler-renslow/arma-dialog-creator/issues/1 for more info)

I'm excited to finally reach this point in development. No promises on release date though. :)

  • Like 3

Share this post


Link to post
Share on other sites

Thanks for the update K-Town! How is the import feature going - what do you use as reference for your tests if I may ask?

Share this post


Link to post
Share on other sites
1 hour ago, .kju said:

Thanks for the update K-Town! How is the import feature going - what do you use as reference for your tests if I may ask?

The import feature is implemented and tested. I've tested with my own dialogs as well as some from Altis Life. The import feature uses a modular preprocessor and header parser. Both of those systems have 100+ unit tests and I would like to add more edge case testing. A lot of the tests come from the Arma 3 Preprocessor wiki page and issues found with older versions of the import functionality when importing Altis Life for example.

 

The preprocessor is also integrated with a system I haven't announced yet, which I will tease in a video. I think this feature may come as a splendid surprise. ;)

  • Like 2

Share this post


Link to post
Share on other sites

Here is a trailer for Arma Dialog Creator. It includes a splendid surprise at the end ;).

 

 

  • Like 1

Share this post


Link to post
Share on other sites

Sweet :) Looking great mate!

 

On a related note: Did you consider templates, and more importantly allowing users to share them in some (easy fashion)?

Now that it will get a lot easier to make good dialogs, it still leaves the artistic part.

Would be great to have some way to facilitatee some sharing of good designs/approaches.

 

PS: Very curious how you realized that surprise :O

 

 

Share this post


Link to post
Share on other sites
22 minutes ago, .kju said:

Sweet :) Looking great mate!

 

On a related note: Did you consider templates, and more importantly allowing users to share them in some (easy fashion)?

Now that it will get a lot easier to make good dialogs, it still leaves the artistic part.

Would be great to have some way to facilitatee some sharing of good designs/approaches.

 

PS: Very curious how you realized that surprise :O

 

 

I'm not sure what you mean by templates. The application has internal default values that will initialize new controls to those values. For example, every newly created Shortcut Button could be initialized at position x=1,y=1 with a black background and white text. The default value system is pretty modular and I have considered allowing people to have their own default values for each control. It would be very easy to share the default values as well as write them because it's human readable XML (it would be preferable to have an editor though). There is currently no support for loading user-made default values, but in the coming versions, I think it would be worth adding.

 

The surprise uses a mixture of ANTLR and a lot of handwritten code. It's very, very slow compared to Arma 3's implementation, but it gets the job done. Most general use cases of it would fully execute in under a second.

Share this post


Link to post
Share on other sites

To make it hopefully more clear what i mean:

1) BI had been using different GUI styles from A1, A2, OA to A3 - the underlying classes are the same. Its just a matter of textures used and some basic configuration.

2) Its easy to make a basic GUI/UI - to make it look decent is hard (for most).

 

As such if people come up with decent looking styles and there would be an easy way to share those.

Share this post


Link to post
Share on other sites

Well I suppose people could create a new ADC Workspace with Projects already inside it. You could bundle the textures and stuff in the Workspace and share it in a .zip file or something. Then just copy and paste the Workspace over and over again. I'll have to give this more thought.

Share this post


Link to post
Share on other sites

Development update.

 

I'm back to work on the plugin, specifically version 2.0.0. I'm forcing myself to ignore the ADC because it is much more fun to work on and I'll easily get carried away and ignore the plugin if I start working on it. The plugin code is already much cleaner and easier to read. I'm about done with config function auto completion, which implies that Arma Dialog Creator's preprocessor and header parser are working nicely with IntelliJ! As stated before, the preprocessor will only be fully supported in header files for version 2 of the plugin.

 

After function lookup, the next big task will be finding references/usages for commands and variables. This feature also entails finding scope of variables, which has a very messy, sloooooow, and confusing implementation in version 1.0.9 and prior versions of the plugin. After that, I'll be focusing on type checking, which I hope to be simple (*An evil laugh by IntelliJ can be heard in the distance.*). I've already got a rough algorithm worked out in my head. Type checking will also be integrated with auto completion so that you can find commands that return a specific type and thus not flood the screen with commands you don't care about.

 

There's already a lot of features I've only dreamed about years ago that are making it into version 2. There's no timetable on version 2 of the plugin, but I think it will be worth the wait though. :)

  • Like 3

Share this post


Link to post
Share on other sites

Just wanted to leave a  :eyeheart: here. Having an IntelliJ plugin for SQF development is a dream come true.

  • Like 1

Share this post


Link to post
Share on other sites

I have created a Discord server for Arma Dialog Creator and Arma IntelliJ Plugin. Here is the invite: https://discord.gg/SPBbYPa

Share this post


Link to post
Share on other sites

Version 2.0.0 is here! It's taken way to long, but it has many new splendid features that I think were worth the wait. I was originally intending to have 2.0.0 include full addon support with a lot of really cool features, but I have some unfortunate news relating to the plugin. From now on, the plugin and Arma Dialog Creator will be at the lowest priority of my personal projects. This doesn't mean that I'm abandoning them, it means that I'm still interested in working on them, but I may never actually update them anymore. I'll keep updating the command syntaxes and command documentation, but that's the only promise I want to make anymore. I have accomplished every goal I set out to accomplish way back in October 2015 when I started this project. I feel like I have learned everything I can from this project and most importantly, I want to move on. I have many new projects that I want to work on that aren't related to Arma and I just can't have the lingering responsibility of the plugin and dialog creator on my conscious when I'm working on the new projects.

 

If anyone wants to take on development of this project, that's fine with me. I'll answer your questions and such, but in terms of writing code, I may never actually update this again. I might write code, but I don't expect to. Thank you for any support you've given me throughout this endeavor. :)

 

Change Notes

Added

  • Breadcrumbs to SQF
  • full type checking for SQF (including arrays and return values in some instances)
  • full syntax checking for SQF
  • case insensitivity for all commands and variables in SQF (_var and _VAR are equivalent)
  • a better preprocessor for SQF
  • fully implemented preprocessor for Header/Config files
  • better addon support (config.h files are now parsed)
  • configurable syntax highlighting for SQF control structure commands (if, then, etc)
  • implemented tests for plugin builds to ensure code consistency and reliability

Changed

  • Rewrote the plugin for optimization and code clarity purposes
  • removed Arma Color Picker since there is Arma Dialog Creator
  • all SQF command documentation now has the Notes section from the wiki
  • updated all command definitions and documentation to 1.78
  • heavily optimized code inspections
  • The Variable and Magic variable icons have changed to match default syntax highlighting colors

Known Issues

  • #include paths don't quite work when using \ as the path starter.

 

EDIT: I forgot to mention that the plugin may take a day or 2 or be available through Jetbrains' plugin repository. 

 

  • Thanks 3

Share this post


Link to post
Share on other sites
On 2/13/2018 at 2:38 AM, K-Town said:

full type checking for SQF (including arrays and return values in some instances)

May I ask how you retrieved the necessary information for that? Did you strip it out of the BIKI manually?

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×