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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Black formatter breaks python code when it contains Emoji #411

Closed
pktiuk opened this issue Jan 15, 2024 · 2 comments
Closed

[BUG] Black formatter breaks python code when it contains Emoji #411

pktiuk opened this issue Jan 15, 2024 · 2 comments
Labels
triage-needed Issue is not triaged.

Comments

@pktiuk
Copy link

pktiuk commented Jan 15, 2024

Problem description

I have a Python code:

def fun():
    print("馃帴 Input Stream will be streamed. Address: rtsp://IP_ADDRESS:8557/input_stream")

When I format it using black 23.12.1 I get:

def fun():
    print(
        "馃帴 Input Stream will be streamed. Address: rtsp://IP_ADDRESS:8557/input_stream"
    )

But When I format it with this addon I get:

def fun():
    print(
        "馃帴 Input Stream will be streamed. Address: rtsp://IP_ADDRESS:8557/input_stream
    ")

Which is invalid code.

Configuration

2024-01-15 10:45:13.705 [info] Settings used to run Server:
[
    {
        "cwd": "/home/pkotiuk/Projects/eyeq",
        "workspace": "file:///home/pawel/proj1",
        "args": [],
        "path": [],
        "interpreter": [
            "/usr/bin/python3"
        ],
        "importStrategy": "useBundled",
        "showNotifications": "off"
    }
]

2024-01-15 10:45:13.970 [info] Version info for formatter running for /home/pawel/proj1:
black, 23.10.1 (compiled: no)
Python (CPython) 3.10.12
@github-actions github-actions bot added the triage-needed Issue is not triaged. label Jan 15, 2024
@pktiuk
Copy link
Author

pktiuk commented Jan 15, 2024

I guess you should update your black version

@karthiknadig
Copy link
Member

Duplicate of #395

This is fixed in pre-release. Nothing to do with Black formatter itself. More to do with VS code uses UTF-16 when calculating string lengths in the editor no matter which encoding is used for the file itself. You can read the details in #395

@karthiknadig karthiknadig closed this as not planned Won't fix, can't repro, duplicate, stale Jan 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage-needed Issue is not triaged.
Projects
None yet
Development

No branches or pull requests

2 participants