• We have updated our Community Code of Conduct. Please read through the new rules for the forum that are an integral part of Paradox Interactive’s User Agreement.
So, I'm in the process of creating a sister tool for HoI, and while at it, I've implemented a few techniques that will make the ck2 syntax way less prone to errors. I've also found a way to take advantage of Sublime Text indexing capabilities so in the future we can use 'Go to definition', etc: the trick is that if the a file has a the name 'foo.bar.baz', Windows will take it that the extension is 'baz', but I can tell Sublime to apply a syntax for extension "bar.baz". In other words, if I tell the events syntax to auto apply it to all files with extensions 'events.txt', you can rename e.g. myEvents.txt to myEvents.events.txt, and the game will load the files fine and Sublime will highlight them automatically - incidentally, it also make my python hacks quite a bit cleaner than they were before.

So the only downside now is that you'll have longer filenames (and that you'll need to rename vanilla files if you want to lint them, but I'll make a menu command that makes that automatically for you).

That being said, if anyone uses OS X or Linux, can you test if those systems have the same behaviour regarding extensions? Otherwise, the technique would only be viable on Windows.
 
Linux mostly doesn't give a damn about file extensions.

After some reading, yeah, it seems all major systems do that now.

Further progress report: with the extension trick, I can index files. This means two things for the users when the update arrives:
  1. if you click in the name of a "database object" (trait, cb, objective), you can open up its definition with a furher click directly. Useful when you want to quickly refresh your memory or tweak an object on the fly without havig to manyally search for the file where the item is defined (this assumes the definition file is in your project -so you need to have both vanilla and the mod open in your project to jump from a mod file to a vanilla definition) and that you don't name two database entities the same (so don't make a culture a religion and a trait have the same name, that's bad practive anyway ).
  2. You can spot syntax errors in your code now! If you hit ctrl+shift+r you'll get a search field. Search for ERROR and you'll be able to jump to all syntactical errors. This doesn't include things like asing for a trait that isn't defined, but include things like missing equal sings between a trigger/effect and its value, and most* cases when we screw brackets up (no more frustrating counting of brackets when Validator throws a "parsing error" at line -1,1).
*) If you omit the last brackets in a file, that won't be caught by the highlighter, since it has no means to test if it has arrived to the end of file. I think I can hack an alternative to that, but it'll have to be in a different interface I fear.
 
In the view menu, select "Show Console". The shortcut should be ctrl+~ (~ being the key above tab). It should give you a bit more verbose output as to what is going on whenever you open a file.

If you know a bit of python, you can fiddle a bit with the scripts.py file to see what goes wrong.

This is not working for me too and when i see console there is no error. I have tried your script it doesn't work either. What should I do to troubleshoot more?
 
This is not working for me too and when i see console there is no error. I have tried your script it doesn't work either. What should I do to troubleshoot more?
Nevermind. I have debugged it myself. It turns out I do really need the new script and not have my path have double backslash. Just use single backslash as usual.
 
OK, I downloaded and installed Sublime Text 3, downloaded ck2IDE_0_2a.zip and installed it in Sublime Text 3, opened up one of my old mod's files (Chronicled Achievements, which only has one event file and one localization file) and am seeing no coloring of the event text, and inconsistent coloring of the localization text.
 
I'm in even worse shape than richvh, I get no coloring at all in events or localization. I'm using Linux and I tried replacing the script.py with xrogaan's version, no help. I can define my game/mod path with or without escape characters, neither way helps.
 
It works if you fix an error in its source code.

There is a bunch of places in scripts.py that is written "os.sep", if you change to "os.path.sep" it will resume working.
 
Even though this file is quite old, it still mostly works it seems.

I noticed it doesn't recognize the 'picture' clause in events that was was added in 3.0. As a workaround I changed the file '\syntaxes\DSL\events.sublime-syntax'.

Delete '|picture' from line 35
- match: '\b(((culture|religion)(_group)?)|picture|lacks_dlc|has_(dlc|((global|character)_)?flag))\b'
Add '|picture' in line 55
- match: '\b(desc|picture)\b'

It's not a perfect solution, but it allows picture clauses to be highlighted correctly.