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

Improve formatting #162

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

Martmists-GH
Copy link

@Martmists-GH Martmists-GH commented Apr 4, 2023

Fixes #91

Ideally at some point there can be settings for how to handle formatting, but since I'm not familiar with IJ plugins I simply improved the existing behavior.

Note that while this does improve existing behavior when writing, the "Reformat Code" action may at some times behave strangely.

Signed-off-by: Martmists <martmists@gmail.com>
Signed-off-by: Martmists <martmists@gmail.com>
@Martmists-GH
Copy link
Author

In case this does not get merged, here's a precompiled version of this patch.

pebble-intellij.zip

@bjansen
Copy link
Owner

bjansen commented Apr 5, 2023

I'm writing unit tests to make sure I don't break everything as soon as I touch this class, and for some reason some parts of HTML files are not indented as expected.

Actual:

<html>
<body>
<div>
    <div>
    {{ hello }}
        <div>
            {{ hello }}
        </div>
    </div>
</div>
</body>
</html>

Expected:

<html>
<body>
<div>
    <div>
        {{ hello }}
        <div>
            {{ hello }}
        </div>
    </div>
</div>
</body>
</html>

I'm investigating the problem.

@Martmists-GH
Copy link
Author

I was running into this issue as well, hence why I mentioned auto-formatting does not always produce the expected outputs. In some cases, the blocks even seem to ignore the code based on how far indented they already are, and it's been very confusing overall.

In the end I decided this behavior was probably fine, as the original issue also mentioned uses for Markdown, where indents may not be desired behavior unless indicated by the original language, while in other cases (like HTML) it may be preferred to get indents regardless for the purpose of readability as it does not affect the contents.

Copy link

sonarcloud bot commented Feb 4, 2024

Quality Gate Passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

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

Successfully merging this pull request may close these issues.

Indentation in non-HTML documents
2 participants