Child pages
  • Surround with

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0

 
Surround with allows you surround selected items with and replace with new elements depending on context.

Several statements can be surrounded with

try / catch / finally

if / else

while

with

{ -> ... }.call()

Code Block
-- code before --
 a.foo()
 b.bar()

-- code after --
try {
 a.foo()
 b.bar()
} catch () {
}
Code Block
-- code before --
a.foo()
b.bar()

-- code after --
if () {
 a.foo()
 b.bar()
} else {
}
Code Block
-- code before --
a.foo()
b.bar()

-- code after --
while () {
 a.foo()
 b.bar()
}
Code Block
-- code before --
a.foo()
b.bar()

-- code after --
with () {
 a.foo()
 b.bar()
}
Code Block
-- code before --
a.foo()
b.bar()

-- code after --
{->
  a.foo()
  b.bar()
}.call()

Single statements can be surrounded with

brackets

if / else (for boolean)

while (for boolean)

with

type cast

Code Block
-- code before --
 a = 5

-- code after --
(a = 5)
Code Block
-- code before --
new Object() != null

-- code after --
if (new Object() != null) {
} else {
}
Code Block
-- code before --
true | false

-- code after --
while (true | false) {
}
Code Block
-- code before --
Class

-- code after --
with (Class) {
}
Code Block
-- code before --
foo

-- code after --
((Foo) foo)