diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2018-12-17 17:40:26 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2018-12-17 17:40:26 +0800 |
commit | 3e29347d5bc2ad144fb54c5c129f1d8cbcb48b24 (patch) | |
tree | 1a4b83b3358b5157d6ae9b23b8ad7e23364ff7a3 /server | |
parent | d100653958dfaa5a719f05deaf0557d178fe8a86 (diff) | |
download | lua-language-server-3e29347d5bc2ad144fb54c5c129f1d8cbcb48b24.zip |
更新库
Diffstat (limited to 'server')
-rw-r--r-- | server/libs/lua53/basic.lni | 2 | ||||
-rw-r--r-- | server/locale/en-US/libs/lua53/basic.lni | 106 | ||||
-rw-r--r-- | server/src/matcher/hover.lua | 8 | ||||
-rw-r--r-- | server/src/matcher/library.lua | 6 | ||||
-rw-r--r-- | server/test/hover/init.lua | 8 |
5 files changed, 116 insertions, 14 deletions
diff --git a/server/libs/lua53/basic.lni b/server/libs/lua53/basic.lni index 45d3aad3..92303c4a 100644 --- a/server/libs/lua53/basic.lni +++ b/server/libs/lua53/basic.lni @@ -123,6 +123,7 @@ enum = 't' [[.enums]] name = 'mode' enum = 'bt' +default = true [loadfile] [[.args]] @@ -151,6 +152,7 @@ enum = 't' [[.enums]] name = 'mode' enum = 'bt' +default = true [next] [[.args]] diff --git a/server/locale/en-US/libs/lua53/basic.lni b/server/locale/en-US/libs/lua53/basic.lni index e600857f..719324ce 100644 --- a/server/locale/en-US/libs/lua53/basic.lni +++ b/server/locale/en-US/libs/lua53/basic.lni @@ -1,60 +1,150 @@ [assert] +description = 'Calls error if the value of its argument is false.' [collectgarbage] [[.enums]] +name = 'opt' enum = 'collect' -description = 'performs a full garbage-collection cycle. This is the default option.' +description = 'Performs a full garbage-collection cycle.' [[.enums]] -enum = 'isrunning' -description = 'returns a boolean that tells whether the collector is running (i.e., not stopped).' +name = 'opt' +enum = 'stop' +description = 'Stops automatic execution.' +[[.enums]] +name = 'opt' +enum = 'restart' +description = 'Restarts automatic execution.' [[.enums]] +name = 'opt' enum = 'count' -description = 'returns the total memory in use by Lua in Kbytes. The value has a fractional part, so that it multiplied by 1024 gives the exact number of bytes in use by Lua (except for overflows).' +description = 'Returns the total memory in Kbytes.' +[[.enums]] +name = 'opt' +enum = 'step' +description = 'Performs a garbage-collection step.' +[[.enums]] +name = 'opt' +enum = 'setpause' +description = 'Set pause.' +[[.enums]] +name = 'opt' +enum = 'setstepmul' +description = 'Set step multiplier.' +[[.enums]] +name = 'opt' +enum = 'isrunning' +description = 'Returns whether the collector is running.' [dofile] +description = 'Opens the named file and executes its contents as a Lua chunk.' [error] +description = 'Terminates the last protected function called and returns message as the error object.' [_G] -description = 'A global variable (not a function) that holds the global environment' -[[.fields]] -field = '_G' -description = 'A global variable (not a function) that holds the global environment' +description = 'Holds the global environment.' [getmetatable] +description = 'Returns the metatable of the given object.' [ipairs] +description = [[ +---------------- +```lua +for i, v in ipairs(t) do + body +end +``` +]] [load] +description = 'Loads a chunk.' +[[.enums]] +name = 'mode' +enum = 'b' +description = 'Only binary chunks.' +[[.enums]] +name = 'mode' +enum = 't' +description = 'Only text chunks.' +[[.enums]] +name = 'mode' +enum = 'bt' +description = 'Both binary and text.' [loadfile] +description = 'Loads a chunk from file.' +[[.enums]] +name = 'mode' +enum = 'b' +description = 'Only binary chunks.' +[[.enums]] +name = 'mode' +enum = 't' +description = 'Only text chunks.' +[[.enums]] +name = 'mode' +enum = 'bt' +description = 'Both binary and text.' [next] +description = 'Returns the next index of the table and its associated value.' [pairs] +description = [[ +---------------- +```lua +for k, v in pairs(t) do + body +end +``` +]] [pcall] +description = 'Calls function with the given arguments in protected mode.' [print] +description = 'Receives any number of arguments and prints their values to stdout.' [rawequal] +description = 'Checks whether v1 is equal to v2.' [rawget] +description = 'Gets the real value of table[index].' [rawlen] +description = 'Returns the length of the object v.' [rawset] +description = 'Sets the real value of table[index] to value.' [select] +[[.enums]] +name = 'index' +enum = '#' +description = 'Returns the total number of extra arguments.' +[[.enums]] +name = 'index' +code = 'integer' +description = 'Returns all arguments after number index.' [setmetatable] +description = 'Sets the metatable for the given table.' [tonumber] +description = 'Tries to convert its argument to a number.' [tostring] +description = 'Receives a value of any type and converts it to a string in a human-readable format.' [type] +description = 'Returns the type of its only argument, coded as a string.' [_VERSION] +description = 'Running Lua version.' [xpcall] +description = 'Calls function f with the given arguments in protected mode with a new message handler.' + +[require] +description = 'Loads the given module.' diff --git a/server/src/matcher/hover.lua b/server/src/matcher/hover.lua index f546734a..0db15bf8 100644 --- a/server/src/matcher/hover.lua +++ b/server/src/matcher/hover.lua @@ -324,23 +324,27 @@ local function getValueHover(name, valueType, result, source, lib) end local value + local tip if lib then value = lib.value + tip = lib.description or '' else value = result.value.value + tip = '' end local text if value == nil then text = ('%s %s'):format(valueType, name) else - text = ('%s %s = %s'):format(valueType, name, value) + text = ('%s %s = %q'):format(valueType, name, value) end return ([[ ```lua %s ``` -]]):format(text) +%s +]]):format(text, tip) end return function (vm, pos) diff --git a/server/src/matcher/library.lua b/server/src/matcher/library.lua index f6211431..5b150513 100644 --- a/server/src/matcher/library.lua +++ b/server/src/matcher/library.lua @@ -10,11 +10,17 @@ local function mergeEnum(lib, locale) if enum.enum then pack[enum.enum] = enum end + if enum.code then + pack[enum.code] = enum + end end for _, enum in ipairs(locale) do if pack[enum.enum] then pack[enum.enum].description = enum.description end + if pack[enum.code] then + pack[enum.code].description = enum.description + end end end diff --git a/server/test/hover/init.lua b/server/test/hover/init.lua index a5e11a74..052b0cfd 100644 --- a/server/test/hover/init.lua +++ b/server/test/hover/init.lua @@ -166,11 +166,11 @@ TEST [[ [=[ function load(chunk: string/function [, chunkname: string [, mode: string [, env: table]]]) -> function, error_message: string - +Loads a chunk. mode: string - | "b" - | "t" - | "bt" + | "b" -- Only binary chunks. + | "t" -- Only text chunks. + -> "bt" -- Both binary and text. ]=] TEST [[ |