JetBrains Fleet 1.40 Help

List of JavaScript postfix completion templates

This table summarizes the postfix completion templates that you can use with your JavaScript code.

Name

Description

Example. Before

Example. After

!

Wraps an expression in an if statement that checks that the expression doesn't value to null.

function m(arg) { if(isNaN(arg)!) { } }
function m(arg) { if(!isNaN(arg)) { } }

arg

Wraps an expression in a function call.

function m(id) { id.arg }
function m(id) { foo(id) }

await

Inserts an await before the value of an async function.

async function m() { fetch('/users.json').await }
async function m() { await fetch('/users.json') }

const

Introduces a const variable for an expression.

function m(id) { document.getElementById(id).const }
function m(id) { const el = document.getElementById(id); }

destruct

Introduces a destructuring pattern for an expression.

class Person { name; age; } new Person().destruct
class Person { name; age; } let {} = new Person();

destructAll

Introduces a destructuring pattern for all elements of an expression.

class Person { name; age; } new Person().destructAll
class Person { name; age; } let {age, name} = new Person();

dforof

Iterates over an object via its Symbol.iterator or over the values of an array using a destructuring pattern.

let arg = [{x: "string1"}, {x: "string2"}]; arg.dforof
let arg = [{x: "string1"}, {x: "string2"}]; for (let {x} of arg) { }

else

Wraps a boolean expression in an if statement that checks that the expression values to false.

function m(arg) { arg.else }
function m(arg) { if(!(arg)) { } }

fori

Iterates over the indices of an object.

let arg = ["string1", "string2"]; arg.fori
let arg = ["string1", "string2"]; for (let i = 0; i < arg.length; i++) { }

forin

Iterates over the keys of an object.

function m(arr) { arr.forin }
function m(arr) { for (var element in arr) { } }

forof

Iterates over an object via its Symbol.iterator or over the values of an array.

let arg = ["string1", "string2"]; arg.forof
let arg = ["string1", "string2"]; for (let obj of arg) { }

forr

Iterates over the indices of an object in the reverse order.

let arg = ["string1", "string2"]; arg.forr
let arg = ["string1", "string2"]; for (let i = arg.length - 1; i &gt;= 0; i--) { }

if

Wraps a boolean expression in an if block that checks the expression values to true.

function m(arg) { arg.if }
function m(arg) { if(arg) { } }

instanceof

Wraps an expression in an if block with an instanceof check.

function processData(data) { data.instanceof }
function processData(data) { if (data instanceof ) { } }

itin

Iterates over the keys of an object.

function m(arr) { arr.itin }
function m(arr) { for (var element in arr) { } }

let

Introduces a let variable for an expression.

function m(id) { document.getElementById(id).let }
function m(id) { let el = document.getElementById(id); }

log

Inserts a console.log call.

function m(id) { var el = document.getElementById(id); 'element: ' + el.log }
function m(id) { var el = document.getElementById(id); console.log('element: ' + el); }

not

Wraps an expression in an if statement that checks that the expression doesn't value to null.

function m(arg) { if(isNaN(arg).not) { } }
function m(arg) { if(!isNaN(arg)) { } }

notnull

Wraps current expression in a not-null checking statement

function m(arg) { arg.notnull }
function m(arg) { if(arg != null) { } }

null

Wraps an expression in an if statement that checks that the expression values to null.

function m(arg) { arg.null }
function m(arg) { if(arg == null) { } }

par

Wraps an expression in parentheses.

function m(arg) { if(arg == 1.par) { } }
function m(arg) { if((arg == 1)) { } }

return

Wraps an expression in a return statement.

function m() { "result".return }
function m() { return "result"; }

switch

Wraps an expression in a switch statement and generates case clauses when possible.

/** * @param {'header' | 'footer'} templateKind */ function getTemplate(templateKind) { templateKind.switch }
/** * @param {'header' | 'footer'} templateKind */ function getTemplate(templateKind) { switch (templateKind) { case 'header': break; case 'footer': break; } }

throw

Wraps an expression in a throw statement.

function m(arg) { if(arg == null) { new Error('arg null').throw } }
function m(arg) { if(arg == null) { throw new Error('arg null'); } }

typeof

Applies the typeof operator to an expression.

function m(arg) { var type = arg.typeof if (type == 'number') { } }
function m(arg) { var type = typeof arg if (type == 'number') { } }

typeofif

Wraps an expression in an if block with a typeof check.

function processData(data) { data.typeofif }
function processData(data) { if (typeof data === "") { } }

undef

Wraps an expression in an if statement that checks that the type of the expressions is not undefined.

function m(arg) { arg.undef }
function m(arg) { if(typeof arg !== "undefined") { } }

var

Introduces a var variable for an expression.

function m(id) { document.getElementById(id).var }
function m(id) { var el = document.getElementById(id); }
Last modified: 11 February 2024