Content/Code assist is functionality provided by some IDEs, which helps the developer to write code faster and more efficiently. This is achieved by simplifying the task of coding to allow focus on the business task being coded. Based on the context of the code, content assist provides the developer with a list of accessible keywords according to a programming language specification, variable, methods, data types, etc.

Autocomplete

edit

Autocomplete allows quickly typing names in the context of the code. It can be further improved to assist the developer.

For example, in an XML context, when the developer types an opening tag "<" he is offered a list of tags via autocomplete, contextualized following the DTD or XML schema of the document. As the developer types more letters, the offered choices are filtered to only retain the relevant completions. When the developer finally completes the tag, the editor automatically generates the closing tag.

Other autocomplete techniques exist. For example, using the Eclipse IDE to code in Java, a developer can just type in the first letter if lowercase and the uppercase letters from a type/variable name then press Ctrl+space to be offered all the choices that match the entered letters that are valid for the current context (class name, interface name, variable or field names).

Code snippet / Code templates

edit

Code snippets allow the developer to add a complex coding structure by typing a minimal amount of text. Code snippets can only be used in a valid context (statements snippets are only offered when you can insert statements).

For example, using the Eclipse IDE to code in Java, a developer can type in "instanceof" then press Ctrl+space which will replace "instanceof" by the following code snippet:

 if (obj instanceof MyClass) {
   MyClass myClazz = (MyClass) obj;
   
 }

This code snippet can be further customised by the developer, with the IDE placing the cursor:

  1. on the "obj" variable to choose between the available variables at this point,
  2. on the "MyClass" type to allow the developer to choose the type, after he pressed the tab key,
  3. on the "myClass" variable to allow the developer to rename the local variable, after he pressed the tab key,
  4. on line 3 to allow the developer to continue typing the rest of the code, after he pressed the tab key.

See also

edit

References

edit
edit