sashi0034 / angel-lsp

AngelScript Language Server for VSCode
https://marketplace.visualstudio.com/items?itemName=sashi0034.angel-lsp
MIT License
14 stars 5 forks source link

string-type class cannot be converted to string error #11

Open Kizoky opened 1 month ago

Kizoky commented 1 month ago

image

Declaration(s):

class string_t
{
    string_t();
    string_t(const string_t&in str);
    string_t(const string&in str);
    string_t& opAssign(const string_t&in str);
    string_t& opAssign(const string&in str);
    string opImplConv() const;
    string ToString() const;
}
class string
{
    ~string();
    string();
    string(const string&in);
    string(string&in, ?&in var = 0, ?&in var2 = 0, ?&in var3 = 0, ?&in var4 = 0, ?&in var5 = 0, ?&in var6 = 0, ?&in var7 = 0, ?&in var8 = 0, ?&in var9 = 0, ?&in var10 = 0, ?&in var11 = 0, ?&in var12 = 0, ?&in var13 = 0, ?&in var14 = 0, ?&in var15 = 0);
    string& opAssign(const string&in);
    string& opAddAssign(const string&in);
    bool opEquals(const string&in) const;
    int opCmp(const string&in) const;
    string opAdd(const string&in) const;
    uint length() const;
    void resize(uint);
    bool isEmpty() const;
    uint8& opIndex(uint);
    const uint8& opIndex(uint) const;
    string& opAssign(double);
    string& opAddAssign(double);
    string opAdd(double) const;
    string opAdd_r(double) const;
    string& opAssign(int64);
    string& opAddAssign(int64);
    string opAdd(int64) const;
    string opAdd_r(int64) const;
    string& opAssign(uint64);
    string& opAddAssign(uint64);
    string opAdd(uint64) const;
    string opAdd_r(uint64) const;
    string& opAssign(bool);
    string& opAddAssign(bool);
    string opAdd(bool) const;
    string opAdd_r(bool) const;
    string substr(uint start = 0, int count = - 1) const;
    int findFirst(const string&in, uint start = 0) const;
    int findFirstOf(const string&in, uint start = 0) const;
    int findFirstNotOf(const string&in, uint start = 0) const;
    int findLast(const string&in, int start = - 1) const;
    int findLastOf(const string&in, int start = - 1) const;
    int findLastNotOf(const string&in, int start = - 1) const;
    void insert(uint pos, const string&in other);
    void erase(uint pos, int count = - 1);
    void toLower();
    void toUpper();
    void toReverse();
    void format(string&in, ?&in var = 0, ?&in var2 = 0, ?&in var3 = 0, ?&in var4 = 0, ?&in var5 = 0, ?&in var6 = 0, ?&in var7 = 0, ?&in var8 = 0, ?&in var9 = 0, ?&in var10 = 0, ?&in var11 = 0, ?&in var12 = 0, ?&in var13 = 0, ?&in var14 = 0, ?&in var15 = 0);
}

This does work in AngelScript just fine.

sashi0034 commented 1 month ago

Thanks for the report.

Kizoky commented 1 month ago

oh so this is hardcoded? wouldn't it be better if there was a way to flag a class to be used as a string? (since string_t does not exist in other projects, I believe it's only a Source Engine feature)

sashi0034 commented 1 month ago

I see what you mean, and I agree that this approach might not be ideal. If you have any suggestions for a better solution, I would love to hear them.

My ideas are:

  1. Make it configurable through user settings. in VSCode
  2. Introduce an attribute like [UseAsString] to handle string literals.
    [UseAsString]
    class string{
    ...
    }
Kizoky commented 1 month ago

I see what you mean, and I agree that this approach might not be ideal. If you have any suggestions for a better solution, I would love to hear them.

My ideas are:

  1. Make it configurable through user settings. in VSCode
  2. Introduce an attribute like [UseAsString] to handle string literals.
[UseAsString]
class string{
   ...
}

Yes, that sounds good!