Author Topic: Tech File Syntax Highlighting in Notepad++  (Read 4206 times)

Offline Vagabond

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1015
Tech File Syntax Highlighting in Notepad++
« 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.

Example of file loaded into Notepad++:


----
EDIT1: Added a readme file attachment.
EDIT2: Updated attached readme and added REPO link.
« Last Edit: March 16, 2016, 07:02:19 PM by Vagabond »

Offline Hooman

  • Administrator
  • Hero Member
  • *****
  • Posts: 4955
Re: Tech File Syntax Highlighting in Notepad++
« Reply #1 on: March 08, 2016, 12:17:07 AM »
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.
« Last Edit: March 08, 2016, 12:18:47 AM by Hooman »

Offline Hooman

  • Administrator
  • Hero Member
  • *****
  • Posts: 4955
Re: Tech File Syntax Highlighting in Notepad++
« Reply #2 on: March 13, 2016, 01:53:24 AM »
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.

Offline Vagabond

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1015
Re: Tech File Syntax Highlighting in Notepad++
« Reply #3 on: March 13, 2016, 11:50:31 AM »
@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.

Offline Hooman

  • Administrator
  • Hero Member
  • *****
  • Posts: 4955
Re: Tech File Syntax Highlighting in Notepad++
« Reply #4 on: March 13, 2016, 09:56:20 PM »
That's actually a good idea. I like your proposed folder names.

Offline Vagabond

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1015
Re: Tech File Syntax Highlighting in Notepad++
« Reply #5 on: March 16, 2016, 06:59:45 PM »
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

Offline Hooman

  • Administrator
  • Hero Member
  • *****
  • Posts: 4955
Re: Tech File Syntax Highlighting in Notepad++
« Reply #6 on: March 17, 2016, 02:31:55 AM »
Thank you. Looks good.

Offline leeor_net

  • Administrator
  • Hero Member
  • *****
  • Posts: 2352
  • OPHD Lead Developer
    • LairWorks Entertainment
Re: Tech File Syntax Highlighting in Notepad++
« Reply #7 on: March 17, 2016, 03:35:23 PM »
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++