Skip to content

vlang/playground

Repository files navigation

V Playground: Run, Edit, Share V Code Online

The V Playground is a place where you can run, edit and share V code online.

Features

  • Nice and clean UI
  • Powerful editor with syntax highlighting and auto-completion
  • Ability to run test code.
  • Ability to see the generated C code, for the passed V code.
  • Pass compilation flags to the V compiler, and separate for your program.
  • Shareable code and editor state via URL or local storage.

Developing

If you wish to improve the playground, first you have to clone the repository:

git clone https://github.com/vlang/playground
cd playground

Install V dependencies:

npm run install-server-deps

Run the playground locally

npm run local-serve

then access the playground at http://localhost:5555

Quick, containerized local development (recommended)

Using Docker Compose

npm run run-docker

then access the playground at http://localhost:5555

Using VSCode DevContainers

  1. Install Docker
  2. Install Visual Studio Code
  3. Install the Remote Development extension for VS Code
  4. Clone https://github.com/vlang/playground
  5. Create your application within a container (see gif below)

Done.

Since you are using a docker container, your main system will remain "clean".

vscode-open-in-container

Then just run:

npm run serve

then access the playground at http://localhost:5555

Run the playground locally inside isolate (as on https://play.vlang.io/)

NOTE: Only works on Linux, since it uses isolate.

Install Dependencies

We use isolate to sandbox the playground, so you need to install it first.

git clone https://github.com/ioi/isolate /tmp/isolate
cd /tmp/isolate
make isolate isolate-check-environment
make install

Run the server

npm run serve

... then access the playground at http://localhost:5555

Server API

See server/README.md for more information about the server API.

License

This project is under the MIT License. See the LICENSE file for the full license text.