From 7c791f130c168e2b4eab699ec04983d3f7aab438 Mon Sep 17 00:00:00 2001 From: Ivan Tham Date: Sat, 16 May 2020 21:08:11 +0800 Subject: Handle dedent in rust syntax Naively handle dedent after , and ; which works most of the cases but does not work with multi level dedent. --- test/indent/rust/dedent/cmd | 1 + test/indent/rust/dedent/in | 12 ++++++++++++ test/indent/rust/dedent/out | 16 ++++++++++++++++ test/indent/rust/dedent/rc | 3 +++ 4 files changed, 32 insertions(+) create mode 100644 test/indent/rust/dedent/cmd create mode 100644 test/indent/rust/dedent/in create mode 100644 test/indent/rust/dedent/out create mode 100644 test/indent/rust/dedent/rc (limited to 'test') diff --git a/test/indent/rust/dedent/cmd b/test/indent/rust/dedent/cmd new file mode 100644 index 00000000..8682d51e --- /dev/null +++ b/test/indent/rust/dedent/cmd @@ -0,0 +1 @@ +cbar diff --git a/test/indent/rust/dedent/in b/test/indent/rust/dedent/in new file mode 100644 index 00000000..85e605c1 --- /dev/null +++ b/test/indent/rust/dedent/in @@ -0,0 +1,12 @@ + foo();%( ) + + foo( + bar().baz(),%( ) + + foo( + bar() + .baz(),%( ) + + foo() + .bar() + .baz();%( ) diff --git a/test/indent/rust/dedent/out b/test/indent/rust/dedent/out new file mode 100644 index 00000000..f4bc0a07 --- /dev/null +++ b/test/indent/rust/dedent/out @@ -0,0 +1,16 @@ + foo(); + bar + + foo( + bar().baz(), + bar + + foo( + bar() + .baz(), + bar + + foo() + .bar() + .baz(); + bar diff --git a/test/indent/rust/dedent/rc b/test/indent/rust/dedent/rc new file mode 100644 index 00000000..64064c25 --- /dev/null +++ b/test/indent/rust/dedent/rc @@ -0,0 +1,3 @@ +source "%val{runtime}/colors/default.kak" +source "%val{runtime}/rc/filetype/rust.kak" +set buffer filetype rust -- cgit v1.2.3 From dd3257e3f2d2a2dec759b2d2b530ff4dc5444a64 Mon Sep 17 00:00:00 2001 From: Ivan Tham Date: Sun, 24 May 2020 11:20:24 +0800 Subject: Rust take indentation before comment to next line --- test/indent/rust/comment/cmd | 1 + test/indent/rust/comment/in | 8 ++++++++ test/indent/rust/comment/out | 11 +++++++++++ test/indent/rust/comment/rc | 3 +++ 4 files changed, 23 insertions(+) create mode 100644 test/indent/rust/comment/cmd create mode 100644 test/indent/rust/comment/in create mode 100644 test/indent/rust/comment/out create mode 100644 test/indent/rust/comment/rc (limited to 'test') diff --git a/test/indent/rust/comment/cmd b/test/indent/rust/comment/cmd new file mode 100644 index 00000000..8682d51e --- /dev/null +++ b/test/indent/rust/comment/cmd @@ -0,0 +1 @@ +cbar diff --git a/test/indent/rust/comment/in b/test/indent/rust/comment/in new file mode 100644 index 00000000..bb887d68 --- /dev/null +++ b/test/indent/rust/comment/in @@ -0,0 +1,8 @@ + // foo%( ) + + //! foo%( ) + + /// foo%( ) + + println!("hello world"); // foo%( ) + diff --git a/test/indent/rust/comment/out b/test/indent/rust/comment/out new file mode 100644 index 00000000..813ec7f2 --- /dev/null +++ b/test/indent/rust/comment/out @@ -0,0 +1,11 @@ + // foo + // bar + + //! foo + //! bar + + /// foo + /// bar + + println!("hello world"); // foo + bar diff --git a/test/indent/rust/comment/rc b/test/indent/rust/comment/rc new file mode 100644 index 00000000..64064c25 --- /dev/null +++ b/test/indent/rust/comment/rc @@ -0,0 +1,3 @@ +source "%val{runtime}/colors/default.kak" +source "%val{runtime}/rc/filetype/rust.kak" +set buffer filetype rust -- cgit v1.2.3 From de4b7f3864844aad133b3170cc01780a8aefd9a4 Mon Sep 17 00:00:00 2001 From: Ivan Tham Date: Sun, 31 May 2020 11:10:11 +0800 Subject: Rust indent block comment --- test/indent/rust/comment/in | 4 ++++ test/indent/rust/comment/out | 7 +++++++ test/indent/rust/dedent/in | 4 ++++ test/indent/rust/dedent/out | 5 +++++ 4 files changed, 20 insertions(+) (limited to 'test') diff --git a/test/indent/rust/comment/in b/test/indent/rust/comment/in index bb887d68..d546e66a 100644 --- a/test/indent/rust/comment/in +++ b/test/indent/rust/comment/in @@ -2,7 +2,11 @@ //! foo%( ) + //!! foo%( ) + /// foo%( ) + //// foo%( ) + println!("hello world"); // foo%( ) diff --git a/test/indent/rust/comment/out b/test/indent/rust/comment/out index 813ec7f2..6b57b5ef 100644 --- a/test/indent/rust/comment/out +++ b/test/indent/rust/comment/out @@ -4,8 +4,15 @@ //! foo //! bar + //!! foo + //!! bar + /// foo /// bar + //// foo + //// bar + println!("hello world"); // foo bar + diff --git a/test/indent/rust/dedent/in b/test/indent/rust/dedent/in index 85e605c1..21c5f6ef 100644 --- a/test/indent/rust/dedent/in +++ b/test/indent/rust/dedent/in @@ -10,3 +10,7 @@ foo() .bar() .baz();%( ) + + let t = "a + wah";%( ) + diff --git a/test/indent/rust/dedent/out b/test/indent/rust/dedent/out index f4bc0a07..cea4d1d3 100644 --- a/test/indent/rust/dedent/out +++ b/test/indent/rust/dedent/out @@ -14,3 +14,8 @@ .bar() .baz(); bar + + let t = "a + wah"; + bar + -- cgit v1.2.3 From b1beea86381ae61a2e286a28901b0b563c15ee15 Mon Sep 17 00:00:00 2001 From: Ivan Tham Date: Sun, 31 May 2020 18:13:04 +0800 Subject: Rust indent after standalone where --- test/indent/rust/after-where/cmd | 1 + test/indent/rust/after-where/in | 5 +++++ test/indent/rust/after-where/out | 7 +++++++ test/indent/rust/after-where/rc | 3 +++ 4 files changed, 16 insertions(+) create mode 100644 test/indent/rust/after-where/cmd create mode 100644 test/indent/rust/after-where/in create mode 100644 test/indent/rust/after-where/out create mode 100644 test/indent/rust/after-where/rc (limited to 'test') diff --git a/test/indent/rust/after-where/cmd b/test/indent/rust/after-where/cmd new file mode 100644 index 00000000..8682d51e --- /dev/null +++ b/test/indent/rust/after-where/cmd @@ -0,0 +1 @@ +cbar diff --git a/test/indent/rust/after-where/in b/test/indent/rust/after-where/in new file mode 100644 index 00000000..412f13d3 --- /dev/null +++ b/test/indent/rust/after-where/in @@ -0,0 +1,5 @@ + impl X for T where%( ) + + impl X for T + where%( ) + diff --git a/test/indent/rust/after-where/out b/test/indent/rust/after-where/out new file mode 100644 index 00000000..3cc8383e --- /dev/null +++ b/test/indent/rust/after-where/out @@ -0,0 +1,7 @@ + impl X for T where + bar + + impl X for T + where + bar + diff --git a/test/indent/rust/after-where/rc b/test/indent/rust/after-where/rc new file mode 100644 index 00000000..64064c25 --- /dev/null +++ b/test/indent/rust/after-where/rc @@ -0,0 +1,3 @@ +source "%val{runtime}/colors/default.kak" +source "%val{runtime}/rc/filetype/rust.kak" +set buffer filetype rust -- cgit v1.2.3 From 12cafe3ed4dbc6d16fb7e54d07d6941985631942 Mon Sep 17 00:00:00 2001 From: Ivan Tham Date: Sun, 31 May 2020 19:19:09 +0800 Subject: Rust dedent { after where clause --- test/indent/rust/on-open-paren/cmd | 1 + test/indent/rust/on-open-paren/in | 35 +++++++++++++++++++++++++++++++++++ test/indent/rust/on-open-paren/out | 35 +++++++++++++++++++++++++++++++++++ test/indent/rust/on-open-paren/rc | 3 +++ 4 files changed, 74 insertions(+) create mode 100644 test/indent/rust/on-open-paren/cmd create mode 100644 test/indent/rust/on-open-paren/in create mode 100644 test/indent/rust/on-open-paren/out create mode 100644 test/indent/rust/on-open-paren/rc (limited to 'test') diff --git a/test/indent/rust/on-open-paren/cmd b/test/indent/rust/on-open-paren/cmd new file mode 100644 index 00000000..723e4fa3 --- /dev/null +++ b/test/indent/rust/on-open-paren/cmd @@ -0,0 +1 @@ +c{ diff --git a/test/indent/rust/on-open-paren/in b/test/indent/rust/on-open-paren/in new file mode 100644 index 00000000..1ca71d62 --- /dev/null +++ b/test/indent/rust/on-open-paren/in @@ -0,0 +1,35 @@ + fn foo(x: T) + where + T: Debug + %( ) + + fn foo(x: T) where T: Debug %( ) + + impl X for T + where + T: Debug + %( ) + + impl X for T where T: Debug %( ) + + struct X + where + T: Debug + %( ) + + struct X where T: Debug %( ) + + enum X + where + T: Debug + %( ) + + enum X where T: Debug %( ) + + union X + where + T: Debug + %( ) + + union X where T: Debug %( ) + diff --git a/test/indent/rust/on-open-paren/out b/test/indent/rust/on-open-paren/out new file mode 100644 index 00000000..de125ea7 --- /dev/null +++ b/test/indent/rust/on-open-paren/out @@ -0,0 +1,35 @@ + fn foo(x: T) + where + T: Debug + { + + fn foo(x: T) where T: Debug { + + impl X for T + where + T: Debug + { + + impl X for T where T: Debug { + + struct X + where + T: Debug + { + + struct X where T: Debug { + + enum X + where + T: Debug + { + + enum X where T: Debug { + + union X + where + T: Debug + { + + union X where T: Debug { + diff --git a/test/indent/rust/on-open-paren/rc b/test/indent/rust/on-open-paren/rc new file mode 100644 index 00000000..64064c25 --- /dev/null +++ b/test/indent/rust/on-open-paren/rc @@ -0,0 +1,3 @@ +source "%val{runtime}/colors/default.kak" +source "%val{runtime}/rc/filetype/rust.kak" +set buffer filetype rust -- cgit v1.2.3