Here is a screenshot of the auto completion in action using the optional dependency, auto-complete-mode.
- Auto complete with js2-browser-externs
- Auto complete with js2-keywords
- Auto complete with js2-ecma-262-externs
Each of the above settings can be customized and are enabled by default.
- Partial support for completing properties
- Show function interface or initial value for object properties
- Support for external libraries
- Navigation commands to jump to variables, functions and object properties.
i.e. Given the following proprety reference:
placing the cursor on
baz and executing
M-. will take you straight to their respective
M-, will jump you back to where you were.
- Completion of variable and function names in current scope
- Popup documentation for variables and function names in buffer
Experimental yansippet integration
ac-js2-expand-function that will expand a function's
parameters bound to
C-c C-c. Expansion will only work if the cursor
is after the function.
Note: Navigation only works if the definition is in the same file.
Easiest way to get ac-js2 is to install it from MELPA. You may need this snippet
(add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/") t)
if you don't have it already to fetch packages from MELPA.
js2-mode as follows:
(add-hook 'js2-mode-hook 'ac-js2-mode)
Auto-complete is no longer a dependency however ac-js2 will use it if you have it installed. The main reason for this is to allow users to use their preferred completion front end.
- auto-complete (ELPA)
For those of you who prefer Company mode, support is on its way.
(setq ac-js2-evaluate-calls t)
ac-js2-evaluate-calls to t if you add any libraries.
(setq ac-js2-external-libraries '("full/path/to/a-library.js"))
variable and call
completion-at-point or if you have auto-complete
installed wait for the popup.
Note that any code you evaluate using Skewer may add completion candidates for the global object.