Knuckle Cracker

Creeper World 3 => The Coder's Corner => Topic started by: stellatedHexahedron on November 04, 2018, 12:47:32 PM

Title: Advanced CRPL Syntax for VSCode
Post by: stellatedHexahedron on November 04, 2018, 12:47:32 PM
I'm writing a VSCode extension which does the following for CRPL files
I'm planning to add other, more semantic stuff as well -- eg, command signature checking, variable scoping, proofing against some more obscure bugs (mostly as pointed out by Cornucanis so far), etc. If anyone has any ideas of what else I could add, feel free to suggest it.

Most Recent Download Link (https://github.com/stellHex/crpl-vscode/releases/download/0.3.1-beta/crpl-0.3.1.vsix) (To use this file, open VSCode and use the "Extensions: Install from VSIX..." command.)

Releases Page (https://github.com/stellHex/crpl-vscode/releases)

(https://i.imgur.com/FcqHjGt.gif)
Title: Re: Advanced CRPL Syntax for VSCode
Post by: cornucanis on November 05, 2018, 02:28:20 AM
Looks like a very helpful extension! You may want to add a warning against using Delay within a loop, in order to prevent this bug. (http://knucklecracker.com/forums/index.php?topic=16703.0)
Title: Re: Advanced CRPL Syntax for VSCode
Post by: GoodMorning on November 05, 2018, 03:48:44 PM
On the same note, it may be helpful to let user-defined functions tooltips specify the arguments as follows:

:FunctionName # [ In In - Out Out] Some helpful words of description
    "DoSomething" Trace
Title: Re: Advanced CRPL Syntax for VSCode
Post by: kajacx on November 10, 2018, 07:00:04 AM
Nice, I have something simillar for N++ ()link (https://knucklecracker.com/wiki/doku.php?id=crpl:overview#creating_crpl_scripts), but not as sophisticated. What I'm missing and would like to see is:
1) a warning if a variable is nevver written to, or never read from. This will greatly reduce typos in varaible names
2) an option to jump to user function definition from a call statement
3) the hints for user function, as was said by GM
You may convince me to use Visual Studio, which is no easy task I assure you.
Title: Re: Advanced CRPL Syntax for VSCode
Post by: stellatedHexahedron on November 13, 2018, 03:22:37 PM
Quote from: cornucanis on November 05, 2018, 02:28:20 AM
Looks like a very helpful extension! You may want to add a warning against using Delay within a loop, in order to prevent this bug. (http://knucklecracker.com/forums/index.php?topic=16703.0)

Noted!

Quote from: GoodMorning on November 05, 2018, 03:48:44 PM
On the same note, it may be helpful to let user-defined functions tooltips specify the arguments as follows:

:FunctionName # [ In In - Out Out] Some helpful words of description
    "DoSomething" Trace


Yes, that's planned. Any comment(s) immediately following a function definition will be integrated into a tooltip for that function, and if one of the lines follows a certain format, it will also be used for type checking.

Quote from: kajacx on November 10, 2018, 07:00:04 AM
Nice, I have something simillar for N++ ()link (https://knucklecracker.com/wiki/doku.php?id=crpl:overview#creating_crpl_scripts), but not as sophisticated. What I'm missing and would like to see is:
1) a warning if a variable is nevver written to, or never read from. This will greatly reduce typos in varaible names
2) an option to jump to user function definition from a call statement
3) the hints for user function, as was said by GM

All planned. For some reason I've been working on type checking as the next thing, but it's taking forever, so I might just switch to doing these things.

Quote from: kajacx on November 10, 2018, 07:00:04 AM
You may convince me to use Visual Studio, which is no easy task I assure you.

Hah, it's always a pain to transfer text editors, but you won't regret it, I assure you :)
Title: Re: Advanced CRPL Syntax for VSCode
Post by: cornucanis on November 16, 2018, 06:15:23 AM
Hey, another issue you may want to warn against (http://knucklecracker.com/forums/index.php?topic=30704.msg175963#msg175963) in your extension recently came to light. The short version is that using SetTerrain within the Awake function will cause the map to become unable to load. As a consequence of this, destroying an object which leaves behind a PZ within the Awake function also causes the issue as explained in the post. So basically the warning should trigger when SetTerrain or Destroy are placed within the Awake function.
Title: Re: Advanced CRPL Syntax for VSCode
Post by: stellatedHexahedron on November 17, 2018, 10:25:51 AM
I just released version 0.3 of the extension. The major addition is the ability to rename/jump to definition/find references for variables and functions.

Quote from: cornucanis on November 16, 2018, 06:15:23 AM
Hey, another issue you may want to warn against (http://knucklecracker.com/forums/index.php?topic=30704.msg175963#msg175963) in your extension recently came to light.

Thanks, cornucanis. I'll include that in the next release.
Title: Re: Advanced CRPL Syntax for VSCode
Post by: stellatedHexahedron on September 28, 2019, 05:50:19 PM
Hey, obviously I kinda dropped this project, but for some reason today the stars aligned, and I added a "syntax only on save" option, which should eliminate the dreadful lag on larger files.
Title: Re: Advanced CRPL Syntax for VSCode
Post by: Builder17 on September 29, 2019, 01:27:36 AM
Quote from: stellatedHexahedron on September 28, 2019, 05:50:19 PM
Hey, obviously I kinda dropped this project, but for some reason today the stars aligned, and I added a "syntax only on save" option, which should eliminate the dreadful lag on larger files.

(https://knucklecracker.com/forums/Themes/NightBreeze20/images/post/thumbup.gif)
Title: Re: Advanced CRPL Syntax for VSCode
Post by: Grabz on October 26, 2019, 10:53:37 AM
Hey, thanks a bunch.

Don't worry about the project, it's well written and has been an invaluable tool for me. Besides, the hype around writing extravagant CW3 content has mostly died down, so we probably will not see much interest in CRPL, less and less as time goes on.
Title: Re: Advanced CRPL Syntax for VSCode
Post by: Grabz on June 24, 2021, 09:09:11 AM
For the 4RPL coders out there, I made a tiny modification to the original vsix file to make the extension work on .4rpl files. It won't highlight new functions and for all intents and purposes will still act like its CRPL, but the useful highlighting will remain, so it is better than nothing.

The file attached has .zip extension, simply change it to .vsix and it will work. I did it this way because the forum whitelist doesn't let me post a vsix, and vsix files are just zip files.
Title: Re: Advanced CRPL Syntax for VSCode
Post by: Karsten75 on June 24, 2021, 05:41:13 PM
Quote from: Grabz on June 24, 2021, 09:09:11 AM
It won't highlight new functions and for all intents and purposes will still act like its CRPL

Do you know what needs to be done to bring it up to equivalence for 4RPL?
Title: Re: Advanced CRPL Syntax for VSCode
Post by: Grabz on July 20, 2021, 07:52:07 AM
Quote from: Karsten75 on June 24, 2021, 05:41:13 PM
Do you know what needs to be done to bring it up to equivalence for 4RPL?
It seems that it is mainly a lot of tedious work copy pasting function names into a config file, and a script will likely need to be adjusted for new features such as $$.

Seeing as the extension is written in NodeJS I'm sure I could do it, but I'm not certain if it is worth the time given the apparent lack of popularity given to this extension.