Quantcast

clang-format and multiple javascript lambdas

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

clang-format and multiple javascript lambdas

rtjoijiihu
This post has NOT been accepted by the mailing list yet.
I have two test files:

test1.js:
    fetchData().then((data)=>{
        console.log('fetched', data);
    });

test2.js:
    fetchData().then((data)=>{
        console.log('fetched', data);
    }).then(()=>{
        console.log('finished');
    });


I run clang-format on them as follows:
    clang-format-5.0 -style="{ColumnLimit: 0}" testX.js


Formatted test1.js:
    fetchData().then((data) => {
      console.log('fetched', data);
    });

Formatted test2.js:
    fetchData().then((data) => {
                 console.log('fetched', data);
               })
        .then(() => {
          console.log('finished');
        });

(clang-format-3.8 produces the same output)


The way clang-format formats test2.js makes no sense, and as far as I can tell none of the style options fixes it, so I'd say this is a bug.
Loading...