JJLongoria / aura-helper

Repository for manage the development of Aura Helper VSCode Extension
GNU General Public License v3.0
9 stars 5 forks source link

Format issue when using the ".class" keyword in class #40

Closed fanch-ragon closed 2 years ago

fanch-ragon commented 2 years ago

Hello,

I noticed an issue lately, it seems whenever I have the ".class" keyword in a class, the formatting is not reacting well in the rest of the class after. See for instance this code example

public class TestClass {
    private static final String CLASS_NAME = Testclass.class.getName();
    public static void testMethod() {
        TAD.testMeth(CLASS_NAME);
        if (true) {
            String someVar = '1';
        }else {
            String someVar = '2';
        }
        if (false) {
            String someVar2 = 'A';
        }
        return rtrn;
    }
}

When I format it, it becomes :

public class TestClass {
    private static final String CLASS_NAME = Testclass.class.getName();
    public static void testMethod() {
        TAD.testMeth(CLASS_NAME);

        if (true) {
            String someVar = '1';
        }

         else {
            String someVar = '2';
        }

        if (false) {
            String someVar2 = 'A';
        }

        return rtrn;
    }
}

It's inserting extra line breaks that I'm not expecting given my setup. This is the result I expect (see here, I simply remove the ".class" reference in the line 2):

public class TestClass {
    private static final String CLASS_NAME = Testclass.getName();

    public static void testMethod() {
        TAD.testMeth(CLASS_NAME);
        if (true) {
            String someVar = '1';
        } else {
            String someVar = '2';
        }
        if (false) {
            String someVar2 = 'A';
        }
        return rtrn;
    }
}

For the record, my project setup is as following: { "aurahelper.apexFormat.classMembers.newLinesBetweenClassFields": 0, "aurahelper.apexFormat.classMembers.newLinesBetweenCodeBlockMembers": 1, "aurahelper.apexFormat.classMembers.newLinesBetweenGetterAndSetterAccessor": 1, "aurahelper.apexFormat.classMembers.singleLineProperties": true, "aurahelper.apexFormat.comment.holdAfterWhitespacesOnLineComment": true, "aurahelper.apexFormat.comment.holdBeforeWhitespacesOnLineComment": true, "aurahelper.apexFormat.comment.newLinesBewteenComments": 0, "aurahelper.apexFormat.operator.addWhitespaceAfterOpenParenthesisOperator": false, "aurahelper.apexFormat.operator.addWhitespaceAfterOperator": true, "aurahelper.apexFormat.operator.addWhitespaceBeforeCloseParenthesisOperator": false, "aurahelper.apexFormat.operator.addWhitespaceBeforeOperator": true, "aurahelper.apexFormat.punctuation.addNewLineAfterCloseCurlyBracket": false, "aurahelper.apexFormat.punctuation.addWhitespaceAfterCloseCurlyBracket": true, "aurahelper.apexFormat.punctuation.addWhiteSpaceAfterComma": true, "aurahelper.apexFormat.punctuation.addWhitespaceAfterOpenGuardParenthesis": false, "aurahelper.apexFormat.punctuation.addWhitespaceBeforeCloseGuardParenthesis": false, "aurahelper.apexFormat.punctuation.addWhitespaceBeforeOpenCurlyBracket": true, "aurahelper.apexFormat.punctuation.addWhitespaceBeforeOpenGuardParenthesis": true, "aurahelper.apexFormat.punctuation.addWhitespaceBeforeOpenTriggerEvents": true, "aurahelper.apexFormat.punctuation.maxBlankLines": 2, "aurahelper.apexFormat.punctuation.openCurlyBracketOnNewLine": false, "aurahelper.apexFormat.query.maxProjectionFieldPerLine": 0, "aurahelper.apexFormat.query.oneClausePerLine": false }

I hope this contribution can be helpful

JJLongoria commented 2 years ago

Hello @fanch-ragon

Thanks for report the issue, i work on it ASAP to publish a fix, I has an idea that was are wrong and isn't yout format config, but thanks for extra information, always are good.

Sorry for any problem caused by this bug and thanks for use Aura Helper and I Hope you enjoy it.

Best regards! Juan José Longoria

JJLongoria commented 2 years ago

Hi @fanch-ragon

I publish now the new Aura Helper v4.0.0 verion with your reported bug fixed an some interesting enhancements and other minor bugs fixed. I Improve the Aura Helper performance arround 60-70%, even 95% on some task like downlaod metadata types from org or Refresh all sobjects index (among others). Now this tasks take a few seconds :)

Enjoi it! Best Regards Juan José Longoria

fanch-ragon commented 2 years ago

Great @JJLongoria , it's working fine now. Thanks for your quick fix :)

Regards