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

Page wont load after formatting template file with VS Code. #148

Closed
dth292 opened this issue Nov 29, 2022 · 1 comment
Closed

Page wont load after formatting template file with VS Code. #148

dth292 opened this issue Nov 29, 2022 · 1 comment

Comments

@dth292
Copy link
Contributor

dth292 commented Nov 29, 2022

I have to turn off VS code formatting to edit the template file.
You can take a look a the file by VS code default formatter.
pwd_template_after_formatted_by_VSCode.zip

@robinmoisson
Copy link
Owner

robinmoisson commented Nov 30, 2022

Thanks for reporting. This makes sense - the password template is a template file and the templating style isn't standard, it's just replacing {special_key} with some specific text. This means the password_template.html file isn't meant to be valid html (before replacement) and contains invalid javascript, so when VS code or any IDE tries to "fix it" it risks messing things up.

The official recommendation is to not run automatic code formatting on the password template (or to fix it manually afterwards each time).

That being said, I made a patch that makes the templating engine a little more flexible - in your example the breaking change was just VS code adding spaces between brackets { special_key }. With this patch your example file now works, but please consider it unofficial behavior.


If there are standard ways of telling auto formatters to ignore a chunk of code I could be open to adding those around the relevant parts, but I guess there will be different for different tools (prettier, vs code, webstorm...) so I don't know if that would really work. Let me know if you have suggestions there.

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