Workiva / scip-dart

Other
11 stars 2 forks source link

Setters generate invalid scip symbol #119

Open matthewnitschke-wk opened 7 months ago

matthewnitschke-wk commented 7 months ago

Given the following class, this is the snapshot that would be generated

class Foo {
  int _value = 0;

  get value => _value
//    ^^^^^ definition ... Foo#value

  set value(int newValue) => _value = newValue
//    ^^^^^ definition ... Foo#value=.
}

Sourcegraph treats symbols with the suffix =. as invalid and will error:

Screenshot 2024-02-07 at 2 59 03 PM

scip-typescript treats setters/getters the following way:

class Foo {
    private _value: number;

    public get value() {
//             ^^^^^ definition ... Foo#<get>value.
        return this._value;
    }

    public set value(value: number) {
//             ^^^^^ definition ... Foo#<set>value.
        this._value = value;
    }
}

// Note, that `+=` has both a reference to get and set
new Foo().value += 1;
//        ^^^^^ reference ... Foo#`<get>value`().
//        ^^^^^ reference ... Foo#`<set>value`().

we should mirror this pattern for scip-dart