UnderMyWheel / vscode-luau

Roblox Luau extension for Visual Studio Code
MIT License
12 stars 2 forks source link

Change luau.tmLanguage.json library function pattern name to support.function.library.luau #12

Open goldenstein64 opened 3 years ago

goldenstein64 commented 3 years ago

In my color theme (Atom One Dark), this would greatly help discern between keywords and library functions:

Lua Luau
image image
Some color themes are better at making this difference noticeable, like default Dark+: Lua Luau
image image
And some others are not, like Material Darker: Lua Luau
image image
or VS Dark: Lua Luau
image image

I wrote this in consideration of the vscode repository's existing Lua syntax highlighter (L234-237):

{
    "match": "(?<![^.]\\.|:)\\b(coroutine\\.(create|resume|running|status|wrap|yield)|string\\.(byte|char|dump|find|format|gmatch|gsub|len|lower|match|rep|reverse|sub|upper)|table\\.(concat|insert|maxn|remove|sort)|math\\.(abs|acos|asin|atan2?|ceil|cosh?|deg|exp|floor|fmod|frexp|ldexp|log|log10|max|min|modf|pow|rad|random|randomseed|sinh?|sqrt|tanh?)|io\\.(close|flush|input|lines|open|output|popen|read|tmpfile|type|write)|os\\.(clock|date|difftime|execute|exit|getenv|remove|rename|setlocale|time|tmpname)|package\\.(cpath|loaded|loadlib|path|preload|seeall)|debug\\.(debug|[gs]etfenv|[gs]ethook|getinfo|[gs]etlocal|[gs]etmetatable|getregistry|[gs]etupvalue|traceback))\\b(?=\\s*(?:[({\"']|\\[\\[))",
    "name": "support.function.library.lua"
},

It would also help to use constant highlighting for math.pi and math.huge like vscode repo does (L222-225), or just remove it altogether:

{
    "match": "(?<![^.]\\.|:)\\b(false|nil|true|_G|_VERSION|math\\.(pi|huge))\\b|(?<![.])\\.{3}(?!\\.)",
    "name": "constant.language.lua"
},

Although I would probably make the name of those two constant patterns support.constant.luau.

UnderMyWheel commented 3 years ago

Will look into better support for other themes.