ReSharper Web Help

ReSharper | Options | Code Editing | JavaScript | Context Actions

By selecting or clearing check boxes in this page, you can compile the list of available Context Actions. When you select a specific context action, you can read its description in the bottom of the page.

ReSharper provides the following context actions for JavaScript:

Name Description
Add braces Adds braces around if/else/for/do/while/with statement body
Add Xml Comment Reference Add xml comment reference to the file where the referenced symbol is declared
Add xml-doc comments Add xml-doc comments
Compute constant value Computes value of the current experssion and replace it (e.g. 1 + 1 replaced by 2)
Convert 'if' statement to ternary expression Works on 'if' statement that returns value or performs assignment inside each branch. It converts the statement to a ternary expression ('x ? a : b')
Convert object literal get-accessor to simple property Converts ECMAScript 5 get-accessor to simple property
Convert object literal property to accessors pair with backing field Converts object literal property to ECMAScript 5 accessors pair with backing field
Convert object literal property to get-accessor Converts object literal property to ECMAScript 5 get-accessor
Convert property assignment in constructors to accessor property definition with backing field Converts property assignment in constructors to accessor property definition via Object.defineProperty() call
Convert property assignment in constructors to data property definition Converts property assignment in constructors to data property definition via Object.defineProperty() call
Convert property assignment in constructors to get-accessor property definition Converts property assignment in constructors to get-accessor property definition via Object.defineProperty() call
Convert ternary expression to 'if' statement Converts ternary expression whose value is returned or assigned to an 'if' statement
Convert to dec Converts numeric literal from hexadecimal to decimal form
Convert to dec Converts numeric literal from octal to decimal form
Convert to hex Converts numeric literal from decimal to hexadecimal form
Convert to oct Converts numeric literal from decimal to octal form
Create From Usage Creates property, function, local variable or parameter from usage
Flip an operator arguments Flips left and right arguments for selected operator e.g. null == x to x == null.
Flip an relational expression Flips the current relational expression e.g. x > 1 to x < 1.
Introduce variable from expression statement Introduces variable from expression statement
Invert 'if' statement Inverts guard condition of an 'if' statement and swaps the branches' code accordingly
Invert logical expression Inverts logical expression
Invert relational operator and negate condition Replaces a conditional expression with an inverted negative, e.g. converts x > 1 to !(x <= 1).
Invert ternary condition Inverts condition and swaps branches of a ternary expression
Join string literals Concatenates two string literals into one
Merge nested 'if' statements Merges two nested 'if' statements to a single 'if' statement that checks conjunction of the original conditions.
Merge two 'if' statements Merges 'if' statement with nested 'if' statement in else branch with equal body to a single 'if' statement that checks disjunction of the original conditions.
Remove braces Removes unneccessary braces around one or more statements in the code
Remove redundant parenthesis Removes parenthesis in case they are redundant
Replace single-quoted string literal with double-quoted Replace single-quoted string literal with double-quoted and vice versa
Reverse assignment statement Reverses source and destination parts of an assignment statement.
Split 'if' with '&&'-condition into nested 'if'-statements Works on an 'if' statement, which condition is a conjunction ('&&') of two simpler conditions. It converts the 'if' statement into two nested 'if' statements.
Split 'if' with '||'-condition into assigment to temporary variable and two 'if'-statements Works on an 'if' statement, which condition is a disjunction ('||') of two simpler conditions. It converts the 'if' statement into an assignment to a temporary variable and an two 'if' statements.
Split into separate declarations Works on variable declaration statement that declares multiple variables. It splits such statement into multiple statements each declaring a single variable.
Split 'return' with '&&'-condition into guarding 'if' and 'return' Works on a 'return' statement, which condition is a conjunction ('&&') of two simpler conditions. It converts the 'return' statement into a guarding 'if' statement and a 'return'.
Split 'return' with '||'-condition into assigment to temporary variable, 'if'-statement and 'return' Works on an 'return' statement, which condition is a disjunction ('||') of two simpler conditions. It converts the 'return' statement into an assignment to a temporary variable, 'if' statement and 'return' statement.
Split variable declaration and assignment Moves variable initializer from declaration statement to separate assignment statement.

Note

ReSharper's settings are saved in settings layers that enable you to have different settings for different solutions as well as to share your settings with your team. To learn more, study the Managing and Sharing Options section.