Skip to content

Releases: abo-abo/auto-yasnippet

auto-yasnippet 0.3.0

30 Apr 13:22
Compare
Choose a tag to compare

First tagged release.

New Functionality

aya-create will try to call aya-create-symbol - a new strategy for building snippets.

Example

Starting with this code:

printf("__INT32_TYPE__ %s (%d)\n", ESTR(__INT32_TYPE__), sizeof(__INT32_TYPE__));

Wrap INT32 (just the first one) in quotes like so:

printf("__`INT32'_TYPE__ %s (%d)\n", ESTR(__INT32_TYPE__), sizeof(__INT32_TYPE__));

Call aya-create to have the code revert to normal. The current snippet becomes "printf(\"__$1_TYPE__ %s (%d)\\n\", ESTR(__$1_TYPE__), sizeof(__$1_TYPE__));".

This is just one of the strategies. If not quotes are detected the old methods are tried as well.
Works on current line or region.

Expand to your heart's content:

#include <stdio.h>
#define ESTR(a) STR(a)
#define STR(a) #a

int main() {
  printf("__SIZE_TYPE__ %s (%d)\n", ESTR(__SIZE_TYPE__), sizeof(__SIZE_TYPE__));
  printf("__WCHAR_TYPE__ %s (%d)\n", ESTR(__WCHAR_TYPE__), sizeof(__WCHAR_TYPE__));
  printf("__WINT_TYPE__ %s (%d)\n", ESTR(__WINT_TYPE__), sizeof(__WINT_TYPE__));
  printf("__INT8_TYPE__ %s (%d)\n", ESTR(__INT8_TYPE__), sizeof(__INT8_TYPE__));
  printf("__INT16_TYPE__ %s (%d)\n", ESTR(__INT16_TYPE__), sizeof(__INT16_TYPE__));
  printf("__INT32_TYPE__ %s (%d)\n", ESTR(__INT32_TYPE__), sizeof(__INT32_TYPE__));
  printf("__INT64_TYPE__ %s (%d)\n", ESTR(__INT64_TYPE__), sizeof(__INT64_TYPE__));
  return 0;
}