Outpost Universe Forums
Projects & Development => Outpost 2 Programming & Development => Topic started by: Vagabond on March 07, 2016, 03:21:53 PM
-
Hey Everyone,
I sat down today and wrote up a quick Syntax highlighting script for Outpost 2 Tech Files in Notepad++.
UDLs (User Defined Languages) are defined in an XML format and provide syntax highlighting for files loaded into Notepad++. Attached is the Outpost 2 Tech File which provides the definitions required.
To use it, download the file. Then open Notepad++ and navigate through Language -> Define your Language... -> Import...
Since many files use the .txt extension, when loading a Tech File into Notepad++, you will have to go back to the Language Tab and select the Outpost 2 Tech File whenever loading a new file into Notepad++.
I think this will provide decent syntax highlighting, but it may not be 100% accurate due to my limited understanding of the tech file format. For example, I don't know if comments must start on a new line, or if they can exist after a statement. However, it should help a lot with preventing misspelled keywords. It isn't difficult to update from within Notepad++. If there is interest in it being more robust, I would be willing to help out.
UPDATE: The syntax highlighter now lives in the repository here: https://svn.outpostuniverse.org:8443/!/#outpost2/view/head/LevelsAndMods/trunk/DevTools/TechFileSyntaxHighlighting. (https://svn.outpostuniverse.org:8443/!/#outpost2/view/head/LevelsAndMods/trunk/DevTools/TechFileSyntaxHighlighting.)
Example of file loaded into Notepad++:
(http://forum.outpost2.net/index.php?action=dlattach;topic=5802.0;attach=651)
----
EDIT1: Added a readme file attachment.
EDIT2: Updated attached readme and added REPO link.
-
This right here is a pile of awesome
Edit: Comments can appear at the end of lines. They continue until the next newline. A semicolon can start a comment anywhere except within a quoted string.
-
I was just thinking this should be added to the SVN repository.
I took a quick peek, but didn't see an obvious place to stick it. None of the existing folders seem appropriate. Are there any other ideas for mods to help development? Maybe we could add a DevMod folder or something. Or perhaps just NppMods. Install instructions could be included in a ReadMe file.
-
@Hooman,
I like the idea of adding to the repository. Good news is, the comment syntax highlighting works correctly as you described. I attached a quick readme.txt file to the first post on this forum topic. It would make since to me to put it close to wherever the Tech File Lint Checker is going.
Maybe,
DevTools/TechFileSyntaxHighlighting
DevTools/TechFileLintChecker
But really, wherever you think is best works for me.
-
That's actually a good idea. I like your proposed folder names.
-
Okay, I went ahead and added the syntax file and readme to the repo in a new folder as discussed. Also rewrote part of the readme file, since I did a poor initial job writing it.
https://svn.outpostuniverse.org:8443/!/#outpost2/view/head/LevelsAndMods/trunk/DevTools/TechFileSyntaxHighlighting (https://svn.outpostuniverse.org:8443/!/#outpost2/view/head/LevelsAndMods/trunk/DevTools/TechFileSyntaxHighlighting)
-
Thank you. Looks good.
-
DOOOOOOOOOOOOD
THIS RIGHT HERE. THIS is the sort of thing we need.
I kind of figured it could be done but I've never defined a UDL for Notepad++.
I should look into it... I have a couple of other 'languages' that I want to define so I can get syntax highlighting in NP++