Hard Light Productions Forums
Modding, Mission Design, and Coding => FS2 Open Tools => Topic started 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:
- Choose one of the three text editors and install it.
- TextMate is the best all around, but it is for Macs only. Get it here (https://github.com/textmate/textmate/releasesl).
- Sublime Text is the best for Windows and Linux, but not as user friendly as the others. Get it here (http://www.sublimetext.com/3).
- Atom is slightly less powerful than the first two, but more user friendly than Sublime Text. Get it here (http://atom.io).
- Install the FreeSpace 2 module for your application
- For TextMate and SublimeText, go to https://github.com/Sesquipedalian/freespace2.tmbundle and follow the simple installation instructions to get the FreeSpace 2 bundle up and running in no time.
- For Atom, just go to the Install section of the application's settings, search for "language-fs2", and click the install button once it finds the package for you.
Supported file types:
- .fs2 (mission files)
- .fc2 (campaign files)
- .tbl (table files)
- .tbm (modular table files)
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:
- 0.3.3
- Detect SEXP operators correctly even when not separated by whitespace from parentheses
- 0.3.2
- Allow space between digit and closing parenthesis in XSTR construct
- 0.3.1
- 0.3.0
- Redefines some language elements (again) because Atom's default themes ignored a rather important one
- Fine tunes a couple of the regular expressions
- 0.2.1
- Adjusts SEXP detection to work around a bug in Sublime Text
- 0.2.0
- Restructures SEXP handling to be much more robust
- Better differentiates some language elements
- 0.1.0
-
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)
-
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...?
-
Neat! I don't suppose you have a language/syntax file for vim? ;7
:lol:
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. :)
-
I'll move this to tools in a couple of days. Let the FREDders see it first. :D
-
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++.
-
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)
-
This is incredibly useful , as well i didn't know the thread of Notepad ++ .
My eyes are very grateful , thanks :p
-
You are welcome. :yes:
-
i won't be happy until we have an emacs major mode that can interface with a running FSO process
-
i won't be happy until we have an emacs major mode that can interface with a running FSO process
-
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.
-
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?
-
Yeah running much better when not simultaneously trying to compile 9 C++ files at a time.
-
I've made some updates. Now at version 0.2.1. See original post for changelog.
-
Version 0.3.0 is available now. See original post for changelog.
-
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
-
...That's not a changelog; that's a placeholder. :P
Fair criticism. Happy now? ;)
-
...That's not a changelog; that's a placeholder. :P
Fair criticism. Happy now? ;)
Yes! :)
-
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?
-
Fixed in version 0.3.2. :)
-
Version 0.3.3 posted. See first post for change log.
-
What about adding support for Notepad++?
-
What about adding support for Notepad++?
You didn't read the rest of the thread, did you? ;)
-
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).
-
I was skimming. I think I must have missed something. Damn... Sorry.
-
:bump:
Would a moderator please sticky this thread, or maybe make a "Useful Links" thread which is stickied?
-
Sure, why not.
-
Thx much. :yes:
-
Any possibility of vim compatibility?
-
Any possibility of vim compatibility?
Neat! I don't suppose you have a language/syntax file for vim? ;7
:lol:
-
I didn't know what to make of that on the first readthrough and repeating it doesn't help.
-
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.