[texworks] 'Improved' auto-completion

Henrik Skov Midtiby henrikmidtiby at gmail.com
Mon Aug 26 15:05:38 CEST 2013

> Can you give me an example of what is meant by `context sensitive'?
As the author behind an autocompletion system for texworks [1], this is my
understanding of context sensitive autocompletion.
I hope that this will qualify the discussion and not take it to far away
from the original topic.

An autocompletion system that does not use information about the context is
insertion of a fixed string. All invocations of the script will insert the
same string af the cursors current location. This is level 0 of context

Level 1 of context awareness is that the autocomplete script looks at the
contents of the line where the cursor is placed.
Based on the contents of the line a suitable completion is suggested based
on some king of pattern matching.
This is how texworks builtin autocompleter works right now.

Level 2 of context awareness is to look at the lines before the cursor and
provide suggestions based on the content of these lines. That could be
completion of references to sections or figures. In addition it is possible
to close unclosed environments.

Level 3 is to look at the contents of all open files related to the project
and search for completion candidates (label names, bibtex references, etc.)
This level of autocompletion is partly implemented in the script
demonstrated at [1] and available from [2].

Best regards,
Henrik Skov Midtiby

[1] Youtube video of the autocompletion script in action,
[2] Git repository containing the autocompletion script,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/texworks/attachments/20130826/877d58a0/attachment.html>

More information about the texworks mailing list