Comments (18)
I tested on my windows > using the output from stdout from djlint does make the "??":
It does seem to be from the default windows encoding for cmd.
And running click directly works:
So it must be something in the process of writing the temp file to reading it in djlint.
I popped open the temp file that stdin was using... it has the dreaded ??
So I followed the ?? upstream in djlint until I got to the stdin and realized that I was reading it as the systems encoding.. which on windows, is not utf8.
After setting it to read as utf8, and also changing windows shell to utf8, it works:
Do djlint needs to be updated to read stdin as utf8. Then djlint-vscode will need to be updated to spawn with utf8.
I'll do a new djlint release w/ this update soon.
from djlint-vscode.
@christopherpickering
I see that you have released an update that fixes this issue, cool. Can you please check if I need to make any changes to the extension on my end to fix this problem too. It's just that I don't use Windows so I can't test it.
from djlint-vscode.
Solution: djlint/djLint#243 (comment).
EDIT: This solution is bad. Update djLint to version 1.1.1 or higher to fix the issue.
from djlint-vscode.
Nah I work on Linux and MacOS, but my colleague are not. I've tired of seeing unformatted templates so :D
from djlint-vscode.
Perhaps this will help solve the issue. I'll do it today when I'm at home.
from djlint-vscode.
I published djlint 1.1.1, which seems to fix this ๐ No changes to djlint-vscode
from djlint-vscode.
Solution - update djLint to version 1.1.1 or higher.
from djlint-vscode.
Hey, guys! We've just checked the update on two machines, one with winduz 10 another with 11. In both cases everything works flawlessly. Thanks for your effort! Really appreciated.
from djlint-vscode.
Yikes it worked :D
Maybe it should be reflected in a README? so that no one ever asks this question again?
from djlint-vscode.
Thats windows for ya ๐คฃ
from djlint-vscode.
OK, after enabling utf-8
in winduz some other programs has stopped working as expected. So option was turned off again. So, running from command line works as expected, running through extension does not. Maybe we can tweak something on extension side?
Maybe we can add an option to do formatting inplace and ask editor for reload instead of asking it to replace the text in here?
https://github.com/monosans/djlint-vscode/blob/89073365e968effce95dffd99bbf2dc75d2bb579/src/extension.ts#L247
AFAIK some extensions do that, because I have formatting enabled on save, and when I save the file for some time I see file not being formatted, and then suddenly it changes and is resaved. Noticable when you have a lot of files to save at the same time.
from djlint-vscode.
I'll dust of my windows and take a look tomorrow as well. Do you have a small sample code? I'll try w/ ๅฟ
้
from the other issue otherwise.
from djlint-vscode.
{% extends 'base.html' %}
{% load i18n django_bootstrap5 %}
{% block content %}
<div class="col-4 offset-4 card">
<div class="card card-body">
<form method="post">
{% csrf_token %}
{% bootstrap_form form %}
<button class="btn btn-primary" type="submit">{% trans "ะั
ะพะด" %}</button>
</form>
</div>
</div>
{% endblock content %}
This one will do I guess notice the {% trans "ะั
ะพะด" %}
part.
from djlint-vscode.
AFAIK they use PowerShell as VSCode shell. Don't know what is encoding for this one.
The extension does not launch a shell, but launches Python directly.
from djlint-vscode.
Windows is being pretty persistent. The colorize library was also allowing windows to tweak the encoding.. so I need to do another update the djlint to ensure the output is passed to the printer as utf8.
I was able to get it to work in vscode, I'll test a bit more and see if anything needs to be pr'ed.
from djlint-vscode.
I published djlint 1.1.1, which seems to fix this No changes to djlint-vscode
Amazing! Thank you very much!
I will later write in README.md that djLint version 1.1.1 or higher is required to fix this issue.
from djlint-vscode.
No problem, thank you!
from djlint-vscode.
Nice!
from djlint-vscode.
Related Issues (20)
- Support pipx-installed djlint HOT 2
- Question about vscode "problems" tab HOT 16
- Problem on self closing tabs HOT 1
- Publish to Open VSX Registry
- Formatter is appending to file HOT 3
- Code duplicated when formatting Django HTML HOT 6
- Formatter not working when pyproject.toml not at project root HOT 7
- Configuration from pyproject.toml is being ignore in v2022.10.1 HOT 20
- Wrong HTML formatting? HOT 1
- Is it possible to autofix certain problems? HOT 2
- Is it possible to disable the extension for specific file types? HOT 3
- settings djlint.configuration relative paths HOT 6
- Ignore linting tags do not work HOT 1
- Extension tries to access clipboard HOT 8
- djLint is not installed for the current active Python interpreter. HOT 2
- Regular ENOENT when using in SSH Remote HOT 13
- v2023.8.10 locks up keyboard in vscode. HOT 7
- Buggy behaviour when commenting and uncommenting via Toggle Line Comment vscode shortcut in Django HTML. HOT 1
- djLint should not attempt to lint HTML files in non-Django projects HOT 2
- Formatting and Linting Not Working in VSCode Starting with Version 2024.5.0 HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from djlint-vscode.