llvm / vscode-mlir

Other
51 stars 13 forks source link

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

Open gglin001 opened 2 years ago

gglin001 commented 2 years ago

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

lenary commented 2 years ago

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.

bondhugula commented 2 years ago

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.