ayecue / miniscript-vs

VSCode extension for MiniScript.
https://marketplace.visualstudio.com/items?itemName=ayecue.miniscript-vs
MIT License
3 stars 0 forks source link

miniscript-vs

Toolkit for MiniScript. Includes highlighting, code execution, bundling and minifying among other features. Check out the changelog to get information about the latest changes.

Ported over from greybel-vs.

Usage

Automatically detects .ms files.

Commands available (CTRL+SHIFT+P):

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

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

Features

Build

Transforms and bundles your files. It has three possible transformation types (Default, Uglify and Beautify) and supports environment variables as well.

Dependency Management (Transpiler)

This extension enables you to split your code into different files which is useful to keep readability and also to make reusable code.

Cyclic dependencies will be detected as well. In case there is one an error will be thrown indicating which file is causing it.

Import

Used to import exported namespaces from a file. Features of this import functionality:

You can take a look at the example code to get a better idea of how to use this feature.

Include

Used to import the content of a file. Features of this import functionality:

To get a better idea you can take a look at the following example code.

Environment Variables (Transpiler)

This extension supports the injection of environment variables while transpiling. The environment variables can be configured by using the extension settings.

Here is an example of environment variable injection.

Syntax

Keep in mind that the following syntax is not valid in MiniScript. The transpiler can be used to transform code into valid MiniScript.

No trailing comma is required in maps or lists
myList = [
    false,
    null
]

myMap = {
    "test": {
        "level2": {
            "bar": true
        }
    }
}
Block comment
/*
    My block comment
*/
print("test")

Transform

Transform is pretty much a simplified build. It will only transform the file at hand and ignore any imports.

Interpreter

Executes MiniScript code. Supports all default MiniScript intrinsics. Also features a debugger.

Start debug

Dependency Management (Interpreter)

Dependencies will be dynamically loaded into the execution without any limitations. Cyclic dependencies are supported as well.

Environment Variables (Interpreter)

This extension supports the injection of environment variables while executing code. The environment variables can be configured by using the extension settings.

Here is an example of environment variable injection.

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.

Breakpoint

Keep in mind to set the breakpoint on a non-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

Comment Docs

Provide signatures for your functions to show better hover tooltips. Additionally, the provided return value will be recognized by the implemented type system and thus result in context-sensitive auto-complete suggestions. In the future, it is planned to enable users to create their own custom types just by using comments.

// Hello world
// I am **bold**
// @description Alternative description
// @example test("title", 123)
// @param {string} title - The title of the book.
// @param {string|number} author - The author of the book.
// @return {map} - Some info about return
test = function(test, abc)
  print(test)
end function

Refresh

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

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