Skip to content

Commit

Permalink
Add basic stuff for Scala
Browse files Browse the repository at this point in the history
  • Loading branch information
mathieuancelin committed May 14, 2012
1 parent 1e68ba7 commit efd9025
Show file tree
Hide file tree
Showing 8 changed files with 66 additions and 0 deletions.
12 changes: 12 additions & 0 deletions bindform.sublime-snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<snippet>
<content><![CDATA[
${1:form}.bindFromRequest.fold (
formWithErrors => BadRequest( ${2:"You need to pass a 'xxx' value!"} ),
{ maybeValue =>
${3:Ok}
}
)
]]></content>
<tabTrigger>bindform</tabTrigger>
<scope>source.scala</scope>
</snippet>
7 changes: 7 additions & 0 deletions cacheget.sublime-snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<snippet>
<content><![CDATA[
val maybe: Option[${1:String}] = Cache.getAs[${1:String}]("${2:item.key}")
]]></content>
<tabTrigger>cacheget</tabTrigger>
<scope>source.scala</scope>
</snippet>
7 changes: 7 additions & 0 deletions cacheset.sublime-snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<snippet>
<content><![CDATA[
Cache.set("${1:item.key}", $2)
]]></content>
<tabTrigger>cacheset</tabTrigger>
<scope>source.scala</scope>
</snippet>
7 changes: 7 additions & 0 deletions form.sublime-snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<snippet>
<content><![CDATA[
val ${1:form} = Form( "${2:param1}" -> ${3:text} )
]]></content>
<tabTrigger>form</tabTrigger>
<scope>source.scala</scope>
</snippet>
7 changes: 7 additions & 0 deletions ok.sublime-snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<snippet>
<content><![CDATA[
Ok( views.html.${1:index}($2) )
]]></content>
<tabTrigger>ok</tabTrigger>
<scope>source.scala</scope>
</snippet>
7 changes: 7 additions & 0 deletions redirect.sublime-snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<snippet>
<content><![CDATA[
Redirect( routes.Application.${1:index()} )
]]></content>
<tabTrigger>redirect</tabTrigger>
<scope>source.scala</scope>
</snippet>
8 changes: 8 additions & 0 deletions sessionget.sublime-snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<snippet>
<content><![CDATA[
request.session.get("${1:key}")${2://}.map { $3 }.getOrElse { $4 }
]]></content>
<tabTrigger>sessionget</tabTrigger>
<scope>source.scala</scope>
</snippet>

11 changes: 11 additions & 0 deletions sessionset.sublime-snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<snippet>
<content><![CDATA[
Ok( views.html.${1:index}($2) ).withSession(
session + ("${3:key}" -> "${4:value}")
)
]]></content>
<tabTrigger>sessionset</tabTrigger>
<scope>source.scala</scope>
</snippet>


0 comments on commit efd9025

Please sign in to comment.