Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Branch: master
Failed to load latest commit information.
README.md Fleshed out Scala live templates
user.xml Fleshed out Scala live templates

README.md

These are the Intellij Live Templates I like to use to make developing in Java, Scala and Clojure more fluid. Why spend your time/effort typing, when you could use it thinking about the problem at hand?

I've kept all my live templates to 2-3 chars for consciseness.

How to Use Them

  1. Open user.xml, copy out all of the nodes, out of the

  2. Go to ~/.IdeaC10/config/templates/user.xml (on Windows, the .Idea[xyz] folder is probably in your home directory, but I haven't checked. Also, it will have a slightly different name depending on version number, or whether you are using Community edition or Ultimate edition.

  3. To ~/.IdeaC10/config/templates/user.xml append my nodea to your node, and save.

  4. Enjoy the goodness.

  5. Clojure Templates

    d

     (def $NAME$ $EXPR$)
    

    pd

     (def ^{:private true} $NAME$ $EXPR$)
    

    f

     (defn $NAME$ [$ARGS$] $EXPR$)
    

    pf

     (defn- $NAME$ [$ARGS$] $EXPR$)
    

    fa

    (fact "$TITLE$"
      ($EXPR$) => $RESULT$)
    

    tf

     (tabular
       (fact "$TITLE$"
         ($EXPR$) => $RESULT$)
    
       $TABLE$)
    

    p

    (provided
      ($EXPR$) => $RESULT$)
    

    Java Templates

    gw

     given($MOCK_OBJECT$.$METHOD$($ARGS$)).willReturn($RETURN_VALUE$);
    

    sc

     public static class $CLASS_NAME$ {
         $CODE$
    }
    

    mk

     mock($CLASS_NAME$.class);
    

    el

     element("$NAME$", $BODY$)
    

    tst

     @Test
     public void $NAME$() {
         $TEST_CODE$
     }
    

    ae

     assertThat($ACTUAL$, equalTo($EXPECTED$));
    

    ane

     assertThat($ACTUAL$, not(equalTo($EXPECTED$)));
    

    an

     assertNull($ACTUAL$);
    

    as

     assertThat($EXPR$, hasSize($EXPECTED_SIZE$));
    

    Scala Templates

    tbl

    val testCases = new org.scalatest.prop.TableDrivenPropertyChecks.Table(
        ($TITLE_ROW$),
        ($ROW_1$),
        ($ROW_2$))
    
    forAll(testCases) { case ($TEST_CASE_DESTRUCTURING$) =>
        $TEST_EXPR$
    }
    

    tst

    test("$TITLE$") {
        $TEST_CODE$
    }
    

    sb

    should be ($EXPECTED$)
    

    snb

     should not be ($EXPECTED$)
    

Something went wrong with that request. Please try again.