Hard Light Productions Forums

Modding, Mission Design, and Coding => FS2 Open Tools => Topic started by: Sesquipedalian on January 04, 2016, 02:15:09 am

Title: Make hand editing missions and tables easier with SYNTAX HIGHLIGHTING!
Post by: Sesquipedalian on January 04, 2016, 02:15:09 am
I've created syntax highlighting modules for FreeSpace 2 mission and table files to use in modern text editors like TextMate (http://macromates.com), Sublime Text (http://www.sublimetext.com), and Atom (http://atom.io). Syntax highlighting makes it so much nicer and easier to edit mission and table files by hand.

Syntax highlighting is much prettier to look at, of course. But more importantly, syntax highlighting makes it immediately easier to see and understand what is happening in the file when you read it. For those times when you need to fire up a text editor and mess around with the guts of your mission and table files, this is much better than using Notepad.

Check it out:
(http://scroll.hard-light.net/images/syntax-highlighting/fs2-syntax-highlighting-1.png) (http://scroll.hard-light.net/images/syntax-highlighting/fs2-syntax-highlighting-1.png)
More examples with different themes:
(http://scroll.hard-light.net/images/syntax-highlighting/fs2-syntax-highlighting-2-thumb.png) (http://scroll.hard-light.net/images/syntax-highlighting/fs2-syntax-highlighting-2.png)(http://scroll.hard-light.net/images/syntax-highlighting/fs2-syntax-highlighting-3-thumb.png) (http://scroll.hard-light.net/images/syntax-highlighting/fs2-syntax-highlighting-3.png)(http://scroll.hard-light.net/images/syntax-highlighting/fs2-syntax-highlighting-4-thumb.png) (http://scroll.hard-light.net/images/syntax-highlighting/fs2-syntax-highlighting-4.png)(http://scroll.hard-light.net/images/syntax-highlighting/fs2-syntax-highlighting-5-thumb.png) (http://scroll.hard-light.net/images/syntax-highlighting/fs2-syntax-highlighting-5.png)
(Click to enlarge)

Section headings, keywords, SEXP names, numeric values, string values, variables, colour control codes in XSTR text, etc., all receive unique formatting. The section headings will populate the quick navigation features of TextMate and Sublime Text, making it easy to get to the section that you need to deal with.


I've created versions of the FreeSpace 2 syntax highlighting module for the three text editors mentioned above. To use one, do the following:


Supported file types:

All three of these text editors let you choose your favourite theme, so you can choose whichever colour scheme you prefer. I personally like the one in the top picture, but there are many options available.

Changelog:
Title: Re: FS2 syntax highlighting in your text editor
Post by: niffiwan on January 04, 2016, 02:27:16 am
Neat! I don't suppose you have a language/syntax file for vim?   ;7

Also seems like a good time/place to link in Mjn's similar efforts for notepad++

http://www.hard-light.net/forums/index.php?topic=84887.0 (TBL/TBM)
http://www.hard-light.net/forums/index.php?topic=84905.0 (debug log)
Title: Re: FS2 syntax highlighting in your text editor
Post by: AdmiralRalwood on January 04, 2016, 02:31:50 am
Oh, sweet. I've always preferred Sublime Text; one of these days, I was going to try to make my own syntax highlighting for it. It looks like you've saved me the trouble! :yes:

I don't suppose you could add debug log support...?
Title: Re: Make hand editing missions and tables easier with SYNTAX HIGHLIGHTING!
Post by: Sesquipedalian on January 04, 2016, 02:36:02 am
Neat! I don't suppose you have a language/syntax file for vim?   ;7
:lol:

Quote
Also seems like a good time/place to link in Mjn's similar efforts for notepad++

http://www.hard-light.net/forums/index.php?topic=84887.0 (TBL/TBM)
http://www.hard-light.net/forums/index.php?topic=84905.0 (debug log)

Cool. Well, now we have more options, and not just for one editor on Windows. :)


I don't suppose you could add debug log support...?

Probably. Might be a while before I can get around to it, though. :)
Title: Re: Make hand editing missions and tables easier with SYNTAX HIGHLIGHTING!
Post by: karajorma on January 04, 2016, 06:02:14 am
I'll move this to tools in a couple of days. Let the FREDders see it first. :D
Title: Re: Make hand editing missions and tables easier with SYNTAX HIGHLIGHTING!
Post by: Bryan See on January 04, 2016, 12:00:47 pm
I don't see any FreeSpace-related extensions in the link: http://docs.notepad-plus-plus.org/index.php/User_Defined_Language_Files (http://docs.notepad-plus-plus.org/index.php/User_Defined_Language_Files).

