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 add redundant whitespaces #2705

Open
daniszam opened this issue Nov 13, 2023 · 1 comment
Open

Formatting add redundant whitespaces #2705

daniszam opened this issue Nov 13, 2023 · 1 comment

Comments

@daniszam
Copy link

I'm not sure if this can be considered a bug.

But my idea is to reformat the file after these changes.

I expected only an empty string between string a = 1; string b = 2;, but I actually got an empty string with two whitespaces.

 @Test
 public void should_format_file_without_empty_line_with_whitespaces() {
     // given
     var loader = new SchemaLoader(FileSystems.getDefault());
     var linker = new Linker(loader, new ErrorCollector(), true, true);
     var testFileLocation = Location.get("<TEST_PROTO_FILE>");
     loader.initRoots(List.of(testFileLocation), List.of(testFileLocation));
     var file = loader.load("test/file.proto");
     var schema = linker.link(List.of(file));

     // when
     var protoFile = schema.protoFile("test/file.proto");

     // then
     assertThat(protoFile.toSchema())
             .isEqualTo("""
                     // Proto schema formatted by Wire, do not edit.
                     // Source: test/file.proto
                                             
                     syntax = "proto3";
                                             
                     package test.dependency;
                                             
                     message TestMessage {
                       message NestedMessage {
                         string a = 1;
                    
                         string b = 2;
                       }
                     }
                     """);
 }
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