Sarrus1 / sourcepawn-studio

VSCode extension for SourcePawn scripting
https://sarrus1.github.io/sourcepawn-studio/
MIT License
143 stars 22 forks source link

Incorrect error markup on methodmap functions returning an array #290

Closed KitRifty closed 1 year ago

KitRifty commented 1 year ago

Basic informations

Further Information

Member functions of methodmaps that return a char[] is incorrectly marked as an error. However, global functions are correctly not marked as errors.

EDIT: It appears to happen regardless of type. I've updated the example code and title.

Code to reproduce the behaviour

char[] MyStr() // this is fine
{
    char str[] = "this";
    return str;
}

int[] MyVec() // same as above
{
    int vec[] = { 0, 0, 0 };
    return vec;
}

float[] MyVec2() // same as above
{
    float vec[] = { 0.0, 0.0, 0.0 };
    return vec;
}

methodmap MyMethods
{
    public static char[] MyStr() // marked as error, specifically on the brackets
    {
        char str[] = "MyMethods";
        return str;
    }

    public static int[] MyVec() // same as above
    {
        int vec[] = { 0, 0, 0 };
        return vec;
    }

    public static float[] MyVec2() // same as above
    {
        float vec[] = { 0.0, 0.0, 0.0 };
        return vec;
    }
}

Expected behaviour

No errors.

Error messages

image

Sarrus1 commented 1 year ago

The original tree-sitter-sourcepawn seems to be inactive, I will use my fork for now.