angular / clang-format

Node repackaging of the clang-format native binary
Apache License 2.0
98 stars 32 forks source link

Incorrect formatting of class extends expression #34

Open jbms opened 8 years ago

jbms commented 8 years ago

clang-format does not handle class definitions where the extends clause is an expression more complicated than a sequence of dot-separated identifiers:

Expected output:

function identity<T>(x: T) {
  return x;
}
class A {};
class B extends (A) {};
class C extends identity(A) {};

Actual output:

function identity<T>(x: T) {
  return x;
}
class A {};
class B extends
(A){};
class C extends identity
(A){};
valdrinkoshi commented 6 years ago

Any update on this issue? I confirm this is still an issue, e.g. trying to use mixins like this

const MyMixin = (BaseClass) => class extends BaseClass {};
class MyClass extends MyMixin(HTMLElement) {}

results in this output:

const MyMixin = (BaseClass) => class extends BaseClass {};
class MyClass extends MyMixin
(HTMLElement) {
}