debug-log-analyzer icon indicating copy to clipboard operation
debug-log-analyzer copied to clipboard

✨ feat: SQL Keyword Highlighting

Open jwoodwardcertinia opened this issue 8 months ago • 1 comments

Is your feature request related to a problem?

When looking at long queries it takes a while to find what object we are querying and therefore know if it is a query I'm interested in. (To be clear I mean queries where the query text has many characters and spans many lines. Not long-running queries.)

Describe the solution you'd like

Can we highlight the key words 'SELECT, FROM, WHERE' in a different color I can quickly find the SObject and where the WHERE clauses start.

Describe alternatives you've considered

It might be nice to format the queries. There's probably ways to do that, but maybe we don't have the space for it.

Additional context

None

jwoodwardcertinia avatar Apr 21 '25 14:04 jwoodwardcertinia

Thanks for the idea Jim. We have a couple of similar /related features on the backlog #253, #510

The first one is more comprehensive which will basically add a JSON like tree view like you seen in the chrome debugger when looking at an object. It will allow you to easily expand and collapse parts of the soql. It will keep it nice and concise just seeing the top level keywords and expand down to see sub queries etc.

SELECT 
  SomeField__c, AnotherField__c, // This lines would collapse + expand
  RelatedObject__r:  RelatedObject__r.Field__c, RelatedObject__r.Field2__c, // This lines would collapse + expand
  (SELECT
   Field1__c Field2__c // This lines would collapse + expand
   FROM Children__r)
FROM MyObject__c
WHERE ...
GROUP BY ...
LIMIT ...

The second one is about making the object type more visible in SOQL queries which is similar to your idea. I think we can deliver this and #510 fairly quickly and easily.

I think what we want to do is make the keywords bold to easily scan to important parts of the SOQL and we should also place them on new lines. Nested SOQL, child queries etc would be nested.

e.g SELECT ... FROM MyObject__c WHERE

lcottercertinia avatar Apr 24 '25 09:04 lcottercertinia