From b6866deb49c17bd254dc5a8c48f4a82ebb25ac83 Mon Sep 17 00:00:00 2001 From: lenemter Date: Fri, 21 Feb 2025 16:06:31 +0300 Subject: [PATCH 1/2] Code Style: clarify optional whitespace after closing bracket with semicolon --- writing-apps/code-style/README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/writing-apps/code-style/README.md b/writing-apps/code-style/README.md index ae61128..5bd7279 100644 --- a/writing-apps/code-style/README.md +++ b/writing-apps/code-style/README.md @@ -48,6 +48,15 @@ if (condition) { // other code ``` +An exception is admitted for cases of series of lines that end with a closing bracket and semi-colon: + +```vala +my_function_name ( + // ... + // ... +); +``` + ## Indentation ### Vala From b6d40fd53a643af5298fae9d34aff6ec30af536c Mon Sep 17 00:00:00 2001 From: lenemter Date: Sun, 23 Feb 2025 12:11:14 +0300 Subject: [PATCH 2/2] Improve wording, show multiple examples --- writing-apps/code-style/README.md | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/writing-apps/code-style/README.md b/writing-apps/code-style/README.md index 5bd7279..39fbdfa 100644 --- a/writing-apps/code-style/README.md +++ b/writing-apps/code-style/README.md @@ -48,13 +48,27 @@ if (condition) { // other code ``` -An exception is admitted for cases of series of lines that end with a closing bracket and semi-colon: +The placement of empty lines after blocks ending with a closing bracket and semicolon is not regulated. You may add an empty line if it improves readability. ```vala -my_function_name ( - // ... - // ... -); +var box = new Gtk.Box (Gtk.Orientation.VERTICAL, 12) { + margin_top = 12, + margin_bottom = 12 +}; +box.append (new Gtk.Button.with_label ("Click me!")); + +var titlebar = new Gtk.Grid () { + visible = false +}; + +var main_window = new Gtk.ApplicationWindow (this) { + title = "MyApp", + child = box, + titlebar = headerbar +}; +main_window.present (); + +// other code ``` ## Indentation