At Splitgraph we integrated tree-sitter [0] (in WASM) into our Console query editor [1] to introspect the pgSQL query and display the referenced tables in the sidebar for easier comprehension. We have written an article detailing how we got it done, where we evaluated a few existing pgSQL parsers, and talked about the parser features that are vital when using it in a code editor.
I was the lead engineer working on this feature and I'm here to talk more about this feature and answer any related questions you may have.
[0]: https://tree-sitter.github.io/tree-sitter/
[1]: https://www.splitgraph.com/query?sqlQuery=SELECT%0A++++%22Em...