ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

Resolve Javascript Modules

by Thomas Welter ST3

This plugin for Sublime Text 3 adds completions for es modules, import file paths and browser api's.

Details

Installs

  • Total 889
  • Win 590
  • Mac 128
  • Linux 171
Sep 30 Sep 29 Sep 28 Sep 27 Sep 26 Sep 25 Sep 24 Sep 23 Sep 22 Sep 21 Sep 20 Sep 19 Sep 18 Sep 17 Sep 16 Sep 15 Sep 14 Sep 13 Sep 12 Sep 11 Sep 10 Sep 9 Sep 8 Sep 7 Sep 6 Sep 5 Sep 4 Sep 3 Sep 2 Sep 1 Aug 31 Aug 30 Aug 29 Aug 28 Aug 27 Aug 26 Aug 25 Aug 24 Aug 23 Aug 22 Aug 21 Aug 20 Aug 19 Aug 18 Aug 17 Aug 16
Windows 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 1
Mac 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Linux 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 1 0 0 1 0 1 0 0 1 0

Readme

Source
raw.​githubusercontent.​com

Resolve JS Modules

This plugin for Sublime Text 3 adds completions for es modules, import file paths and browser api's.

Auto complete module exports

Auto complete file paths

Auto complete browser api's

How to use

use relative imports: import * as xyz from './relative/path.js' the import path is checked when writing xyz., if the file does not exist or could not be parsed the path is underlined. You can remove any error by fixing the problems and requesting the object again.

How it works

The imports are parsed from the beginning of the file, it looks at wildcard imports of the form import * as xyz from './relative/path.js'. Then the module is parsed using a python port of esprima and cached for later use. The implementation is fully written in python without external dependencies.

Why

There are other plugins available but I find that they have performance problems and bugs. This plugin focuses on performance and javascript specific functionality.

Regenerating browser completions

Open get_browser_completions.html in a browser and copy the console.log to a file browser_completions.json. You can also change the file contents to {} to disable browser completions or add your own there.

limitations

  • nested objects are not completed fully
  • re-exports are ignored
  • parsing is done on the main thread (but is cached)
  • only supports relative paths for imports

esprima

esprima python port is found at: https://github.com/Kronuz/esprima-python esprima itself is found at: https://esprima.org/