diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2022-07-19 09:30:26 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-19 09:30:26 +0800 |
commit | 9ba0f94a8dfda662782f7234540bf289e371a284 (patch) | |
tree | 4d4ac104609859d7aa882ccd31f4590b58d50cc7 | |
parent | a92a8003600dc2a0dc867c31bd817320cf6f7c56 (diff) | |
parent | 6f2248ff0816164b31a3dd0e504cf36b0ad6b100 (diff) | |
download | lua-language-server-9ba0f94a8dfda662782f7234540bf289e371a284.zip |
Merge pull request #1347 from carsakiller/tag-descriptions
More tag descriptions
-rw-r--r-- | locale/en-us/script.lua | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/locale/en-us/script.lua b/locale/en-us/script.lua index 6f1a2bc6..d0066129 100644 --- a/locale/en-us/script.lua +++ b/locale/en-us/script.lua @@ -1022,3 +1022,60 @@ print(x) --> table --- [View Wiki](https://github.com/sumneko/lua-language-server/wiki/EmmyLua-Annotations#cast) ]=] +LUADOC_DESC_OPERATOR = +[=[ +Provide type declaration for [operator metamethods](http://lua-users.org/wiki/MetatableEvents). + +## Syntax +`@operator <operation>[(input_type)]:<resulting_type>` + +## Usage +### Vector Add Metamethod +``` +---@class Vector +---@operation add(Vector):Vector + +vA = Vector.new(1, 2, 3) +vB = Vector.new(10, 20, 30) + +vC = vA + vB +--> Vector +``` +### Unary Minus +``` +---@class Passcode +---@operation unm:integer + +pA = Passcode.new(1234) +pB = -pA +--> integer +``` +[View Request](https://github.com/sumneko/lua-language-server/issues/599) +]=] +LUADOC_DESC_ENUM = +[=[ +Mark a table as an enum. If you want an enum but can't define it as a Lua +table, take a look at the [`@alias`](https://github.com/sumneko/lua-language-server/wiki/EmmyLua-Annotations#alias) +tag. + +## Syntax +`@enum <name>` + +## Usage +``` +---@enum colors +local colors = { + white = 0, + orange = 2, + yellow = 4, + green = 8, + black = 16, +} + +---@param color colors +local function setColor(color) end + +-- Completion and hover is provided for the below param +setColor(colors.green) +``` +]=] |