However, can I create them by myself?

EDIT: I'm using Notepad++.
Title: Re: Make hand editing missions and tables easier with SYNTAX HIGHLIGHTING!
Post by: AdmiralRalwood on January 04, 2016, 12:14:17 pm
I don't see any FreeSpace-related extensions in the link: http://docs.notepad-plus-plus.org/index.php/User_Defined_Language_Files (http://docs.notepad-plus-plus.org/index.php/User_Defined_Language_Files).

However, can I create them by myself?

EDIT: I'm using Notepad++.
Niffiwan just linked to them in the very first reply:
Also seems like a good time/place to link in Mjn's similar efforts for notepad++

http://www.hard-light.net/forums/index.php?topic=84887.0 (TBL/TBM)
http://www.hard-light.net/forums/index.php?topic=84905.0 (debug log)
Title: Re: Make hand editing missions and tables easier with SYNTAX HIGHLIGHTING!
Post by: coffeesoft on January 04, 2016, 01:18:28 pm
This is incredibly useful , as well i didn't  know the thread of Notepad ++ .

My eyes are very grateful , thanks :p
Title: Re: Make hand editing missions and tables easier with SYNTAX HIGHLIGHTING!
Post by: Sesquipedalian on January 04, 2016, 02:07:19 pm
You are welcome. :yes:
Title: Re: Make hand editing missions and tables easier with SYNTAX HIGHLIGHTING!
Post by: Phantom Hoover on January 04, 2016, 06:20:45 pm
i won't be happy until we have an emacs major mode that can interface with a running FSO process
Title: Re: Make hand editing missions and tables easier with SYNTAX HIGHLIGHTING!
Post by: Sesquipedalian on January 04, 2016, 07:45:33 pm
i won't be happy until we have an emacs major mode that can interface with a running FSO process
Title: Re: Make hand editing missions and tables easier with SYNTAX HIGHLIGHTING!
Post by: chief1983 on January 05, 2016, 10:02:52 am
Works great on my Sublime Text 3 on my Mac.  However, it does seem to be acting like it's running some very long loops between actions, so far I noticed it just on opening and closing the files.  It hangs the program for a couple of seconds.  None of my other syntax highlighted files have an issue like that.

Edit:  Or it may have been that the nightly build process had just started running in the background, that does tend to consume a lot of my CPU cycles.
Title: Re: Make hand editing missions and tables easier with SYNTAX HIGHLIGHTING!
Post by: Sesquipedalian on January 05, 2016, 12:45:35 pm
Works great on my Sublime Text 3 on my Mac.  However, it does seem to be acting like it's running some very long loops between actions, so far I noticed it just on opening and closing the files.  It hangs the program for a couple of seconds.  None of my other syntax highlighted files have an issue like that.

Edit:  Or it may have been that the nightly build process had just started running in the background, that does tend to consume a lot of my CPU cycles.

I have not seen that on my machine at all. Have you had a chance to try it again since?
Title: Re: Make hand editing missions and tables easier with SYNTAX HIGHLIGHTING!
Post by: chief1983 on January 05, 2016, 01:19:35 pm
Yeah running much better when not simultaneously trying to compile 9 C++ files at a time.
Title: Re: Make hand editing missions and tables easier with SYNTAX HIGHLIGHTING!
Post by: Sesquipedalian on January 05, 2016, 03:33:50 pm
I've made some updates. Now at version 0.2.1. See original post for changelog.
Title: Re: Make hand editing missions and tables easier with SYNTAX HIGHLIGHTING!
Post by: Sesquipedalian on January 09, 2016, 12:23:13 pm
Version 0.3.0 is available now. See original post for changelog.
Title: Re: Make hand editing missions and tables easier with SYNTAX HIGHLIGHTING!
Post by: AdmiralRalwood on January 09, 2016, 03:07:35 pm
Version 0.3.0 is available now. See original post for changelog.
Changelog:
  • 0.3.0
    • Refinements and improvements
