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

Javascript formatting when save with HTML extension active #18397

Open
1 task done
starweb-thomas opened this issue Sep 26, 2024 · 0 comments
Open
1 task done

Javascript formatting when save with HTML extension active #18397

starweb-thomas opened this issue Sep 26, 2024 · 0 comments
Labels
admin read Pending admin review defect [core label] triage Maintainer needs to classify the issue

Comments

@starweb-thomas
Copy link

Check for existing issues

  • Completed

Describe the bug / provide steps to reproduce it

If the line (including indentation nut excluding semicolon) exceeds 80 characters then it gets reformatted and the last argument in a function will get a trailing comma.
This messes up the code.

                img.dataset.srcset = img.dataset.srcset.replace("http:", "https:");

becomes

                img.dataset.srcset = img.dataset.srcset.replace(
                    "http:",
                    "https:",
                );

which creates a runtime error due to the trailing comma.

The solutions currently is to either rewrite the code so that the length of the line is below 80 characters or remove the HTML extension. That might be a temporary solution for code you write yourself. But for other code it will just mess things up and become a big blocker for using Zed.

Environment

Zed: v0.153.7 (Zed)
OS: macOS 15.0.0
Memory: 18 GiB
Architecture: aarch64

If applicable, add mockups / screenshots to help explain present your vision of the feature

No response

If applicable, attach your Zed.log file to this issue.

Zed.log
@starweb-thomas starweb-thomas added admin read Pending admin review defect [core label] triage Maintainer needs to classify the issue labels Sep 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
admin read Pending admin review defect [core label] triage Maintainer needs to classify the issue
Projects
None yet
Development

No branches or pull requests

1 participant