Skip to content

Bilal2453/luvit-meta

Repository files navigation

Luvit-Meta

This project is a collection of definition files for the framework Luvit. The definitions provide types for all modules currently shipped in Luvit, the classes, methods and their arguments and returns; it does as well provide descriptions whereever possible, either by scraping the Luvit-docs, Nodejs docs, luv docs or manually written in some places.

Some of the definitions are scraped off of code/docs and then some manual work is done to figure types out. For those the used scraper is located under scrapers, the script outputs to a file in the same directory. From there it is manually copied over to the actual library definition. Other definitions -and most of them- are completely manually written, as it was required to figure the logic out in order to figure the types.

Cool, any examples?

Here are some samples of it working:

http-server.mp4
fs-access.mp4
stream-events.mp4

Where does this work?

The definitions use the Sumneko's Lua Language Server (LLS) annotations, therefor it should work on any editor that support LLS, such as VSCode and Neovim.

How to install it?

On Visual Studio Code:

  1. Install this plugin then reload editor.

  2. Open the workspace you want to enable this in.

  3. Press Ctrl + Shift + P, a prompt will open.

  4. Type "Open addon manager" and press enter.

image

  1. Search for Luvit then press Enable.

image

  1. The definitions should now be enabled for that workspace. Typing something like local fs = require'fs' will show you auto-completion.

Manually, for other editors:

  1. Install LLS for your editor.
  2. Configure your meta directory.
  3. Click here to download the definitions; alternatively clone this repository.
  4. Extract the ZIP file to your meta directory/move the folder there.
  5. Should now be ready. If not, check the editor plugin's manual for doing this.

What modules have definitions?

Built-in Modules:

  • buffer
  • childprocess
  • codec
  • core
  • dgram
  • dns
  • env
  • fs
  • helpful
  • hooks
  • http
  • http-codec
  • http-header
  • https
  • json
  • los
  • lpeg
  • net
  • path
  • pathjoin
  • pretty-print
  • process
  • querystring
  • re
  • readline
  • repl
  • require
  • resource
  • stream
  • thread
  • timer
  • tls
  • url
  • ustring
  • utils
  • uv
  • miniz
  • luvi
  • rex
  • openssl
  • WinSVC

Popular libraries that are not built-in:

  • coro-http
  • coro-net
  • coro-channel
  • coro-wrapper
  • coro-fs
  • coro-spawn

License

This exhausting project is licensed under Apache License 2.0, see LICENSE for more information. Feel free to fork and/or PR changes.