Code completion

To make text input on iOS easier and faster Shaderific now provides code completion.

Code completion works in a unix-like style and can be invoked by pressing the tab key when the cursor is at the end of an incomplete word. If there is only one completion result the word is auto-completed instantly. In case of more then one result the word is completed as far as possible and all possible completions are shown in a popover list view. You can now select an entry from the list to complete the word or just continue typing. In the latter case the popover is dismissed automatically.


The completion results are sorted by the following categories:

  • Qualifiers & statements
  • Data types
  • Variables
  • Functions
  • Preprocessor directives

The results are displayed with their respective highlighting colors.

The section Variables includes the built-in variables of the OpenGL Shading Language as well as user-defined variables and functions. All variables and functions that have been declared by the user are added to the list of possible word completions automatically.

Side note: The popover list view is only available on the iPad. Everything else works the same way on iPhone and iPad. Since there is no tab key available on the standard keyboard of the iPhone, code completion can only be used when the device is paired with a (bluetooth) hardware keyboard.

Keyboard extension

To make text input on the iPad easier and faster Shaderific now offers an extension of the virtual keyboard.

When typing code on the iPad the biggest drawback of the virtual keyboard is the standard keyboard layout. Since it is optimized for regular text input and not programming, many often used characters like the semicolon, parentheses and digits are only available after switching the keyboard layout. Some characters like curly braces and the plus and equal sign can not be used before switching the keyboard layout twice. All this incessant switching is very time consuming and becomes frustrating after a short while.

The new keyboard provides all essential characters for programming shaders as an extension on top of the primary keyboard. This way switching keyboard layouts is only necessary in rare cases from now on. The keyboard extension comprises two keys for cursor movement, seven multifunction keys and a tab-key.


The two cursor keys move the cursor one character to the left or to the right respectively, as expected. If you tap and hold a cursor key the cursor starts to jump to the beginning (in case of the left cursor key) or the end (in case of the right cursor key) of the word and continues to jump word-wise as long as you hold the key.

The multifunction keys provide a way to type parentheses, brackets, operators and digits without switching the keyboard layout. If you tap a multifunction key once the first character on the key will be inserted in the text. Tap and hold a multifunction key and the different characters shown on the key start to appear one after the other at the cursor position.

The tab-key hast three different functions depending on the cursor location:

  1. Cursor at the end of an incomplete word
  2. Cursor at the end of a complete word
  3. Cursor at any other location

If the cursor is at the end of a word that is not complete yet the tab key invokes code completion. In case the word is already complete the tab key invokes context-sensitive help (this feature is part of the upcoming release).

In all other cases three whitespace characters are inserted in the text. (For technical reasons the width of a tab character can not be customized. Therefore tab characters are replaced with three space characters during text input to ensure a coherent text layout.)