benjamincharity
6/28/2017 - 6:18 PM

Change the casing of a snippet variable.

Change the casing of a snippet variable.

# Component
# NOTE: The last line uppercases the first letter of the 2nd variable and stores it as the 3rd
# variable
snippet uic "Create a UI component" m
import {
  Component,
  Input,
  Output,
} from '@angular/core';

/**
 * ${1:This is...}
 *
 * @example
 * <ts-${2:foo}
 *              item="Value"
 * ></ts-$2>
 */
@Component({
  selector: 'ts-$2',
  templateUrl: './$2.component.html',
  styleUrls: ['./$2.component.scss'],
})
export class Ts$3Component {
  /**
   * TODO
   */
  /**
   * @Input() itemName: type = 'Value';
   */

}
`!p t[3] = t[2][:1].upper() + t[2][1:]`
endsnippet
# Module
# NOTE: The last line lowercases the first letter of the 1st variable and stores it as the 2nd
# variable
snippet uim "Create a UI module" m
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
/*
 *import {
 *  MdButtonModule,
 *} from '@angular/material';
 */

import { Ts${1:Foo}Component } from './$2.component';
export { Ts$1Component } from './$2.component';


@NgModule({
  imports: [
    CommonModule,
  ],
  exports: [
    Ts$1Component,
  ],
  declarations: [
    Ts$1Component,
  ],
})
export class Ts$1Module {}
`!p t[2] = t[1][:1].lower() + t[1][1:]`
endsnippet