3 ms·
SYNG Beta – Structural Search for JavaScript
- sugarfly 3y agoHi, it honors me to invite to you the beta release of SYNG -- a search tool designed for more accurate, reliable and efficient scanning of JavaScript/TypeScript source. A good addition to your traditional search toolkit (e.g. grep). It's especially useful in the context of refactors, more so in larger codebases, where code may not be uniform, or hard to reach with plain text queries. I'd love to hear your feedback on the tool in general, your experience, and the query language in particular. Here's where you can find SYNG: - Website: https://syng.dev https://syng.dev - Documentation: https://syng.dev/docs/manual https://syng.dev/docs/manual - VSCode Extension: https://marketplace.visualstudio.com/items?itemName=semantic-works.syng https://marketplace.visualstudio.com/items?itemName=semantic... - Discord server to chat or ask questions: https://discord.gg/ZUGAM9Y23r https://discord.gg/ZUGAM9Y23r Thank you very much! PS: if you're curious about the query language's history, I tell the story of how I arrived at this particular implementation in the article at https://amireh.net/esgrep-ql.html https://amireh.net/esgrep-ql.html. It's rather informal, as I wrote it originally for a friend, so take it for what it is.
- pretty_colors 3y agoI can see this being useful for custom linters.
- diegof79 3y agoI used multiple libs to do this: codeshift, Babel, TypeScript APIs and AST transversal code, and recently AST Grep. For what I see on the documentation, I like the simplicity and the Lisp like query language. Definitely I’ll try this tool. If you are wandering what is my use case: when you maintain a design system it’s very useful to understand how the components are used across projects, so you can prioritize a migration or redesign. Querying using the AST is better than doing many RegExp searches that don’t take into account syntax variants.
- sugarfly 3y agoThank you for your response! If/when you do try it, you're welcome to join us on Discord and share your insights. The use case you describe is a prominent one. I used to write ad-hoc static analysis programs to get at this information, and every time you do this, there's a lot you have to "relearn"; whether it's changes in the spec, or all the AST patterns you need to account for, etc. Burdensome and prone to error, but necessary and ultimately very useful. And in other cases, using a RegExp search could yield thousands of results, more than a human can handle, and you might not be able to narrow them down without fear of missing positives. In both cases, an AST search comes very handy. And now it can be done very quickly too!