How do I write queries faster?

Prev Next

LumiCode's editor knows Luminesce: it completes provider and field names as you type, brings back anything you've run before, tidies a query's layout with one key, and can run just the part of a long script you're working on. A few keys make a real difference to how quickly you get from a question to an answer.

Prerequisites

Methods

Method 1: Let completion do the typing

  1. Start typing, for example select * from Lusid.Ins.

  2. Press Tab, or Ctrl+Space, to open the completions.

  3. Use ↑ ↓ to choose one, and press Tab or Enter to accept it. Esc closes the list.

Accepting a word adds the space after it, so pressing Tab repeatedly builds up a line a word at a time. When an item's documentation is too long for its panel, PgUp and PgDn scroll it.

This covers far more than Providers and Fields from the catalog, but includes full Function, Operator and SQL key word syntax code completion, wherever they are valid.

Completion works for LumiCode's own commands too: on a line that starts with /, it offers commands rather than SQL.

On a Mac

macOS may use Ctrl+Space to switch input sources. If it does, use Tab instead.

Method 2: Bring back a query you've run

Method 3: Write over several lines

Enter runs the query. To start a new line instead, press Shift+Enter or Ctrl+J.

Most macOS terminals send Shift+Enter as a plain Enter. Either use Ctrl+J, or set your terminal to send a newline for Shift+Enter. If you'd rather Enter started a new line, /set enter newline swaps the two over.

Method 4: Tidy the layout

Press Ctrl+P to format the query in the editor. /pretty prints the last query you ran, formatted, into the transcript.

Method 5: Run part of a script

  1. Hold Shift and use the arrow keys to select the part you want.

  2. Press Ctrl+R. LumiCode runs what is selected and nothing else.

Enter always runs everything in the editor. To run several separate queries side by side, see How do I run several queries together as a multi-query?

Method 6: Use your own editor

For a long query, press Ctrl+X to open it in your own text editor. When you save and close it, the query comes back into LumiCode. To choose which editor opens, use /set editor.

Moving about and copying

  • Option+← and Option+→ (Alt on Windows and Linux) move a word at a time, as do Ctrl+← and Ctrl+→. Add Shift to select as you go.

  • Home and End go to the ends of the line. PgUp and PgDn move a page through a long query.

  • Clicking puts the cursor where you clicked.

  • Ctrl+C copies what's selected. With nothing selected, it clears the line.

  • Ctrl+V pastes.

  • Esc clears the line.

Copying on a Mac

In the editor, Cmd+C doesn't copy: use Ctrl+C. Ctrl+X opens your editor rather than cutting, so to cut, select, press Ctrl+C, then type over the selection.

Appendix: Editor keys

Key

What it does

Enter

Runs everything in the editor

Shift+Enter or Ctrl+J

Starts a new line

Ctrl+R

Runs only what is selected

Tab or Ctrl+Space

Opens completions

↑ ↓

Recalls recent queries

Ctrl+P

Formats the query

Ctrl+X

Opens the query in your own editor

Ctrl+C

Copies the selection, or clears the line. Pressed again on an empty line, it leaves LumiCode.

Esc

Closes completions, or clears the line

For every key, type /help keys in LumiCode.