...That's not a changelog; that's a placeholder. :P
Title: Re: Make hand editing missions and tables easier with SYNTAX HIGHLIGHTING!
Post by: Sesquipedalian on January 09, 2016, 03:20:30 pm
...That's not a changelog; that's a placeholder. :P

Fair criticism. Happy now? ;)
Title: Re: Make hand editing missions and tables easier with SYNTAX HIGHLIGHTING!
Post by: AdmiralRalwood on January 10, 2016, 01:04:22 am
...That's not a changelog; that's a placeholder. :P

Fair criticism. Happy now? ;)
Yes! :)
Title: Re: Make hand editing missions and tables easier with SYNTAX HIGHLIGHTING!
Post by: AdmiralRalwood on February 03, 2016, 12:57:07 am
I opened up some Blue Planet TBMs and noticed something odd:
(http://deviance.duckish.net/pictures/hmm.png)

I scratched my head for a while wondering what could be going wrong, and then I finally had an idea and did a quick find&replace...
(http://deviance.duckish.net/pictures/hmm2.png)

The space between the -1 and the closing parenthesis appears to be confounding the syntax highlighting. I'm guessing a regular expression probably just needs "\s*" added?
Title: Re: Make hand editing missions and tables easier with SYNTAX HIGHLIGHTING!
Post by: Sesquipedalian on February 03, 2016, 08:10:14 pm
Fixed in version 0.3.2. :)
Title: Re: Make hand editing missions and tables easier with SYNTAX HIGHLIGHTING!
Post by: Sesquipedalian on February 07, 2016, 10:29:26 pm
Version 0.3.3 posted. See first post for change log.
Title: Re: Make hand editing missions and tables easier with SYNTAX HIGHLIGHTING!
Post by: LaineyBugsDaddy on June 09, 2016, 01:02:59 pm
What about adding support for Notepad++?
Title: Re: Make hand editing missions and tables easier with SYNTAX HIGHLIGHTING!
Post by: Sesquipedalian on June 09, 2016, 01:07:17 pm
What about adding support for Notepad++?

You didn't read the rest of the thread, did you? ;)
Title: Re: Make hand editing missions and tables easier with SYNTAX HIGHLIGHTING!
Post by: mjn.mixael on June 09, 2016, 01:08:10 pm
Also here (http://www.hard-light.net/forums/index.php?topic=84887.0) and here (http://www.hard-light.net/forums/index.php?topic=84905.0).
Title: Re: Make hand editing missions and tables easier with SYNTAX HIGHLIGHTING!
Post by: LaineyBugsDaddy on June 09, 2016, 01:10:05 pm
I was skimming. I think I must have missed something. Damn... Sorry.
Title: Re: Make hand editing missions and tables easier with SYNTAX HIGHLIGHTING!
Post by: z64555 on January 24, 2017, 04:35:45 pm
:bump:

Would a moderator please sticky this thread, or maybe make a "Useful Links" thread which is stickied?
Title: Re: Make hand editing missions and tables easier with SYNTAX HIGHLIGHTING!
Post by: The E on January 24, 2017, 05:58:35 pm
Sure, why not.
Title: Re: Make hand editing missions and tables easier with SYNTAX HIGHLIGHTING!
Post by: z64555 on January 24, 2017, 06:52:11 pm
Thx much.  :yes:
Title: Re: Make hand editing missions and tables easier with SYNTAX HIGHLIGHTING!
Post by: xenocartographer on April 30, 2017, 01:46:23 pm
Any possibility of vim compatibility?
Title: Re: Make hand editing missions and tables easier with SYNTAX HIGHLIGHTING!
Post by: Sesquipedalian on April 30, 2017, 08:59:12 pm
Any possibility of vim compatibility?

Neat! I don't suppose you have a language/syntax file for vim?   ;7
:lol:
Title: Re: Make hand editing missions and tables easier with SYNTAX HIGHLIGHTING!
Post by: xenocartographer on April 30, 2017, 09:04:14 pm
I didn't know what to make of that on the first readthrough and repeating it doesn't help.
Title: Re: Make hand editing missions and tables easier with SYNTAX HIGHLIGHTING!
Post by: Sesquipedalian on April 30, 2017, 09:06:23 pm
You may take it as a no. :)

Syntax highlighting for vim would be a completely separate project, because vim uses an entirely different system for its syntax highlighting.