# JavaScript Features #

What is hot

- Css code completion in JS string literals
- File references extended support
   - Add Reference Context action on unresolved symbol
   - Daemon analysis (path parts highlightings)
   - Import fix
   - File names completion

Navigation.

- Context-less (Go-To-Type, Go-To-Symbol, etc...)
   - Go to type (functions that we heuristically beleve to be object constructors)
      - Add JS type to Go-To-Type navigation popup
      - Function + starts with capital letter = Type
   - Go to symbol (all symbols)
      - JS symbols appear in the common Go-To-Symbol navigation popup
   - Go to file member
      - JS file members are properties that are defined  (or assigned a value) in the file
- Contextual (Navigate from here,  etc.)
   - Go to declaration/usages
   - Go to next/prev member
   - Go to containing declaration
   - Go to type members/inheritors/base type

Code Completion

- Frameworks
   - JQuery extend method support
- Code completion common parameters (used in all completion types):
   - include keywords
   - include all symbols
   - filter symbols by heuristics (inferred from symbol types + top level symbols heuristics)
      - show type members only (after dot)
      - show only global symbols (window properties and locals)
      - show 'constructor' functions only after new
   - include live template items
      - override corresponding keyword items
- Code Completion Types
   - Basic code completion
      - options are: keywords, all symbols, template items,
   - Smart code completion
      - options are: filter symbols, filter constructors after 'new'
   - Autopopup completion
      - on dot
         - options are: filter symbols
      - after new
         - options are: filter symbols, global symbols
      -  on identifier
         - options are: filter symbols, global symbols
- Completable Symbols
   - JS Symbols within js files
   - HTML and css symbols within js string literals

Code Inspections

- Syntax errors highlighting
- Resolve based errors highlighting (unresolved/ identifiers)
- Statically unreachable (dead) code
   - Empty statement ';'
- Unused symbols (labels, local variables, parameters)
- Duplicated declaration (scoped symbols, labels, literal object property)
   - Fix: Merge local declarations
- Duplicated case label
- Expression statement is not assignment or call
-  Inconsistent returns from function (some returns have a value but some don't)
   - Fix: Return value
- Value is returned not on all paths
   - Fix: Add return statement
- Return value in global scope
   - Fix: Remove value
- Inconsistent returns from function (some returns have a value but some don't)
- Variables and parameters control flow issues
- Usages of future reserved names
- Usage of 'this' in global context
- Statement is not terminated
   -  Fix: Terminate all statements (run code cleanup module)
- Inconsistent naming + Fix.
   - Local declarations
   - Inconsistent constructor calls
- Assignment to an undefined global variable in a function scope
   - Fix: Declare local variable
   - Fix: Add 'window' qualifier
- Redundant else branch
   - Fix: remove else branch
- Misuse of 'this' in an inner function scope (heuristic: inner and owner function access the same property of 'this')
   - Fix: declared local variable and use it instead
- Access to modified closure
   - Fix: wrap access to a self invoking function

Context Actions

- Basic (borrowed from C#)
   - Split declaration and assignment
   - Introduce variable
      - +Introduce variable QF when there is 'wrong expression' or 'unterminated statement' warning
   - Compute constant value
   - Concatenate strings
   - Convert foreach to for loop and back
   - Convert if to switch and back
   - Convert if to ternary and back
   - Invert if
   - Invert ternary
   - Join declaration and assignment
   - Merge nested if statements
   - Reverse assignment statements
   -  Split declarations list
   - Split if with && and ||
   - Split return with && and ||
   - De Morgan law
   - Line comment to block and back
   - Remove braces
   - Doc comments related.
      - Add doc comment
      - Add missing doc comment tags
- JS specific
   - Extract constructor function from literal object
   - Replace single quoted strings with double quoted
   - &nbsp;

Create From Usage

- Create local variable from usage
- Create parameter from usage
- Create local function from usage
- Create property from usage
   - Detect scope where symbol can be created (where the other properties of the type are declared? )
      - Scope 1: Fields initialized in a constructor
      - Scope 2: Properties of literal object

Refactorings

- Rename
   - Local symbols inline rename
   - Non-local symbols rename
      - Remove irrelevant groupings and add 'reference specific' in the 'references checking page'
- Safe Delete including 'folder safe delete'
- Introduce Variable
- Introduce Parameter
- Extract Methods
- Inline Method
- Change Signature

Code Cleanup

- Code formatter
   - Code formatting options page
   - Basic formatting (spaces, line feed, indentation)
   - Line wrapping
   - Decoration
   - Terminate statements
- Remove code redundancies

Typing assist

- Similar to C#: auto-braces, format on some symbols,etc

Comment Code

- Implemented

Rearrange Code

- Parameters
- Argument
- Statements
- Elements of Array and Object literals

Doc-comments

- JsDoc comments
- Xml doc-comments
   - Show type of function parameters in parameter info
   - Assign type to an annotated parameter (completion uses this type)
   - use <i><b>reference path="..."</b></i> annotations to reduce scope of visible symbols

Code Structure.

- Element
- Nested code structures when Js is used from html?

Live templates

- Live templates configuration (expression and statement context)
- JS specific templates + VS code snippets
- override keywords by templates in code completion
- Files templates
   - JQuery style scope

Configurable naming

- Naming options
- Naming inspection
- Naming suggestion
   - Names are suggested from:
      - corresponding parameter name
      - variable initializer
      - type of symbol

Generate

- Generate assignments of parameters of to fields.
- Generate access functions for fields (local variables).

Structured search and replace

- SSR environment and matchers
- SSR based analyzes