diff options
author | carsakiller <61925890+carsakiller@users.noreply.github.com> | 2022-11-11 15:14:59 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-11 15:14:59 -0500 |
commit | 9c6e57d1e703e342321b04a55e3a57bc598e8897 (patch) | |
tree | 4774470bf86cdffaf6ee779de1d9ffa91b2abe9a /locale | |
parent | 329d268cc63c82af81987b91b6e34b54536564a4 (diff) | |
download | lua-language-server-9c6e57d1e703e342321b04a55e3a57bc598e8897.zip |
Locale and completion additions for 3.6.0 annotations (#1683)
* add: new annotations to completion
* add: en-us descriptions for access modifiers
* add: en-us descriptions for other locales
* add: update @field description for `pt-br` and `zh-cn`
Diffstat (limited to 'locale')
-rw-r--r-- | locale/en-us/script.lua | 78 | ||||
-rw-r--r-- | locale/pt-br/script.lua | 76 | ||||
-rw-r--r-- | locale/zh-cn/script.lua | 76 | ||||
-rw-r--r-- | locale/zh-tw/script.lua | 73 |
4 files changed, 299 insertions, 4 deletions
diff --git a/locale/en-us/script.lua b/locale/en-us/script.lua index 9fceac00..0361ee77 100644 --- a/locale/en-us/script.lua +++ b/locale/en-us/script.lua @@ -790,10 +790,11 @@ function getTags(item) end LUADOC_DESC_FIELD = [=[ Declare a field in a class/table. This allows you to provide more in-depth -documentation for a table. +documentation for a table. As of `v3.6.0`, you can mark a field as `private`, +`protected`, `public`, or `package`. ## Syntax -`---@field <name> <type> [description]` +`---@field [scope] <name> <type> [description]` ## Usage ``` @@ -1126,3 +1127,76 @@ local function setColor(color) end setColor(colors.green) ``` ]=] +LUADOC_DESC_PACKAGE = +[=[ +Mark a function as private to the file it is defined in. A packaged function +cannot be accessed from another file. + +## Syntax +`@package` + +## Usage +``` +---@class Animal +---@field private eyes integer +local Animal = {} + +---@package +---This cannot be accessed in another file +function Animal:eyesCount() + return self.eyes +end +``` +]=] +LUADOC_DESC_PRIVATE = +[=[ +Mark a function as private to a @class. Private functions can be accessed only +from within their class and are not accessable from child classes. + +## Syntax +`@private` + +## Usage +``` +---@class Animal +---@field private eyes integer +local Animal = {} + +---@private +function Animal:eyesCount() + return self.eyes +end + +---@class Dog:Animal +local myDog = {} + +---NOT PERMITTED! +myDog:eyesCount(); +``` +]=] +LUADOC_DESC_PROTECTED = +[=[ +Mark a function as protected within a @class. Protected functions can be +accessed only from within their class or from child classes. + +## Syntax +`@protected` + +## Usage +``` +---@class Animal +---@field private eyes integer +local Animal = {} + +---@protected +function Animal:eyesCount() + return self.eyes +end + +---@class Dog:Animal +local myDog = {} + +---Permitted because function is protected, not private. +myDog:eyesCount(); +``` +]=] diff --git a/locale/pt-br/script.lua b/locale/pt-br/script.lua index 2e0b0aa6..0d0d0933 100644 --- a/locale/pt-br/script.lua +++ b/locale/pt-br/script.lua @@ -790,7 +790,8 @@ function getTags(item) end LUADOC_DESC_FIELD = -- TODO: need translate! [=[ Declare a field in a class/table. This allows you to provide more in-depth -documentation for a table. +documentation for a table. As of `v3.6.0`, you can mark a field as `private`, +`protected`, `public`, or `package`. ## Syntax `---@field <name> <type> [description]` @@ -1126,3 +1127,76 @@ local function setColor(color) end setColor(colors.green) ``` ]=] +LUADOC_DESC_PACKAGE = -- TODO: need translate! +[=[ +Mark a function as private to the file it is defined in. A packaged function +cannot be accessed from another file. + +## Syntax +`@package` + +## Usage +``` +---@class Animal +---@field private eyes integer +local Animal = {} + +---@package +---This cannot be accessed in another file +function Animal:eyesCount() + return self.eyes +end +``` +]=] +LUADOC_DESC_PRIVATE = -- TODO: need translate! +[=[ +Mark a function as private to a @class. Private functions can be accessed only +from within their class and are not accessable from child classes. + +## Syntax +`@private` + +## Usage +``` +---@class Animal +---@field private eyes integer +local Animal = {} + +---@private +function Animal:eyesCount() + return self.eyes +end + +---@class Dog:Animal +local myDog = {} + +---NOT PERMITTED! +myDog:eyesCount(); +``` +]=] +LUADOC_DESC_PROTECTED = -- TODO: need translate! +[=[ +Mark a function as protected within a @class. Protected functions can be +accessed only from within their class or from child classes. + +## Syntax +`@protected` + +## Usage +``` +---@class Animal +---@field private eyes integer +local Animal = {} + +---@protected +function Animal:eyesCount() + return self.eyes +end + +---@class Dog:Animal +local myDog = {} + +---Permitted because function is protected, not private. +myDog:eyesCount(); +``` +]=] diff --git a/locale/zh-cn/script.lua b/locale/zh-cn/script.lua index 5e451a51..3c7a7fd2 100644 --- a/locale/zh-cn/script.lua +++ b/locale/zh-cn/script.lua @@ -790,7 +790,8 @@ function getTags(item) end LUADOC_DESC_FIELD = -- TODO: need translate! [=[ Declare a field in a class/table. This allows you to provide more in-depth -documentation for a table. +documentation for a table. As of `v3.6.0`, you can mark a field as `private`, +`protected`, `public`, or `package`. ## Syntax `---@field <name> <type> [description]` @@ -1126,3 +1127,76 @@ local function setColor(color) end setColor(colors.green) ``` ]=] +LUADOC_DESC_PACKAGE = -- TODO: need translate! +[=[ +Mark a function as private to the file it is defined in. A packaged function +cannot be accessed from another file. + +## Syntax +`@package` + +## Usage +``` +---@class Animal +---@field private eyes integer +local Animal = {} + +---@package +---This cannot be accessed in another file +function Animal:eyesCount() + return self.eyes +end +``` +]=] +LUADOC_DESC_PRIVATE = -- TODO: need translate! +[=[ +Mark a function as private to a @class. Private functions can be accessed only +from within their class and are not accessable from child classes. + +## Syntax +`@private` + +## Usage +``` +---@class Animal +---@field private eyes integer +local Animal = {} + +---@private +function Animal:eyesCount() + return self.eyes +end + +---@class Dog:Animal +local myDog = {} + +---NOT PERMITTED! +myDog:eyesCount(); +``` +]=] +LUADOC_DESC_PROTECTED = -- TODO: need translate! +[=[ +Mark a function as protected within a @class. Protected functions can be +accessed only from within their class or from child classes. + +## Syntax +`@protected` + +## Usage +``` +---@class Animal +---@field private eyes integer +local Animal = {} + +---@protected +function Animal:eyesCount() + return self.eyes +end + +---@class Dog:Animal +local myDog = {} + +---Permitted because function is protected, not private. +myDog:eyesCount(); +``` +]=] diff --git a/locale/zh-tw/script.lua b/locale/zh-tw/script.lua index a31c0d67..84c23f8a 100644 --- a/locale/zh-tw/script.lua +++ b/locale/zh-tw/script.lua @@ -1121,3 +1121,76 @@ local function setColor(color) end setColor(colors.green) ``` ]=] +LUADOC_DESC_PACKAGE = -- TODO: need translate! +[=[ +Mark a function as private to the file it is defined in. A packaged function +cannot be accessed from another file. + +## Syntax +`@package` + +## Usage +``` +---@class Animal +---@field private eyes integer +local Animal = {} + +---@package +---This cannot be accessed in another file +function Animal:eyesCount() + return self.eyes +end +``` +]=] +LUADOC_DESC_PRIVATE = -- TODO: need translate! +[=[ +Mark a function as private to a @class. Private functions can be accessed only +from within their class and are not accessable from child classes. + +## Syntax +`@private` + +## Usage +``` +---@class Animal +---@field private eyes integer +local Animal = {} + +---@private +function Animal:eyesCount() + return self.eyes +end + +---@class Dog:Animal +local myDog = {} + +---NOT PERMITTED! +myDog:eyesCount(); +``` +]=] +LUADOC_DESC_PROTECTED = -- TODO: need translate! +[=[ +Mark a function as protected within a @class. Protected functions can be +accessed only from within their class or from child classes. + +## Syntax +`@protected` + +## Usage +``` +---@class Animal +---@field private eyes integer +local Animal = {} + +---@protected +function Animal:eyesCount() + return self.eyes +end + +---@class Dog:Animal +local myDog = {} + +---Permitted because function is protected, not private. +myDog:eyesCount(); +``` +]=] |