Skip to content

variableCategories examples

zero-plusplus edited this page Dec 12, 2021 · 4 revisions

Recommend configuration

If you set recommend for variableCategories, the following will be set.

"variableCategories": [
    {
        "label": "Local",
        "source": "Local",
    },
    {
        "label": "Static",
        "source": "Static",
    },
    {
        "label": "Global",
        "source": "Global",
        "noduplicate": true,
        "matchers": [
            {
                "method": "exclude",
                "pattern": "^\\d+$"
            }
        ],
    },
    {
        "label": "Built-in Global",
        "source": "Global",
        "matchers": [
            {
                "builtin": true
            },
            {
                "method": "exclude",
                "pattern": "^\\d+$"
            },
        ],
    },
],

Categorize customary constant variables

"variableCategories": [
    "Local",
    {
        "label": "Global",
        "source": "Global",
        "noduplicate": true,
    },
    {
        "label": "Constant",
        "source": "Global",
        "matchers": [
            {
              "pattern": "^[A-Z_]+$",
              "ignorecase": false,
            },
        ],
    },
],

Configuration for v2

Built-in functions, for example, are only shown in v2. Therefore, if you debug a v1 script with the same settings, you will see unwanted categories.

To hide these unwanted categories, specify "auto" for the hidden attribute.

Categorize only built-in global functions

"variableCategories": [
    "Local",
    {
        "label": "Global",
        "source": "Global",
        "noduplicate": true,
    },
    {
        "label": "Built-in Func",
        "source": "Global",
        "hidden": "auto",
        "matchers": [
            {
                "className": "Func",
                "builtin": true,
            },
        ],
    },
],

Categorize only built-in classes

"variableCategories": [
    "Local",
    {
        "label": "Global",
        "source": "Global",
        "noduplicate": true,
    },
    {
        "label": "Built-in Classes",
        "source": "Global",
        "hidden": "auto",
        "matchers": [
            {
                "className": "Class",
                "builtin": true,
            },
        ],
    },
],
Clone this wiki locally