simsulla / nwomod

NWO mod for Victoria 2
http://simsulla.org/
MIT License
57 stars 69 forks source link

Add coding standards for Paradox Syntax files #1206

Open nntoan opened 6 years ago

nntoan commented 6 years ago

In this PR, I applied the JSON coding standards for our Paradox script files.

You can check the .editorconfig below

root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.txt]
indent_size = 2

Why we need coding standards?

An obvious answer, I'm tired when anytime open a Paradox file which is the combination of 8 and 4 tab-size indents, spaces and tabs...etc. So finally, it's all for

Make scripting Paradox great Again!

Requirements

Visual Studio Code is highly recommended but Atom or Sublime Text is fine too.

NOTE: Inside the NWO.code-workspace (which included in this PR), I've ported the Paradox Color Theme into the Workspace setting so the syntax highlighting could be applied to any colour themes. The current colour token in this PR works best with Material Theme.

screenshot 2018-08-19 12 43 47

Cheers!

simsulla commented 6 years ago

A like the syntax update. Nice :) But I think we have an error; as vic2 files are not utf-8, they are ansi (Windows-1252) encoded. Have you checked that your commit does not mess up the encoding of localization text?

ps. excellent that you share the NWO.code-workspace and .editorconfig, but I would suggest not committing them in the NWO repo as we build releases as dumps of the checked in code. And we don't whant it do contain dev tool only files.

nntoan commented 6 years ago

@simsulla Yeah, I do notice a lot of files mess up the encoding after converting to utf-8. However, I do notice even in the original files of NWO it's "?" already

https://github.com/simsulla/nwomod/pull/1206/files#diff-6334ed0850cb30aa1bf1c649bdb3d630L114

For your other concerns about *.code-workspace & .editorconfig, fortunately we are using Git 2.0 and as far as my understanding during the whole time playing with GitHub, they are supporting .gitattributes very well.

In short, if you want to ignore something from the release zip, add it to .gitattributes :)

.editorconfig is a MUST if we want to keep the coding standards for those files.

simsulla commented 6 years ago

Point taken on the *.code-workspace & .editorconfig. On the utf/8 vs ansi encoding, I suggest excluding the localisation directory and common/countries form the format update. It is up to the developers to never use non ascii characters in the formated files.