The first lines are the regex to find and the last line are the replace expressions.
:(\s?)'(.*)'
[ | |
{ | |
"description": "Control+Click to Command+Click", | |
"manipulators": [ | |
{ | |
"from": { | |
"modifiers": { | |
"mandatory": [ | |
"control" | |
], |
def getCountryByUserId(id: Int): Future[Either[String, Country]] = { | |
val result = for { | |
user <- EitherT(getUser(id)) | |
city <- EitherT(getCity(user)) | |
country <- EitherT(getCountry(city)) | |
} yield { | |
country | |
} | |
result.value | |
} |
def getUser(id: Int): Future[Either[String, User]] = ??? | |
def getCity(user: User): Future[Either[String, City]] = ??? | |
def getCountry(city: City): Future[Either[String, Country]] = ??? | |
def getCountryByUserId(id: Int): Future[Either[String, Country]] = { | |
getUser(id) flatMap { | |
case Left(err) => Future.successful(Left(err)) | |
case Right(user) => | |
getCity(user) flatMap { | |
case Left(err) => Future.successful(Left(err)) |
def getCountryByUserId(id: Int): Future[Option[Country]] = { | |
val result = for { | |
user <- OptionT(getUser(id)) | |
city <- OptionT(getCity(user)) | |
country <- OptionT(getCountry(city)) | |
} yield { | |
country | |
} | |
result.value | |
} |
def getUser(id: Int): Future[Option[User]] = ??? | |
def getCity(user: User): Future[Option[City]] = ??? | |
def getCountry(city: City): Future[Option[Country]] = ??? | |
def getCountryByUserId(id: Int): Future[Option[Country]] = { | |
getUser(id) flatMap { | |
case None => Future.successful(None) | |
case Some(user) => | |
getCity(user) flatMap { | |
case None => Future.successful(None) |
def getUser(id: Int): Future[Option[User]] = ??? | |
getUser(10).map { | |
case None => println(“User not found”) | |
case Some(user) => println(s”User: $user”) | |
} |
def getUser(id: Int): Option[User] = ??? | |
getUser(10) match { | |
case None => println(“User not found”) | |
case Some(user) => println(s”User: $user”) | |
} |
(defun sort-import-group () | |
"This function basically sorts a comma separated list of strings but it's been | |
written to sort grouped imports in Scala. | |
Example: | |
`import org.temp.{ B, C, A }` | |
By selecting the grouped imported items (`B, C, A`) from the above code sample and run (M-x) `sort-group` | |
you'll get the following result: | |
`import org.temp.{ A, B, C }`" | |
(interactive) | |
(let* ((bounds (cons (region-beginning) (region-end))) |
;; global variables | |
(setq | |
inhibit-startup-screen t | |
create-lockfiles nil | |
make-backup-files nil | |
column-number-mode t | |
scroll-error-top-bottom t | |
show-paren-delay 0.5 | |
use-package-always-ensure t | |
sentence-end-double-space nil |