diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2019-12-09 19:55:26 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2019-12-09 19:55:26 +0800 |
commit | 9e193c1d17d64137191c5aa9e4f39c18a795396f (patch) | |
tree | a9a56b53f43f2c44f3a7b92fde3034e926da17ac | |
parent | a07c958b56aaa48ce2d9ad7b764df596692bedfb (diff) | |
download | lua-language-server-9e193c1d17d64137191c5aa9e4f39c18a795396f.zip |
转成数字再比较
-rw-r--r-- | script-beta/core/hover/table.lua | 2 | ||||
-rw-r--r-- | test-beta/hover/init.lua | 14 |
2 files changed, 15 insertions, 1 deletions
diff --git a/script-beta/core/hover/table.lua b/script-beta/core/hover/table.lua index c6d93d03..71f90b97 100644 --- a/script-beta/core/hover/table.lua +++ b/script-beta/core/hover/table.lua @@ -89,7 +89,7 @@ local function buildAsConst(classes, literals) keys[#keys+1] = k end table.sort(keys, function (a, b) - return literals[a][1] < literals[b][1] + return tonumber(literals[a][1]) < tonumber(literals[b][1]) end) local lines = {} lines[#lines+1] = '{' diff --git a/test-beta/hover/init.lua b/test-beta/hover/init.lua index e13840a8..418008bf 100644 --- a/test-beta/hover/init.lua +++ b/test-beta/hover/init.lua @@ -588,6 +588,13 @@ local <?t?> = { c = 2, d = 3, a = 4, + s = 5, + y = 6, + z = 7, + q = 8, + g = 9, + p = 10, + l = 11, } ]] [[ @@ -596,6 +603,13 @@ local t: { c: integer = 2, d: integer = 3, a: integer = 4, + s: integer = 5, + y: integer = 6, + z: integer = 7, + q: integer = 8, + g: integer = 9, + p: integer = 10, + l: integer = 11, } ]] |