https://bugs.llvm.org/show_bug.cgi?id=39872

            Bug ID: 39872
           Summary: JavaScript imports not grouped unless out of order
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Formatter
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected]

When JS imports are out of order and have no grouping, they are put in the
correct order and empty lines are added in between external, different folder,
and same folder groups. However, when they are in the right order but have no
empty lines for grouping, no empty lines are added.

For example:

import {c} from './c';
import {a} from 'a';
import {b} from '../b';

becomes

import {a} from 'a';

import {b} from '../b';

import {c} from './c';

but

import {a} from 'a';
import {b} from '../b';
import {c} from './c';

doesn't change.

It seems like clang-format should format imports the same way regardless of how
the programmer decided to do it. This also is causing problems for certain
people using clang-format in combination with TypeScript's Organize Imports.

I wonder if this line
(https://github.com/llvm-mirror/clang/blob/f3b7928366f63b51ffc97e74f8afcff497c57e8d/lib/Format/SortJavaScriptImports.cpp#L169)
could just be removed.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to