SpyglassMC / Spyglass

Development tools for vanilla Minecraft: Java Edition data pack developers.
https://spyglassmc.com
MIT License
263 stars 29 forks source link
datapack language-server lsp mcfunction minecraft

šŸš§ Under Heavy Construction šŸš§

This project is undergoing a complete rewrite. We're almost there.

For the legacy VS Code extension known as Data-pack Helper Plus, check out

Spyglass

Spyglass aims at improving users' editing experience of Minecraft data packs by providing IntelliSense features like real-time error reporting, auto-completion, semantic coloring, code navigation tools, and refactor utilities.

\ Sample image is from the legacy version of the project

Documentation

WIP at https://spyglassmc.com.

Contributing

  1. $ git clone https://github.com/SpyglassMC/Spyglass.git
  2. Install Node.js LTS.
  3. $ npm i && npm run build

If you're using VS Code to develop Spyglass:

Or if you prefer the command line interface:

Please refrain from using mocha --watch, as it might interface with and break the snapshot testing.

You can debug tests with breakpoints by running the Run Unit Tests configuration and setting your breakpoints accordingly. If you want to run a specific subset of tests, add .only after the test block (e.g. describe.only(), it.only()).

Note that the build will fail in CICD if .only tests are pushed to prevent mistakenly merging .only to main (it should only be used for local testing!).

Code style

Tabs for indents, spaces for alignment. Except do not align things because the available tooling is unfortunately terrible.

Test docs locally

  1. Install Jekyll according to its documentation.
  2. Run npm run docs:start to start a local preview at localhost:4000.

Build Pipeline

The build script at the root level does the following steps in series:

Module system

The whole Spyglass project, including its source code and output, uses ES module. However, as VS Code cannot consume ES modules as extensions (microsoft/vscode#130367), the vscode-extension package defaults to use CommonJS modules, with file extensions mjs and mts to explicitly override that,

Credits

The original Spyglass logo was provided by BlackNight0315. The current logo is provided by asd988.