/greybel-vs

VSCode extension for GreyScript.

Primary LanguageTypeScriptMIT LicenseMIT

greybel-vs

GreyScript toolkit for Grey Hack. Includes highlighting, code execution, bundling and minifying among other features. Check out the changelog to get information on the latest changes.

Based on greybel-js.

If you need some GreyScript API information you can also look into this GreyScript Documentation.

Usage

Automatically detects .gs and .src files.

Commands available (CTRL+SHIFT+P):

  • Greybel: Build - info
  • Greybel: Share - info
  • Greybel: Refresh - info
  • Greybel: API - info
  • Greybel: Snippets - info
  • Greybel: Preview output (experimental) - info

You can also access most of the commands via the context menu:

Context Menu

Do not forget to set up your plugin to your needs. The following settings are available:

  • Activate/Deactivate
    • Autocomplete
    • Hoverdocs
    • Installer
  • Transpiler specific
    • Ingame directory
    • Build type
    • Disable literals optimization
    • Disable namespaces optimization
    • Environment variables
    • Excluded namespaces when optimizing
    • Obfuscation
  • Interpreter specific
    • Define seed
    • Environment variables
  • Installer specific
    • Define max characters per file
    • Auto compile
  • Create in-game specific
    • Active
    • Mode (local, public, nightly)
    • Steam User

Features

Transform

Transforms the content of the active text document into one of three possible output types:

  • Default (active by default): Minor optimizations
  • Uglify: Minified
  • Beautify: Beautified

Important: Transforms will ignore any include, import or import_code line. Use the build functionality instead.

Minified File

Environment values will be injected while transforming. Environment values can be configurated in the options of the Greybel-VS extension.

Env Settings

Additionally, there is an option to define which namespaces should be excluded from getting transformed or optimized.

Exclude namespaces

More details here.

Build

Transforms and bundles your files which makes it easier to import them into GreyHack. As described in the transform section it has three possible transformation types and supports environment variables as well.

Since 1.8.0 it is possible to automatically create files in the game. This can be activated by using the "Create In-game" option. More details here.

Build output

Keep in mind to enable the installer option in case you want to bundle your files which are using import_code. While building, installer files will get generated. The amount of files depends on the size of your project. These installer files will essentially contain all different code files and logic to create all files in the game. So basically you just need to copy and paste the code of the installer files into the game and then compile + execute them.

You also have the option to set the characters limit for each installer file.

Max chars

More details here.

Interpreter

Executes GreyScript code. Almost all intrinsics are fully supported. To get more information on which intrinsics are supported click here.

It also features a mock environment and debugger.

Start debug

After you pressed run a prompt will appear to input the parameters for the execution.

Enter params

Supports colors in the console via a pseudo-terminal. Also inputting data is much more convenient now since there won't be any popups anymore instead you can use the pseudo-terminal.

Pseudo Terminal

More details here.

Debugger

Enables you to set breakpoints, run code in a breakpoint context, jump to the next line of execution etc. Generally helpful if you want to debug your code. More details here.

Breakpoint

Keep in mind to set the breakpoint on a none empty line. Otherwise, it will just skip that breakpoint.

Active breakpoint

A REPL is also available while executing the script or having an active breakpoint.

REPL

API Browser

API Browser for GreyScript. Basically a version of the GreyScript API Documentation page within Visual Studio Code.

API Browser

Share

Shares your code via editor.greyscript.org. The related link will be written into the clipboard.

Refresh

Will refresh the AST Cache which is used for diagnostics, hover tooltips and autocompletion.

Snippets

Will return a list of available GreyHack snippets. Such as ls, mkdir and more.

Snippets

Preview output

Emulates the ingame terminal graphical output. This feature is currently experimental and will probably not show every tag accurately.

Goto Error

Jumps to the next existing syntax error.

Supporting providers

Autocompletion Provider

Figures out the current context and provides suggestions accordingly.

Hover Tooltips Provider

Returns information about functions/types.

Diagnostics Provider

Returns information about syntax errors in your code.

Symbol Provider

Returns list of all available symbols in the active file.

Symbol

Definition Provider

Shows definitions in the currently active file and its dependencies.

Definition

Colorpicker Provider

Shows the color picker if you got color or mark tags.

Copyright

Sloth icons created by Freepik - Flaticon