From f4e8d3a4ffbdc984175461b724ab65aee66f2b73 Mon Sep 17 00:00:00 2001 From: Faustino Aguilar Date: Thu, 21 Sep 2017 21:00:02 -0500 Subject: [PATCH] Add crystal snippets - Add private def snippet - Add protected def snippet - Add delegate snippet --- snippets/crystal.json | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/snippets/crystal.json b/snippets/crystal.json index 65bd577..4968004 100644 --- a/snippets/crystal.json +++ b/snippets/crystal.json @@ -110,6 +110,24 @@ ], "description": "Constructor method for an Object." }, + "protected def": { + "prefix": "pro", + "body": [ + "protected def ${1:method_name}", + "\t$0", + "end" + ], + "description": "Protected method for an Object, can only be referenced inside the namespace where they are defined." + }, + "private def": { + "prefix": "pri", + "body": [ + "private def ${1:method_name}", + "\t$0", + "end" + ], + "description": "Private method for an Object, can only be invoked without a receiver." + }, "method definition": { "prefix": "def", "body": [ @@ -119,6 +137,13 @@ ], "description": "Method names begin with a lowercase letter and, as a convention, only use lowercase letters, underscores and numbers." }, + "delegate": { + "prefix": "del", + "body": [ + "delegate ${1:method}, to: ${2:@variable}" + ], + "description": "Delegate methods to to. This is only useful when no captured blocks are involved" + }, "Struct definition": { "prefix": "struct", "body": [