AutoCompletion API
| Autocompletion back-end, providing a REST end-point |
| Type | JAR |
| Category | |
| Developed by | |
| Active Installs | 20 |
| Rating | |
| License | GNU Lesser General Public License 2.1 |
Table of contents
Description
- REST-based which means other clients can use it
- POST the document content to /xwiki/rest/autocomplete?offset=<contentOffset>&syntax=<documentSyntax>
- Clean code with automated tests which is ready to be proposed to the XWiki Platform
- Pluggable: new method finder can be plugged in for a specific variable name
- Generic code which can be used not only for Velocity but for other scripting languages (groovy, etc) and wiki syntax autocompletion
Features Implemented for the Velocity completions and XWiki API
- $
- $!
- ${
- $!{
- $a
- $!a
- ${a
- $!{a
- $a.
- $a.b
- $services. (list SS)
- $xwiki. (find plugins too)
- $context. (find context keys too)
- $xcontext. (find context keys too)
- $a.bbb with cursor inside the method
- Special support for Velocity shorthands for getters
- List parameters and return type
- Sorted
- Supports lowercase matching (user enters in lowercase and it matches uppercase)
- PR support!
Response format
{
"hints" : [
{
"name" : String, // Value to be used as completion when the user selects it
"description" : String, // Value to display in the UI for the current completion
},
...
],
"startOffset" : integer, // The offset in the content where to insert a selected completion.
// Note: It should actually be used to replace anything between startOffset and offset in the content.
"empty" : boolean // True if there are no results, false otherwise
}Example
POST URL:
http://localhost:8080/xwiki/rest/autocomplete?media=json&offset=35&syntax=xwiki%2F2.1
Note: if not specified, the default media type is XML.
Input (POST body):
{{velocity}}
$services.model.create
{{/velocity}}Output:
{
"hints":[
{
"name":"createAttachmentReference",
"description":"createAttachmentReference(DocumentReference, String) AttachmentReference"
},
{
"name":"createDocumentReference",
"description":"createDocumentReference(String, String, String) DocumentReference"
},
{
"name":"createEntityReference",
"description":"createEntityReference(String, EntityType, EntityReference) EntityReference"
},
{
"name":"createSpaceReference",
"description":"createSpaceReference(String, WikiReference) SpaceReference"
},
{
"name":"createWikiReference",
"description":"createWikiReference(String) WikiReference"
}
],
"startOffset":29,
"empty":false
}Release Notes
4.10.2
4.10.1
4.10
4.9
4.8
4.7.1
The following translations have been updated with this release:
4.7
4.6.1
The following translations have been updated with this release:
4.6
4.5.2
4.5.1
4.5
4.4
4.3.1
4.3
4.2
4.1
4.0
3.4
3.3
3.2
3.1.1
3.1
3.0
2.2
2.1
2.0
Prerequisites & Installation Instructions
We recommend using the Extension Manager to install this extension (Make sure that the text "Installable with the Extension Manager" is displayed at the top right location on this page to know if this extension can be installed with the Extension Manager).
You can also use the manual method which involves dropping the JAR file and all its dependencies into the WEB-INF/lib folder and restarting XWiki.
Versions
Dependencies
Dependencies for this extension (org.xwiki.contrib.editortool:editor-tool-autocomplete-api 4.11):
- org.apache.commons:commons-lang3 3.12.0
- org.xwiki.commons:xwiki-commons-component-api 14.10
- org.xwiki.commons:xwiki-commons-velocity 14.10
- org.xwiki.rendering:xwiki-rendering-api 14.10
- org.xwiki.platform:xwiki-platform-rest-server 14.10
- org.xwiki.platform:xwiki-platform-oldcore 14.10