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

Formatting incorrectly handles JS allman coding styles #2687

Open
phosmium opened this issue Feb 16, 2025 · 3 comments
Open

Formatting incorrectly handles JS allman coding styles #2687

phosmium opened this issue Feb 16, 2025 · 3 comments
Labels

Comments

@phosmium
Copy link

Describe the bug

When working with "svelte" extension, brace formatting is not allowing one to use allman style. It works just fine on "typescript" itself. It works on the upper if-clauses, but not if they're nested.

Image

Reproduction

try to write nested if-clauses in allman style

Expected behaviour

It should indent just fine.

System Info

  • OS: Windows
  • IDE: VSCode, Cursor

Which package is the issue about?

No response

Additional Information, eg. Screenshots

No response

@phosmium phosmium added the bug Something isn't working label Feb 16, 2025
@jasonlyu123
Copy link
Member

jasonlyu123 commented Feb 16, 2025

The svelte language server doesn't support on-type format, so it's definitely not formatting that caused the indent change. It's more likely to be an issue with VSCode itself. Besides, the same problem also exists in HTML files. It might be we need to tweak some TextMate indentation rules to make it work. But the TextMate language configuration is mostly regex-based, so it can be quite limited and not really possible to make everyone happy.

Supporting on-type format doesn't help either, Since we rely on Prettier for the formatting but Prettier doesn't have a configuration to format it this way. So I think we won't be able to fix it, at least not anytime soon.

@jasonlyu123 jasonlyu123 added upstream and removed bug Something isn't working labels Feb 16, 2025
@jasonlyu123
Copy link
Member

This is also likely to be caused by the same problem as #1607

@phosmium
Copy link
Author

@jasonlyu123 -- yea seems like you're right. was able to workaround it for now with:

    "[svelte]": {
        "editor.autoIndent": "advanced"
    },

didn't notice any other issues yet since then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants