Allow SOQL queries against the Tooling API

Issue #373 resolved
Scott Wells repo owner created an issue

Right now the SOQL Query tool window works against the metadata API. A few folks have asked for query support against tooling API SObjects. To do this right, the tooling API SObjects should also be included in the OST so that they're available for code completion. To do this really right, the SObjects that are exclusive to the tooling API should only be available for code completion in the SOQL Query tool window when it's configured to use the tooling API.

Comments (11)

  1. Matej Mercina

    I was about to ask for this when I found this existing issue. @Scott Wells is this still on the roadmap?

  2. Scott Wells reporter

    Hi, Matej. Yes, it's still on the roadmap. The real challenge is still making it work properly in terms of code completion. I could make it issue the query against the Tooling API easily, but the SObjects in the Tooling API aren't the same as those in the Metadata API. There are some that are exclusive to the Tooling API, and there are others that exist in both APIs but have different fields and relationships. At present IC2 isn't at all aware of the Tooling API SObjects.

    One option would be to just offer code completions based only on Metadata API objects but issue the query against the Tooling API. That would be quick and relatively simple to provide, but it seems contrary to the spirit of an IDE which should be helping the user to write these queries.

    I'll take a look at what would be required to get a list of Tooling API SObjects and their fields--perhaps on-demand instead of actually rendered into the OST--and see whether there's perhaps some intermediate solution that might work. That probably won't be for a few weeks as I have a pretty solid backlog of work right now, but I wanted to address the question in a more timely manner.

  3. Matej Mercina

    Hey Scott,

    understandable, no rush. Just figured I’d check on the status. Thanks for the update.

  4. Frans Flippo

    @Scott Wells How about just adding the feature without code completion as a first release? Just being able to query through the Tooling API from the same place I do all my Salesforce dev would already be an improvement for me over having to open the SF Developer Console to do it.

  5. Scott Wells reporter

    Hi, Frans. I've considered doing exactly that--and I haven't ruled it out--but am concerned that even if I add a clear message about misleading code completion, validation, etc., for those queries when executing via the Tooling API, it's still going to result in significant confusion and bug reports. Maybe I'll move this into next week's work list and see if I can just knock it out properly.

  6. Scott Wells reporter

    Okay, I started on this the other day and it's just about done. Unless something unexpected happens, it should be in this coming week's build. Here's a pic:

    Tooling_API_SOQL_Query.png

    It supports:

    • Generation of Tooling API SObjects into the OST (obviously requires OST regeneration).
    • Selection of which API should be used for the query in a given tab via a toolbar toggle button (defaults to standard; retained across sessions).
    • Full authoring/editing of SOQL queries against Tooling API SObjects just as with standard SObjects.
    • Execution of SOQL queries against Tooling API SObjects and display of query results in both tabular and hierarchical formats.
    • Integrated API docs for Tooling API SObjects and their fields.
    • Tooling API SObjects are not offered as code completions except when explicitly authoring a SOQL query for execution against that API. If a reference is found to a Tooling SObject (or its fields), that reference is flagged as an error in the Apex/SOQL editor.

    As stated above, barring unforeseen circumstances, this will be included in Thursday's build.

  7. Log in to comment