Re: [code] How to generate API files for Textadept's Lua auto-completer?

From: Mitchell <>
Date: Fri, 25 Oct 2019 11:23:51 -0400 (EDT)

Hi David,

On Fri, 25 Oct 2019, David Tamar wrote:

> Apparently, I managed to use Textadept a few months without any auto-completion or ctags to navigate the lexical scopes of my own Lua code. But recently I'm trying to understand how to generate API files so that TA's Lua completion could work with them on the fly.
> It's not clear to me how to divorce Textadept's Lua API from PUC-Rio's Lua API. Some of my projects are not related to TA, but they target stand-alone Lua interpreters of different versions (like LuaJIT 2.1, or Lua 5.1 for example). I'm also not sure how to auto-complete code from LuaRocks. In these cases TA should not autocomplete its own API since the code targets an external interpreter.

The instructions for generating your own autocompletion and documentation is here[1].

The Lua documentation used by Textadept is in *modules/lua/lua.luadoc*, so you can process that file manually or lump it in with your own code. Note that in order to have documentation show up nicely in Textadept (e.g. newlines are inserted correctly), you will have to patch your local copy of LuaDoc with *modules/lua/luadoc.patch*.

> There are some related issues with Lua's auto-completion in general that I wish to mention: It's currently not using fully-qualified names so it's confusing between same names coming from different tables.
> [snip]

Do you mean for documentation? For example, showing documentation for `print` in Textadept gives candidates for `_G.print()` and `ui.print()`. This is intentional, since you can alias modules to whatever name you want via `require()`. Textadept indicates there is more than one documentation match with the little arrows.

> There is also no static inferring for "require"-ed scopes, local scopes, and "assert"-ed inner structures of tables that were passed as parameters.

Would you please give an example? I'm not sure what you mean for each. Do note that Textadept does not do any sort of complex lexical analysis of code. It just does simple word lookups for the most part. See *modules/lua/init.lua*'s `textadept.editing.autocompleters.lua()`.



You are subscribed to
To change subscription settings, send an e-mail to
To unsubscribe, send an e-mail to
Received on Fri 25 Oct 2019 - 11:23:51 EDT

This archive was generated by hypermail 2.2.0 : Sat 26 Oct 2019 - 06:45:12 EDT