Affects Version/s: 2.0
Fix Version/s: None
Right now, autocomplete in the document content wiki syntax editor works by sending the whole document content to the REST autocompletion service and by specifying the document's syntax.
We need to decide how to handle this:
- server-side only or
- client side, the codeMirror way, mixed with server-side where needed (for server-side languages like Velocity, Groovy, etc.)
While the client side + server side approach has the advantage of code reusability (using existing implementations), it has the downside that it can be less flexible. Two main limitations would be:
- no communication between nested languages: if the root language is autocompleted by a client-side implementation and a contained/nested languages is autocompleted by a server-side implementation, hints on variables defined in the root language would not be available inside the nested language
Perhaps a solution would be to aggregate completions from all the involved languages, going from a root language down to its nested languages. Example:
We would first evaluate everything inside the Velocity tag as velocity, then everything inside the HTML tag as HTML and finally everything inside the JS tag as JS (same for CSS), each such evaluation adding to the list of completions together with a marker that states where that completion comes from.
However, normally this would not cause much pollution since velocity completions start with "$" or "#", HTML tags use "<", but there can be cases like HTML attributes and their values where a nested macro would be quite polluted with completions from its parent macro(s). Example:
In the above example, only the autocomplete position marked as  would be a viable candidate, while  and  would just be pollution.
These would be concerns about a complete implementation. However, until then, we would probably implement limited autocompletion in an iterative manner.
Existing client-side implementations:
- HTML: script (JS) and style(CSS) tag contents are not autocompleted the same way they are highlighted (with the "htmlmixed" CodeMirror mode)
Existing server-side implementations:
- Velocity (in progress)