Skip to content
| Marketplace
Sign in
Visual Studio Code>Snippets>Lua snippets for WikimediaNew to Visual Studio Code? Get it now.
Lua snippets for Wikimedia

Lua snippets for Wikimedia

John Erling Blad

|
1,615 installs
| (0) | Free
Snippets for the Lua functions in use at Wikimedia sites, including, but not limted to Lua functions used by Scribunto
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Lua snippets for Wikimedia

This extension for Visual Studio Code adds snippets for various languages in use by Wikimedia at its sites running MediaWiki software. Among those languages are Lua, which is used as a templating language by the Scribunto extension.

Usage

Type part of a snippet, typically by writing something like mw.ustring.byte, make sure the highlighted entry is the one you want, press tab or enter, and the snippet unfolds. Inside the snippet there are one or more highlighted areas, these can be replaced, and it is then possible to tab to next item that can be replaced. Sometimes the highlighted area cover the comma before the argument, that happen when the following is an optional argument.

GitHub Logo

The snippets have a prefix that is the method name, and inside Visual Studio Code you might type additionel specifiers. Those are typically the class name or the name of an argument. It is also possible to write the snippets number, even if it is a bit awkward. Instance methods are found the same way as class methods, but the leading part is skipped on the assumption that it shall be appended to a variable of some sort.

As this is snippets, there is no Intellisense available. That is a bit unfortunate, as the user must learn the method names. They do although work as a typing aid, and especially well as an aid to get the arguments right.

Libraries

The set of snippets are mostly motivated by what I (the author) have found usefull, so please don't expect the list to be complete!

Lua

Standard libraries

Not included, available through other extensions.

Scribunto libraries

Libraries loaded by Scribunto

  • frame — interactions with calls from Mediawiki

Libraries available through the “mw” structure

  • mw — basic functions from Scribunto to interface with Mediawiki
    • hash — basic hashing
    • html — create and manipulate html tags
    • language — get, create and manipulate language objects
    • message — create and manipulate messages
    • site — access site-specific information
    • text — additional manipulation of strings
    • title — get, create and manipulate title objects
    • uri — create and manipulate encoded uri strings
    • ustring — manipulate unicode strings
    • wikibase — access repo-specific information

Libraries that must be explicitly required

  • libraryUtil — manipulate arguments

Pickle libraries

Libraries that use bootstrapping

  • adapt — create and manipulate assertions; “subjects” and “expectations”
  • frame — create and manipulate examples; “describe”, “context”, and “it”
  • spy — create and manipulate spies; “carp”, “cluck”, “croak”, and “confess”

Additional snippets

There a few additional snippets

  • class-table — table-based class structures, see Object Orientation Tutorial (“Simple metatable-based class” and “Inheritance”)

Installation

  1. Install Visual Studio Code 0.10.1 or higher
  2. Launch code
  3. From the command palette Ctrl-Shift-P (Windows, Linux) or Cmd-Shift-P (OSX)
  4. Select Install Extension
  5. Choose the extension
  6. Reload Visual Studio Code
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft