Resolve Javascript Modules
This plugin for Sublime Text 3 adds completions for es modules, import file paths and browser api's.
Details
Installs
- Total 1K
- Win 693
- Mac 144
- Linux 197
Jul 26 | Jul 25 | Jul 24 | Jul 23 | Jul 22 | Jul 21 | Jul 20 | Jul 19 | Jul 18 | Jul 17 | Jul 16 | Jul 15 | Jul 14 | Jul 13 | Jul 12 | Jul 11 | Jul 10 | Jul 9 | Jul 8 | Jul 7 | Jul 6 | Jul 5 | Jul 4 | Jul 3 | Jul 2 | Jul 1 | Jun 30 | Jun 29 | Jun 28 | Jun 27 | Jun 26 | Jun 25 | Jun 24 | Jun 23 | Jun 22 | Jun 21 | Jun 20 | Jun 19 | Jun 18 | Jun 17 | Jun 16 | Jun 15 | Jun 14 | Jun 13 | Jun 12 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Windows | 1 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 1 | 1 | 0 | 0 | 1 | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Mac | 0 | 0 | 2 | 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 | 0 | 0 | 0 | 1 | 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 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 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.
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/