Visual Studio Code

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. It was designed by Microsoft.

You can download it for free https://code.visualstudio.com/

Notable features

edit

This one might annoy you https://code.visualstudio.com/docs/getstarted/userinterface#_preview-mode

edit

Licence required (after 1 month trial). Contact Addshore.

Notes

  • Simple refactorings are done through the "rename symbol" option not "refactor"
  • Very receptive to issues being filed, and fixes often in 1 day. (issue tracker)

Debug support for PHP with XDebug.

If you're using Windows, WSL2, or docker containers you might find this blog post useful.

The plugin comes with default configuration that will work in many cases.

Issues with path mappings

edit

If you have problems with VSCode detecting the mappings between your files and the debug sessions you may need to set some path Mappings in the launch.json

			"pathMappings": {
				<remote-mediawiki-path>: "${workspaceRoot}"
			}

Avoid breaking on uncaught exceptions, warnings etc.

edit

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

edit

files.autoSave

edit

Annoyed by forgetting to save files and wondering why you can't see your changes? Check out this setting.

    "files.autoSave": "onFocusChange"

search.useIgnoreFiles

edit

MediaWiki includes a .gitignore file that the IDE will use to ignore files and directories during search. In MediaWiki this includes the skins and extensions directories. In order to search files in these directories you will need to set the search.useIgnoreFiles to false in your project specific configuration or higher. A default of true may be useful in other projects, so the recommended location is in project configuration.

    "search.useIgnoreFiles": false

editor.wordSeparators

edit

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

explorer.autoReveal

edit

By default, opening a new file will jump to that location in the sidebar. This can be annoying in large projects. The bellow will stop that jumping around!

    "explorer.autoReveal": "focusNoScroll"

Plugins to avoid

edit
  • Render line endings: Has performance problems
  • Render whitespace at end of lines: Has performance problems

References

edit