diff --git a/src/dfmt/formatter.d b/src/dfmt/formatter.d index 91b0caf..1847cbc 100644 --- a/src/dfmt/formatter.d +++ b/src/dfmt/formatter.d @@ -657,6 +657,16 @@ private: case tok!"cast": writeToken(); break; + case tok!"try": + if (peekIs(tok!"{")) + writeToken(); + else + { + writeToken(); + indents.push(tok!"try"); + newline(); + } + break; case tok!"in": case tok!"is": writeToken(); diff --git a/tests/allman/issue0126.d.ref b/tests/allman/issue0126.d.ref new file mode 100644 index 0000000..e7f4684 --- /dev/null +++ b/tests/allman/issue0126.d.ref @@ -0,0 +1,7 @@ +unittest +{ + try + doStuff(); + catch (Exception ex) + complain(ex.msg); +} diff --git a/tests/issue0126.d b/tests/issue0126.d new file mode 100644 index 0000000..5f3896d --- /dev/null +++ b/tests/issue0126.d @@ -0,0 +1,7 @@ +unittest +{ + try + doStuff(); + catch (Exception ex) + complain(ex.msg); +} diff --git a/tests/otbs/issue0126.d.ref b/tests/otbs/issue0126.d.ref new file mode 100644 index 0000000..a79c876 --- /dev/null +++ b/tests/otbs/issue0126.d.ref @@ -0,0 +1,6 @@ +unittest { + try + doStuff(); + catch (Exception ex) + complain(ex.msg); +}