vscode-mlir icon indicating copy to clipboard operation
vscode-mlir copied to clipboard

how to format/lint *.td/*.mlir files

Open gglin001 opened this issue 2 years ago • 2 comments

Hi, not sure if it's the right place, but I'm wondering how to format *.td and *.mlir files, is there a tool like clang-format to do this? Sorry, I didn't find anything helpful after searching

gglin001 avatar Aug 12 '22 04:08 gglin001

You can run tablegen files through clang-format, but I'm not sure how well-maintained its tablegen formatter is.

If this is the expected way to format tablegen files, then it would be nice to expose that in the extension.

lenary avatar Aug 16 '22 13:08 lenary

There is some discussion here on formatting tablegen files: https://discourse.llvm.org/t/formating-mlir-tablegen-code/60767 Region-based formatting within editors (driven by clang-format) in certain situations should work.

bondhugula avatar Aug 18 '22 13:08 bondhugula