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
Jinja formatting issues #715
base: master
Are you sure you want to change the base?
Conversation
… whole of the file - Added code to handle extra spacing inside the double quotes, as well as ensure only single quotes - It also removes any extra white space based on teh word boundaries
…e quotes on the outside
✅ Deploy Preview for djlint ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Note: This forces double quotes on the outside and single quotes inside. |
…ach section and correctly modify the inner quotes - This will always prioritize what ever the user had set on the outer quotes and will only activate for jinja templates
Update: New code is stable, passes all tests, allows the linter to detect the outer most quotes and apply changes to the inner most to prevent vscode and syntax errors as well as handles spacing issues that can be caused by using the built in formatter in vscode and then using djlint |
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #715 +/- ##
==========================================
- Coverage 95.35% 93.67% -1.69%
==========================================
Files 16 16
Lines 1033 1059 +26
Branches 278 285 +7
==========================================
+ Hits 985 992 +7
- Misses 34 50 +16
- Partials 14 17 +3
☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this, I appreciate it. I put a few comments > if you don't want to invest more time you can leave as is and I can pick it up sometime.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, instead of changing the test here, can you just do 2 tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nunjucks is pretty much identical to jinja, and anyone else using quotes can benefit from this :) Do you mind to remove the the profile check?
aren't cases like this still going to confuse vs code?
The other odd case is where there is a line break:
I think if we move this down to where we do the set tag formatting, it will be able to work w/ wrapping.
At the same time it might be good to add a flag --single-quote-templatetags, vs a --single-quote tag we can add later on for just html attributes.
Thanks for starting this, if you don't wanna invest more time you can leave as is and I can pick it up sometime.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey sorry for the delay, yep I think this is the place- it is where the contents of functions are updated.
I'm free to discord call early afternoon today if it's good for you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feel free to add me on discord jlw_4049
so we can talk quicker
Sorry for the delay here. I updated the test case a bit, and added a more complex test. Can every see if they agree w/ this code:
|
✅ Deploy Preview for djlint canceled.
|
Pull Request Check List
Resolves: #issue-number-here