Author Topic: Simutrans Dat Syntax (SublimeText package)  (Read 1036 times)

0 Members and 1 Guest are viewing this topic.

Offline An_dz

  • Web Admin
  • Administrator
  • *
  • Posts: 2548
  • Total likes: 279
  • Helpful: 89
  • D'oh
    • by An_dz
  • Languages: PT, EN, (it, de)
Simutrans Dat Syntax (SublimeText package)
« on: March 08, 2016, 03:08:06 AM »
A few years ago I released a package for SublimeText here in the forums. It had colour highlighting and some completions to ease the creation of dat files.

Well, I updated that package recreating it from the ground up.



In this revisited version I made the colour highlighting smarter, now the values will only colourise if on the correct parameter, deprecated values and parameters also have a special colour to let you know they are deprecated.



If you want to know why the value is deprecated, select it, or just put the caret over it, then hit Ctrl+Shift+Alt+P. The explanation will be shown on the statusbar.



The new package offers completions for pretty much everything. Every parameter and value will be offered to be automatically added, if not, you can force with Ctrl+Spacebar. I also added the option to automatically create almost every object type, just start typing obj= and you'll see a list of all objects and when choosing one it will add all possible values. You'll be able to jump between the values with the Tab key and if that parameter is useless, just delete the whole line with Ctrl+Shift+K.



obj=building is not available for full completion because each building type has different parameters, thus you first add obj=buidling manually and on the next line add type and choose a completion.

You can rearrange the lines by Ctrl+Shift+Arrow Up/Down. SublimeText allows multiple caret/selection areas so you can select many at the same time and move/delete them all at once, click somewhere while holding Ctrl to add a caret to that area. Ctrl+Alt+Arrow Up/Down extend the caret to the top/bottom line.

You can easily comment a line hitting Ctrl+/. This shortcut is like that only for English keyboards, so it's either the key right at the left of the right Shift or the next one. For example, in my Brazilian keyboard the / is exactly touching the right Shift, but the key that really triggers is the one at the left of /

The source is available in GitHub at https://github.com/An-dz/SimutransDatSyntax

Not included in v1.0.0:
- Experimental values and parameters
- kierongreen's patch

Download
I've added the package to Package Control, this way you'll be automatically updated with the latest version whenever I add more features or add new values.

- Install SublimeText (I recommend SublimeText 3 as it's faster)
- Install Package Control
- Use Package Control to download Simutrans dat Syntax (How to use Package Control)
Obs: There's a small delay while Package Control fetches the list of packages when you hit Install Package, check the statusbar and don't lose focus of the SublimeText window as this will close the Command Palette.

My theme is Stereokai available from the package named Color Schemes by carlcalderon, I helped this theme adding support for markdown, JSON and patch files.