Content assist

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 her to 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, ...

Autocomplete

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

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:

1  if (obj instanceof MyClass) {
2    MyClass myClazz = (MyClass) obj;
3    
4  }

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

External links


This article is issued from Wikipedia - version of the Friday, March 13, 2015. The text is available under the Creative Commons Attribution/Share Alike but additional terms may apply for the media files.