Sarrus1 / sourcepawn-studio

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

Code assistance breaks inside partial for loops inside methodmaps/enum structs #406

Open Alienmario opened 1 month ago

Alienmario commented 1 month ago

Basic informations

Further Information

If a for loop inside enum struct or methodmap method has less than 3 control parameters, code assistance will break for other methods or properties inside of it.


methodmap Foo
{
    public int bar()
    {
        for (;;)
        {
            return (this.GetVal() + this.prop);
            //              ^              ^
        }
    }

    public int GetVal()
    {
        return 1;
    }

    property int prop
    {
        public get()
        {
            return 1;
        }
    }
}

enum struct Foo2
{
    int val;

    int bar()
    {
        for (;;)
        {
            return (this.GetVal());
            //              ^
        }
    }

    int GetVal()
    {
        return this.val;
    }
}
stas11s11t commented 1 month ago
void Func()
{
    ArrayList ar;

    for (int i = 1; --i >= 0;) {
        ar.Get(i); // If you hover your mouse over "Get", the hint DOES NOT WORK.
    }

    ar.Get(0); // But here the hint WORKS.
}
int var1;

for (int var2 = -1; ++var2 < 1;) {
    if (var2) { // When we start typing "var2", there are only "var1" in the hint list. So there is a problem with loop "for".

    }
}

And another bad thing is that if a constant is declared as a function with parameters #define F(%0), then the comment is not displayed in the hint.