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

Nested template literals indent strangely #520

Open
lambdadog opened this issue Mar 8, 2019 · 3 comments
Open

Nested template literals indent strangely #520

lambdadog opened this issue Mar 8, 2019 · 3 comments

Comments

@lambdadog
Copy link

Noticed some strange behavior with indentation when nesting template literals. I imagine this is because inbuilt parsing is used to detect when inside strings for indentation, and this is causing it to understand the inside of the second template literal as the end of the first one and so on

test_fun(test`
this works
${test`
	 this doesn't
	 ${test`
this does again
`}`}`);
@lambdadog lambdadog changed the title Nested template literals behave strangely Nested template literals indent strangely Mar 8, 2019
@dgutov
Copy link
Collaborator

dgutov commented Mar 9, 2019

True. But please see the second item here: https://github.com/mooz/js2-mode#bugs

@lambdadog
Copy link
Author

lambdadog commented Mar 10, 2019

@dgutov do template literals fall under the scope of js-mode though? i wasn't aware js-mode was intended to support es6 features

The current features that are supporting template literals in js-mode are just supporting "multiline strings" (and accordingly, in js-mode the interpolated code is just highlighted as another part of the string) which is why i chose to open the issue here instead

@dgutov
Copy link
Collaborator

dgutov commented Mar 10, 2019

That's a fair question. js-mode does support template literals to an extent, but maybe nested ones will give it some trouble.

We do rely on its indentation logic, though, so trying to support them there first would be natural.

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

No branches or pull requests

2 participants