Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for dynamic import operator to JavaScript mode #5259

Merged
merged 3 commits into from Feb 13, 2018
Merged

Add support for dynamic import operator to JavaScript mode #5259

merged 3 commits into from Feb 13, 2018

Conversation

tmcw
Copy link
Contributor

@tmcw tmcw commented Feb 12, 2018

Adds support for dynamic import syntax to the JavaScript mode. Currently this isn't handled, so, for instance, property access from dynamic imports - like

import('foo').then(() => {});

Highlights then as a variable, not a property.

This PR allows for dynamic imports at the top level by detecting (, and handles imports in expressions by just continuing to the expression mode when they're detected.

@adrianheine
Copy link
Contributor

dynamic import is stage 3, but I think that's okay for CodeMirror. Could you add a test?

@tmcw
Copy link
Contributor Author

tmcw commented Feb 12, 2018

👍 Test cases added.

@marijnh marijnh merged commit 5b8e5ab into codemirror:master Feb 13, 2018
@marijnh
Copy link
Member

marijnh commented Feb 13, 2018

Thanks!

@tmcw tmcw deleted the javascript-mode-dynamic-import branch February 13, 2018 16:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants