Jump to content

Visual Studio Code

From mediawiki.org
Revision as of 10:21, 27 August 2020 by ItamarWMDE (talk | contribs)

Visual Studio Code is a free cross-platform IDE built on open source with a diverse plugin ecosystem that can be used for MediaWiki Development.

The Wikibase team at Wikimedia Deutschland is currently trialling its use as an IDE and this page serves as the documentation of that effort (hoping it will be useful or others).

Plugins

Highly recommended if you are coming from PhpStorm or IntelijJ.

Debug support for PHP with XDebug

Setting up the connection with path mappings

For use with mediawiki-docker-dev you'll need to update the Xdebug config section in your launch.json to look something like the below (with added pathMappings)

        {
            "name": "Listen for Xdebug",
            "type": "php",
            "request": "launch",
			"port": 9000,
			"pathMappings": {
				<remote-mediawiki-path>: "${workspaceRoot}"
			}
        }

Make sure to replace <remote-mediawiki-path> with the relevant mediawiki path in the remote system or docker container (in mediwiki-docker-dev, this would be /var/www/mediawiki)

Avoid breaking on uncaught exceptions, warnings etc.

By default the plugin will break on "uncaught exceptions and errors / warnings / notices".

This may not be desirable and can be turned off.

  1. Using the sidebar, select the "Run" panel.
  2. At the bottom of the panel expand the "Breakpoints" section (collapsed by default).
  3. Untick the "Everything" option.

Provides links to Phabricator objects.

"phabricator-links.url": "https://phabricator.wikimedia.org"

Settings

editor.wordSeparators

In order to allow selection of PHP variables (including the $) by double clicking on them you need to alter your editor.wordSeparators [1]

You can do this for individual languages in your settings.json file [2]

    "[php]": {
        "editor.wordSeparators": "`~!@#%^&*()-=+[{]}\|;:'",.<>/?"
    }

Live Share

TBA

References