Skip to content
This repository has been archived by the owner on Oct 7, 2020. It is now read-only.

jeblad/vscode-wikimediafunctions-snippets

Repository files navigation

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.

The extension is hosted at GitHub and Visual Studio Marketplace.

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

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

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

About

Snippets for the functions in use at Wikimedia sites.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published