From 0930f377febb0c433e457c2390e468662abd7523 Mon Sep 17 00:00:00 2001 From: DDM Date: Sun, 29 Jun 2025 17:42:16 +0100 Subject: [PATCH] Add elixir snippets to define functions with args The current snippets for defining functions don't have any tabstops in between the opening and closing parens () of a function definition, so if you want to define a function that has arguments, you won't be able to tab your way into writing them. The new snippets append an `a` to their respective "inspiration" snippets, to indicate that they'll have a tabstop for easy [a]rguments. --- snippets/elixir.json | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/snippets/elixir.json b/snippets/elixir.json index 7886f4a4..bc3ca406 100644 --- a/snippets/elixir.json +++ b/snippets/elixir.json @@ -9,16 +9,31 @@ "body": ["def ${1:name}() do", " $0", "end"], "description": "Define a function" }, + "defa": { + "prefix": "defa", + "body": ["def ${1:name}(${2:args}) do", " $0", "end"], + "description": "Define a function with arguments" + }, "defp": { "prefix": "defp", "body": ["defp ${1:name}() do", " $0", "end"], "description": "Define a private function" }, + "defpa": { + "prefix": "defpa", + "body": ["defp ${1:name}(${2:args}) do", " $0", "end"], + "description": "Define a private function with arguments" + }, "df": { "prefix": "df", "body": "def ${1:name}(), do: $0", "description": "Define a one-liner function" }, + "dfa": { + "prefix": "dfa", + "body": "def ${1:name}(${2:args}), do: $0", + "description": "Define a one-liner function with arguments" + }, "dfw": { "prefix": "dfw", "body": "def ${1:name}(${2:args}) when ${3:guard}, do: $0",