1

Is it possible to create snippets for atom with variables in the prefix?

For example:

if I type: getPosts:: and tab, it should create something like this:

public static function getPosts(){

}

and put my cursor inside the function.

I allready tried

'.text.html.php':
  'create public static function':
    'prefix': '$1::'
    'body': 'public static function $1(){\n\t${2://code...}\n}'

but this does not work.

1
  • For what, Java? I think there are lots of plugins to do things like this, and some of it is built-in by default (I can think of some HTML examples), but Atom is for any number of languages so for it to generate code scaffolds like that for a particular language you'd probably need to customize it with a plugin. Commented Sep 29, 2016 at 14:56

1 Answer 1

0

I do not believe it is possible to have variables in an Atom snippet. Please see more here: Snippet Variables?

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.