From db5f46439f4bbff39905f7774996779ade38a462 Mon Sep 17 00:00:00 2001 From: Georgios Samaras Date: Fri, 12 Feb 2016 22:00:40 +0100 Subject: [PATCH 1/2] Fixed `let`/`letm` snippet for Rust files. When expanding the `let` pattern, one would end up with something like "let I: I${4:type} = I;" (I representing the cursor jump marks), so the nested jump marks are inserted literally. I fixed that unwanted behaviour by replacing the `let` and `letm` patterns by `let` (for immutable variable bindings with type inference), `lett` (for immutable variable bindings with explicit type annotation), `letm` (for mutable variable bindings with type inference) and `lettm` (for mutable variable bindings with explicit type annotation). --- snippets/rust.snippets | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/snippets/rust.snippets b/snippets/rust.snippets index eeab689..bd0aafa 100644 --- a/snippets/rust.snippets +++ b/snippets/rust.snippets @@ -31,10 +31,14 @@ snippet main "Main function" pub fn main() { ${0} } -snippet let "let variable declaration" - let ${1:name}${2:: ${3:type}} = ${4}; -snippet letm "let mut variable declaration" - let mut ${1:name}${2:: ${3:type}} = ${4}; +snippet let "let variable declaration with type inference" + let ${1} = ${2}; +snippet lett "let variable declaration with explicit type annotation" + let ${1}: ${2} = ${2}; +snippet letm "let mut variable declaration with type inference" + let ${1} = ${2}; +snippet lettm "let mut variable declaration with explicit type annotation" + let ${1}: ${2} = ${2}; snippet pln "println!" println!("${1}"); snippet pln, "println! with format param" From 1ac7329ff6a9dce315ba1c3754675b36bbdf3b28 Mon Sep 17 00:00:00 2001 From: Georgios Samaras Date: Fri, 12 Feb 2016 22:09:12 +0100 Subject: [PATCH 2/2] Fixed typo in rust fix --- snippets/rust.snippets | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/snippets/rust.snippets b/snippets/rust.snippets index bd0aafa..3bc6904 100644 --- a/snippets/rust.snippets +++ b/snippets/rust.snippets @@ -34,11 +34,11 @@ snippet main "Main function" snippet let "let variable declaration with type inference" let ${1} = ${2}; snippet lett "let variable declaration with explicit type annotation" - let ${1}: ${2} = ${2}; + let ${1}: ${2} = ${3}; snippet letm "let mut variable declaration with type inference" let ${1} = ${2}; snippet lettm "let mut variable declaration with explicit type annotation" - let ${1}: ${2} = ${2}; + let ${1}: ${2} = ${3}; snippet pln "println!" println!("${1}"); snippet pln, "println! with format param"