cursorless icon indicating copy to clipboard operation
cursorless copied to clipboard

Implement autoformatter for tree-sitter query language

Open pokey opened this issue 3 years ago • 0 comments

It's a bit cumbersome to write our new tree-sitter queries (#616) because there is no autoformatter. I don't know of one today, but we could probably write one by leveraging the tree-sitter parser for tree-sitter-query. We might want to build the formatter using dprint. A couple possibly useful resources on dprint:

  • https://github.com/dprint/dprint/blob/main/docs/overview.md
  • https://github.com/dprint/dprint/blob/main/docs/wasm-plugin-development.md
  • https://docs.rs/dprint-core/0.28.0/dprint_core/formatting/index.html
  • VSCode support

Alternately, we might look into using the machinery that @wenkokke developed for https://github.com/wenkokke/talonfmt

This autoformatter would obviously be useful outside of Cursorless for the many other projects writing tree-sitter queries

pokey avatar Jul 18 '22 11:07 pokey