Constructor
new IndentAction(node, options)
    Create an IndentAction
- Source:
 
Parameters:
| Name | Type | Description | ||||||
|---|---|---|---|---|---|---|---|---|
node | 
            
            
            
                
T
            
             | 
            
            
            |||||||
options | 
            
            
            
                
IndentOptions
            
             | 
            
            
            
                
                
                    
  | 
        
Extends
Members
Methods
addIndentToCode(code, indent) → {string}
    Add indent to code.
- Overrides:
 - Source:
 
Parameters:
| Name | Type | Description | 
|---|---|---|
code | 
            
            
            
                
string
            
             | 
            
            
            code to add indent | 
indent | 
            
            
            
                
number
            
             | 
            
            
            indent level | 
Returns:
- Type:
 - 
        
string 
    - code with indent
    
(protected) calculatePositions()
    Calculate the begin and end positions.
- Source:
 
(protected) removeComma()
    Remove unused comma.
e.g. `foobar(foo, bar)`, if we remove `foo`, the comma should also be removed,
the code should be changed to `foobar(bar)`.
- Overrides:
 - Source:
 
(protected) removeSpace()
    Remove unused space.
e.g. `
foobar
`, if we remove `foo='bar`, the space should also be removed,
the code should be changed to `foobar
`.
- Overrides:
 - Source:
 
rewrittenSource() → {string}
    Get the new source code after evaluating the node.
- Overrides:
 - Source:
 
Returns:
- Type:
 - 
        
string 
    The new source code.
    
Example
this.node = ts.createSourceFile("code.ts", "foo.substring(1, 2)")
this.code = "{{expression.name}}"
rewrittenSource() // substring
// node array
const node = ts.createSourceFile("code.ts", "foo.substring(1, 2)")
rewrittenSource(node, "{{expression.expression.expression}}.slice({{expression.arguments}})") // foo.slice(1, 2)
// index for node array
const node = ts.createSourceFile("code.ts", "foo.substring(1, 2)")
rewrittenSource(node, "{{expression.arguments.1}}") // 2
// {name}Property for node who has properties
const node = ts.createSourceFile("code.ts", "const foobar = { foo: 'foo', bar: 'bar' }")
rewritten_source(node, '{{declarationList.declarations.0.initializer.fooProperty}}')) # foo: 'foo'
// {name}Initializer for node who has properties
const node = ts.createSourceFile("code.ts", "const foobar = { foo: 'foo', bar: 'bar' }")
rewritten_source(node, '{{declarationList.declarations.0.initializer.fooInitializer}}')) # 'foo'
(protected) source()
    Get the source code of this node.
- Overrides:
 - Source:
 
Returns:
    source code of this node.
    
(protected) squeezeLines()
    Squeeze empty lines from source code.
- Overrides:
 - Source:
 
(protected) squeezeSpaces()
    Squeeze spaces from source code.
- Overrides:
 - Source: