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

Comments within parentheses of an Annoation end up in wrong location #142

Closed
alan-morey opened this issue Nov 14, 2019 · 2 comments
Closed

Comments

@alan-morey
Copy link

alan-morey commented Nov 14, 2019

Input:

@IsTest(
  seeAllData = true // Reason this is required...
  //isParallel = false // Reason this is commented...
)
class MyTest {
    @IsTest
    static void testStuff() {
        System.assert(1 == 1);
    }
}

Actual output:

@IsTest(seeAllData=true) // Reason this is required...
class //isParallel = false // Reason this is commented...
MyTest {
  @IsTest
  static void testStuff() {
    System.assert(1 == 1);
  }
}

Expected output:

@IsTest(
  seeAllData = true // Reason this is required...
  //isParallel = false // Reason this is commented...
)
class MyTest {
    @IsTest
    static void testStuff() {
        System.assert(1 == 1);
    }
}

Additional information:

$ prettier --debug-check MyTest.cls
MyTest.cls[error] MyTest.cls: prettier(input) !== prettier(prettier(input))
[error] Index: 
[error] ===================================================================
[error] --- 
[error] +++ 
[error] @@ -1,5 +1,6 @@
[error] -@IsTest(seeAllData=true) // Reason this is required...
[error] -class //isParallel = false // Reason this is commented...
[error] -MyTest {
[error] +@IsTest(
[error] +  seeAllData=true
[error] +) // Reason this is required... //isParallel = false // Reason this is commented...
[error] +class MyTest {
[error]    @IsTest
[error]    static void testStuff() {
[error] 

If the input is changed to include an access modifier on the class the debug-check passes but comments are still in wrong location

Input:

@IsTest(
  seeAllData = true // Reason this is required...
  //isParallel = false // Reason this is commented...
)
private class MyTest {
    @IsTest
    static void testStuff() {
        System.assert(1 == 1);
    }
}

Actual output:

@IsTest(seeAllData=true) // Reason this is required...
//isParallel = false // Reason this is commented...
private class MyTest {
  @IsTest
  static void testStuff() {
    System.assert(1 == 1);
  }
}
$ prettier --debug-check MyTest.cls
MyTest.cls
Done in 3.17s.
  • OS: Ubuntu 16.04.6 LTS
  • Version: 1.0.0
@dangmai
Copy link
Owner

dangmai commented Nov 14, 2019

Thanks for the bug report, I agree that the current output is not ideal, I'll fix this soon.

@dangmai
Copy link
Owner

dangmai commented Nov 16, 2019

This is fixed in master and will be included in the next release. Thanks again for the bug report!

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

No branches or pull requests

2 participants