Quick Query


The main body of the Quick Query window is a standard text editor for QL queries. It is particularly useful for developing and testing new queries. If you want to edit QL libraries or saved query files, you can use the QL editor.

Displaying the Quick Query window

To display the Quick Query window, click the Quick Query icon () in the Results view.

In the Quick Query window, there are two main areas of control:

  1. Top toolbar—defines the display name for any results of this query. It also includes three icons:
  2. Icon Action
    Run the query (equivalent to Ctrl+R).
    Save the query.
    Restore the previous query.
  3. Bottom toolbar—defines the initial display format for the query results. The buttons and display styles are the same as those described for the Results panel of the Results view.

Available actions

The Quick Query window supports the following options:

Command Description Access
Auto-complete Display auto-complete information in a pop-up window. This is normally triggered automatically as you type your query. You can also manually re-display the information (for example, after deleting a predicate).

Automatic or Ctrl+Space

Auto-format QL Format the currently open QL file so that it follows the Semmle QL Style Guide. Ctrl+Shift+F
QL entity info Show a description of the current QL entity including any QLDoc. This is displayed in a pop-up window when you hover over an entity with your mouse cursor. Hover over code
Find References

Find all QL references to the selected element in files and display the results in a Search window.

Find Subtypes

Available only for types: find QL types that directly extend the selected type and display the results in a Search window.

Multiline comments When you enter /* at the start of a multiline comment, QL for Eclipse automatically inserts a closing */. Within a multiline comment, pressing Enter automatically creates a new line with appropriate whitespace and a * character.
You can enable or disable this using the QL for Eclipse preferences page.
Open Declaration

Open the declaration of the selected predicate, type, or module in a QL file. This is the same as Jump to definition (F3).

Quick Evaluation

Evaluate the currently selected snippet of QL code and report the results in the Results view. This has two main modes of operation:

  • Select a predicate name to evaluate that predicate.
  • Select a syntactically complete formula or expression to evaluate it as a relation over its free variables.

This is particularly useful when you are debugging a query and want to locate the part of the query that is wrong.

Spell check Check the spelling of text in QL comments using the tool built in to Eclipse. You can enable or disable it using the General > Editors > Text Editors > Spelling preferences page.  Automatic
Syntax check Underline any errors in red and highlight the line. The Run option is disabled until you have corrected the error. Hover the cursor over the error icon to display a tooltip describing the problem. Any warnings are underlined in orange. Automatic

You can close the Quick Query window at any time by pressing the keyboard Escape key.

Related Topics Link IconRelated Topics