Options
All
  • Public
  • Public/Protected
  • All
Menu

Namespace utils

Index

Functions

  • Mostly for internal use by autosuggest .

    Returns all error tokens immediately before/after cursor (since there might be multiple error tokens one after the other).

    The errors are sorted by closeness to the given cursor (inside CursorInfo), with quote errors having priority, then paren errors, then any other errors. They can be sorted by closeness because although two errors might follow each other, their positions might be different because of whitespace, but they can still be fixed from any cursor position between their ends.

    For example:

    a a"
    ^ operator missing at 1
    ^ doublequote missing at 2
    if the cursor is at 1 (`a| a"`):
    errors = [operator, doublequote]
    if the cursor is at 2 (`a |a"`):
    errors = [doublequote, operator]

    either insertion would fix the issue for either position would fix the issue, albeit with different results

    Parameters

    Returns ErrorToken[]

  • Returns a more compressed, color coded, string representation of the ast for debugging.

    There are options to change which symbols are used for tree and if the variables are surrounded by quotes (default false).

    Colors can changed by passing ansi codes (or whatever you want*) to the third parameter. Or you can pass false instead of an object to disable them. Default colors are:

    {
    values: // yellow,
    position: // green,
    info: // cyan,
    hint: // blue,
    error: // red,
    reset: // ansi reset code
    }

    * For example, you could pass html tags to show this in the browser instead (this is how the demo works). This is why the reset color is exposed. For example, a color might be <span class="error"> and reset can be </span>.

    Parameters

    Returns string

Generated using TypeDoc