Salesforce-Inspector-reloaded
Salesforce-Inspector-reloaded copied to clipboard
feat[data-export]:add format query button to allow users to format SOQL queries
Describe your changes
Add a "Format Query" button to the [Data Export] section, allowing users to format their SOQL query for an enhanced view of the query's structure
Note: Currently the "Format Query" button does not support Comment and SOSL.
Issue ticket number and link
N/A
Checklist before requesting a review
- [x] I have read and understand the Contributions section
- [x] Target branch is releaseCandidate and not master
- [x] I have performed a self-review of my code
- [x] I ran the unit tests and my PR does not break any tests
- [x] I documented the changes I've made on the CHANGES.md and followed actual conventions
- [ ] I added a new section on how-to.md (optional)
Hi @dyncan Thanks for this PR !
I think that the 'Format Query' button may be useful for users but I'm a little bit annoyed by adding a 287 KB file for this since minified react only weights 124 KB.
I would prefer a much lighter solution to handle the formating of SOQL
Hi @tprouvot Thanks for the feedback.
I understand your concern, I'll look into alternatives and update accordingly.
Hi @dyncan, Have you considered other options for formatting ?
@tprouvot Currently, no better alternative has been found. I believe this library effectively resolves the issue of SOQL formatting. I also attempted to repackage and optimize the library’s source code using webpack, yet the size of the package still exceeds 200KB.
Hi @dyncan, I'm not aware of the framework but I think our need is much more lighter than what soql-parser.js can do. Have you considered creating a function which parses the query for the basics needs of formatting ?
Hi @tprouvot Formatting SOQL requires considering various scenarios, such as subqueries and nested subqueries, and complex where conditions, etc. which makes it somewhat complex. A few weeks ago, I implemented a simplified version that only supports basic SOQL queries (without subqueries ), and supporting more complex SOQL might be challenging.
Hi @dyncan I'm closing this PR since the addition of a soql parser framework has been rejected for now. Please let me know if you want to implement a new custom beautifier. FYI the new version will support SOSL and GraphQL language in addition of SOQL
Hi @tprouvot
Thank you for the update. I understand the decision and appreciate the information on the upcoming features.
I also look forward to contributing more meaningful PRs in the future.