LuaLS / lua-language-server

A language server that offers Lua language support - programmed in Lua
https://luals.github.io
MIT License
3.39k stars 320 forks source link

[Request] Add dollar sign ($) as a non-standard symbol #1897

Open vortex104 opened 1 year ago

vortex104 commented 1 year ago

The games Sonic Robo Blast 2 and Sonic Robo Blast 2 Kart use the dollar sign symbol for a sort of replacement for assignment operators.

Example 1

local a = 1
a = $ | 2

is equivalent to

local a = 1
a = a | 2

Example 2

local tbl = {
    a = 1
}
tbl.a = $ | 2

is equivalent to

local tbl = {
    a = 1
}
tbl.a = tbl.a | 2

Example 3

playerMo.flags = $ & ~MF_NOGRAVITY

is equivalent to

playerMo.flags = playerMo.flags & ~MF_NOGRAVITY
firas-assaad commented 1 year ago

Looking at the other differences on their wiki, wouldn't you need to support all the other changes as well? https://wiki.srb2.org/wiki/Lua#Changes_from_standard_Lua

vortex104 commented 1 year ago

I actually didn't know about most of those. I have only been having problems with the dollar sign issue. It would be useful to have the rest of those included as well.

The comments, continue, and not equals operator are already implemented. I think the string substitution and concatenation could probably be ignored, so I think the only other things that would need to be implemented would be the XOR operator and the pseudo-numbers. I don't know how the non-standard symbols setting works, so I don't know if the pseudo-numbers would be easy to implement with the current system.

Should I just edit the issue to say "Implement Sonic Robo Blast 2 non-standard symbols" then?

sumneko commented 1 year ago

You may use https://github.com/LuaLS/lua-language-server/wiki/Plugins

LJSonik commented 1 year ago

It is probably worth mentioning that I already have a fork of vscode-lua that supports SRB2's $ syntax, although it is not currently published anywhere public yet.