From 6a9e89ad342ec169842ea7a225d0e149155b4c46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Fri, 17 Jun 2022 15:38:28 +0800 Subject: cleanup --- test/crossfile/completion.lua | 29 ++--------------------------- 1 file changed, 2 insertions(+), 27 deletions(-) (limited to 'test/crossfile') diff --git a/test/crossfile/completion.lua b/test/crossfile/completion.lua index 79762646..4e573c0e 100644 --- a/test/crossfile/completion.lua +++ b/test/crossfile/completion.lua @@ -5,36 +5,11 @@ local platform = require 'bee.platform' local util = require 'utility' local config = require 'config' local catch = require 'catch' +local define = require 'proto.define' rawset(_G, 'TEST', true) -local CompletionItemKind = { - Text = 1, - Method = 2, - Function = 3, - Constructor = 4, - Field = 5, - Variable = 6, - Class = 7, - Interface = 8, - Module = 9, - Property = 10, - Unit = 11, - Value = 12, - Enum = 13, - Keyword = 14, - Snippet = 15, - Color = 16, - File = 17, - Reference = 18, - Folder = 19, - EnumMember = 20, - Constant = 21, - Struct = 22, - Event = 23, - Operator = 24, - TypeParameter = 25, -} +local CompletionItemKind = define.CompletionItemKind local EXISTS = {} -- cgit v1.2.3 From 99691a901cc26bc44720ced49729d436a09129ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Mon, 20 Jun 2022 15:54:56 +0800 Subject: update --- test/crossfile/hover.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test/crossfile') diff --git a/test/crossfile/hover.lua b/test/crossfile/hover.lua index 0bf8165b..08cde574 100644 --- a/test/crossfile/hover.lua +++ b/test/crossfile/hover.lua @@ -58,8 +58,8 @@ function TEST(expect) local hover = core.byUri(sourceUri, sourcePos) assert(hover) - hover = tostring(hover):gsub('\r\n', '\n') - assert(eq(hover, expect.hover)) + local content = tostring(hover):gsub('\r\n', '\n') + assert(eq(content, expect.hover)) end TEST { -- cgit v1.2.3 From c65de666e0a3706b921993648910ef531c47c607 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Mon, 20 Jun 2022 20:58:56 +0800 Subject: update --- test/crossfile/hover.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/crossfile') diff --git a/test/crossfile/hover.lua b/test/crossfile/hover.lua index 08cde574..b9ffd59b 100644 --- a/test/crossfile/hover.lua +++ b/test/crossfile/hover.lua @@ -811,7 +811,7 @@ food.secondField = 2 }, hover = [[ ```lua -(field) Food.firstField: number = 0 +(field) Food.firstField: number ```]]} TEST {{ path = 'a.lua', content = '', }, { -- cgit v1.2.3 From c78fbf09aa4406db905a8a0e6dd5731871f2c262 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Sun, 26 Jun 2022 01:31:45 +0800 Subject: #1207 return names and parentheses can be used in `DocFunction` --- test/crossfile/hover.lua | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'test/crossfile') diff --git a/test/crossfile/hover.lua b/test/crossfile/hover.lua index b9ffd59b..c6991d8f 100644 --- a/test/crossfile/hover.lua +++ b/test/crossfile/hover.lua @@ -1158,3 +1158,26 @@ TEST { --- The color of your awesome apple!]] } + +TEST { + { + path = 'a.lua', + content = [[ + ---@type fun(x: number, y: number, ...: number):(x: number, y: number, ...: number) + local + ]] + }, + hover = [[ +```lua +local f: fun(x: number, y: number, ...number):(x: number, y: number, ...number) +``` + +--- + +```lua +function f(x: number, y: number, ...: number) + -> x: number + 2. y: number + 3. ...number +```]] +} -- cgit v1.2.3 From fc4e8ef687ad996f96091c664c6a9110dd087a5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Sun, 26 Jun 2022 01:42:35 +0800 Subject: #1207 split `...(param)` and `...(return)` displayed in enums of hover --- test/crossfile/hover.lua | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'test/crossfile') diff --git a/test/crossfile/hover.lua b/test/crossfile/hover.lua index c6991d8f..827c440c 100644 --- a/test/crossfile/hover.lua +++ b/test/crossfile/hover.lua @@ -1181,3 +1181,42 @@ function f(x: number, y: number, ...: number) 3. ...number ```]] } + +TEST { + { + path = 'a.lua', + content = [[ + ---@param p 'a1' | 'a2' + ---@param ... 'a3' | 'a4' + ---@return 'r1' | 'r2' ret1 + ---@return 'r3' | 'r4' ... + local function (p, ...) end + ]] + }, + hover = [[ +```lua +function f(p: 'a1'|'a2', ...'a3'|'a4') + -> ret1: 'r1'|'r2' + 2. ...'r3'|'r4' +``` + +--- + +```lua +p: + | 'a1' + | 'a2' + +...(param): + | 'a3' + | 'a4' + +ret1: + | 'r1' + | 'r2' + +...(return): + | 'r3' + | 'r4' +```]] +} -- cgit v1.2.3 From f5464ddc9a8e043977f27e70d9f1dfc2be56b02e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Thu, 7 Jul 2022 15:38:18 +0800 Subject: `boolean` kick `true` and `false` --- test/crossfile/hover.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/crossfile') diff --git a/test/crossfile/hover.lua b/test/crossfile/hover.lua index 827c440c..69aa9239 100644 --- a/test/crossfile/hover.lua +++ b/test/crossfile/hover.lua @@ -681,7 +681,7 @@ TEST {{ path = 'a.lua', content = '', }, { }, hover = [[ ```lua -function f(a: boolean|true|false) +function f(a: boolean) ``` --- -- cgit v1.2.3 From d50a75aac341d6b87caadb3eb9b863cb8ebe2751 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Thu, 7 Jul 2022 19:39:41 +0800 Subject: resolve #970 read comments in `---@type` --- test/crossfile/hover.lua | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'test/crossfile') diff --git a/test/crossfile/hover.lua b/test/crossfile/hover.lua index 69aa9239..e391014d 100644 --- a/test/crossfile/hover.lua +++ b/test/crossfile/hover.lua @@ -1220,3 +1220,20 @@ ret1: | 'r4' ```]] } + +TEST { + { + path = 'a.lua', + content = [[ + ---@type integer @ comments + local + ]] + }, + hover = [[ +```lua +local n: integer +``` + +--- + comments]] +} -- cgit v1.2.3 From baecde8be338fbf2118b2064a8d64c1d5734bb9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Mon, 11 Jul 2022 21:03:16 +0800 Subject: resolve #1066 dose not show unknown `---@XXX` as description --- test/crossfile/hover.lua | 72 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) (limited to 'test/crossfile') diff --git a/test/crossfile/hover.lua b/test/crossfile/hover.lua index e391014d..43b80f28 100644 --- a/test/crossfile/hover.lua +++ b/test/crossfile/hover.lua @@ -1237,3 +1237,75 @@ local n: integer --- comments]] } + +TEST { + { + path = 'a.lua', + content = [[ + --- comments + ---@type integer + local + ]] + }, + hover = [[ +```lua +local n: integer +``` + +--- + comments]] +} + +TEST { + { + path = 'a.lua', + content = [[ + ---@type integer + --- comments + local + ]] + }, + hover = [[ +```lua +local n: integer +``` + +--- + comments]] +} + +TEST { + { + path = 'a.lua', + content = [[ + ---@TODO XXXX + ---@type integer @ comments + local + ]] + }, + hover = [[ +```lua +local n: integer +``` + +--- + comments]] +} + +TEST { + { + path = 'a.lua', + content = [[ + ---@type integer @ comments + ---@TODO XXXX + local + ]] + }, + hover = [[ +```lua +local n: integer +``` + +--- + comments]] +} -- cgit v1.2.3 From ecffa11c6f5f296856428743f5763abde16c4b85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Tue, 12 Jul 2022 20:19:10 +0800 Subject: resolve #1124 supports path in link --- test/crossfile/hover.lua | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'test/crossfile') diff --git a/test/crossfile/hover.lua b/test/crossfile/hover.lua index 43b80f28..fe6e7233 100644 --- a/test/crossfile/hover.lua +++ b/test/crossfile/hover.lua @@ -1309,3 +1309,37 @@ local n: integer --- comments]] } + +TEST { + { + path = 'a.lua', + content = [[ + --[here](x.lua) + local + ]] + }, + hover = [[ +```lua +local n: unknown +``` + +--- +[here](file:///x.lua)]] +} + +TEST { + { + path = 'a.lua', + content = [[ + --[here](D:/x.lua) + local + ]] + }, + hover = [[ +```lua +local n: unknown +``` + +--- +[here](file:///d%3A/x.lua)]] +} -- cgit v1.2.3 From b6eff58cb1752a8060a72de56dcce7d1dff6ea6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Fri, 15 Jul 2022 15:26:03 +0800 Subject: fix --- test/crossfile/hover.lua | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'test/crossfile') diff --git a/test/crossfile/hover.lua b/test/crossfile/hover.lua index fe6e7233..3c62b8f8 100644 --- a/test/crossfile/hover.lua +++ b/test/crossfile/hover.lua @@ -1343,3 +1343,20 @@ local n: unknown --- [here](file:///d%3A/x.lua)]] } + +TEST { + { + path = 'a.lua', + content = [[ + --[here](command:xxxxx) + local + ]] + }, + hover = [[ +```lua +local n: unknown +``` + +--- +[here](command:xxxxx)]] +} -- cgit v1.2.3 From ac3235f4e9b800b0726a2e90555b109d5b58abfb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Fri, 15 Jul 2022 17:11:11 +0800 Subject: fix hover --- test/crossfile/hover.lua | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'test/crossfile') diff --git a/test/crossfile/hover.lua b/test/crossfile/hover.lua index 3c62b8f8..84276a27 100644 --- a/test/crossfile/hover.lua +++ b/test/crossfile/hover.lua @@ -1360,3 +1360,25 @@ local n: unknown --- [here](command:xxxxx)]] } + +TEST { + { + path = 'a.lua', + content = [[ + ---@class A + ---@field x number # comments + + ---@type A + local t + + print(t.) + ]] + }, + hover = [[ +```lua +(field) A.x: number +``` + +--- + comments]] +} -- cgit v1.2.3 From 82d716ccaa8ebab931fd2328faa4f4c5a76eb99a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Fri, 15 Jul 2022 18:04:16 +0800 Subject: resolve #1224 show comments for `doc.field` --- test/crossfile/hover.lua | 89 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) (limited to 'test/crossfile') diff --git a/test/crossfile/hover.lua b/test/crossfile/hover.lua index 84276a27..f412183c 100644 --- a/test/crossfile/hover.lua +++ b/test/crossfile/hover.lua @@ -77,6 +77,7 @@ TEST { ``` --- + * [a.lua](file:///a.lua) (搜索路径: `?.lua`)]], } @@ -109,6 +110,7 @@ TEST { ``` --- + * [Folder\a.lua](file:///Folder/a.lua) (搜索路径: `Folder\?.lua`)]], } @@ -127,6 +129,7 @@ TEST { ``` --- + * [Folder\a.lua](file:///Folder/a.lua) (搜索路径: `?.lua`)]], } @@ -145,6 +148,7 @@ TEST { ``` --- + * [Folder\a.lua](file:///Folder/a.lua) (搜索路径: `?.lua`)]], } else @@ -163,6 +167,7 @@ TEST { ``` --- + * [Folder/a.lua](file:///Folder/a.lua) (搜索路径: `Folder/?.lua`)]], } end @@ -329,6 +334,7 @@ function f(x: number) ``` --- + abc]] } @@ -350,6 +356,7 @@ TEST { ``` --- + abc]] } @@ -488,6 +495,7 @@ function f() end ``` --- + this is comment]] } @@ -557,6 +565,7 @@ function f(arg1: integer, arg2: integer) ``` --- + comment1 @*param* `arg2` — comment2 @@ -666,6 +675,7 @@ function f() ``` --- + comment1 comment2]]} @@ -710,6 +720,7 @@ local x: A ``` --- + AAA]]} TEST {{ path = 'a.lua', content = '', }, { @@ -730,6 +741,7 @@ local x: A { ``` --- + AAA]]} TEST {{ path = 'a.lua', content = '', }, { @@ -749,9 +761,11 @@ local x: A ``` --- + BBB --- + AAA]]} TEST {{ path = 'a.lua', content = '', }, { @@ -770,9 +784,11 @@ hover = [[ ``` --- + AAA --- + BBB]]} TEST {{ path = 'a.lua', content = '', }, { @@ -791,9 +807,11 @@ hover = [[ ``` --- + BBB --- + AAA]]} TEST {{ path = 'a.lua', content = '', }, { @@ -829,6 +847,7 @@ local food: unknown ``` --- + I'm a multiline comment ]]} @@ -937,6 +956,7 @@ function bthci.rawhci(hcibytes: any, callback: any) ``` --- + Sends a raw HCI command to the BlueTooth controller.]]} TEST {{ path = 'a.lua', content = '', }, { @@ -1021,6 +1041,7 @@ function fn() ``` --- + line1 line2]]} @@ -1156,6 +1177,7 @@ TEST { ``` --- + The color of your awesome apple!]] } @@ -1235,6 +1257,7 @@ local n: integer ``` --- + comments]] } @@ -1253,6 +1276,7 @@ local n: integer ``` --- + comments]] } @@ -1271,6 +1295,7 @@ local n: integer ``` --- + comments]] } @@ -1289,6 +1314,7 @@ local n: integer ``` --- + comments]] } @@ -1307,6 +1333,7 @@ local n: integer ``` --- + comments]] } @@ -1324,6 +1351,7 @@ local n: unknown ``` --- + [here](file:///x.lua)]] } @@ -1341,6 +1369,7 @@ local n: unknown ``` --- + [here](file:///d%3A/x.lua)]] } @@ -1358,6 +1387,7 @@ local n: unknown ``` --- + [here](command:xxxxx)]] } @@ -1380,5 +1410,64 @@ TEST { ``` --- + + comments]] +} + +TEST { + { + path = 'a.lua', + content = [[ + -- comments + = function () end + ]] + }, + hover = [[ +```lua +function A() +``` + +--- + + comments]] +} + +TEST { + { + path = 'a.lua', + content = [[ + local t = { + -- comments + = function () end + } + ]] + }, + hover = [[ +```lua +function A() +``` + +--- + + comments]] +} + +TEST { + { + path = 'a.lua', + content = [[ + -- comments + ---@return number + = function () end + ]] + }, + hover = [[ +```lua +function A() + -> number +``` + +--- + comments]] } -- cgit v1.2.3 From 7d546aeb0c78d2790a583809ceabfa620fdbde3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Fri, 15 Jul 2022 23:48:13 +0800 Subject: resolve #1230 show enums for variables --- test/crossfile/hover.lua | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'test/crossfile') diff --git a/test/crossfile/hover.lua b/test/crossfile/hover.lua index f412183c..60a962e9 100644 --- a/test/crossfile/hover.lua +++ b/test/crossfile/hover.lua @@ -1471,3 +1471,29 @@ function A() comments]] } + +TEST { + { + path = 'a.lua', + content = [[ + ---@alias A + ---| 1 # comment1 + ---| 2 # comment2 + + ---@type A + local + ]] + }, + hover = [[ +```lua +local x: 1|2 +``` + +--- + +```lua +A: + | 1 -- comment1 + | 2 -- comment2 +```]] +} -- cgit v1.2.3 From 1a6e21031ba029dcff7ae4efd0b8649ba8908c77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Mon, 18 Jul 2022 20:05:37 +0800 Subject: #1255 hover for `doc.enum` --- test/crossfile/hover.lua | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'test/crossfile') diff --git a/test/crossfile/hover.lua b/test/crossfile/hover.lua index 60a962e9..d1148309 100644 --- a/test/crossfile/hover.lua +++ b/test/crossfile/hover.lua @@ -1497,3 +1497,31 @@ A: | 2 -- comment2 ```]] } + +TEST { + { + path = 'a.lua', + content = [[ + ---@enum + local t = { + x = 1, + y = 2, + z = 3, + } + ]] + }, + hover = [[ +```lua +(enum) A +``` + +--- + +```lua +{ + x: integer = 1, + y: integer = 2, + z: integer = 3, +} +```]] +} -- cgit v1.2.3 From 4529b3118d10a82ba2e0cfa201bc380067c18212 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Mon, 25 Jul 2022 23:47:55 +0800 Subject: fix #1370 --- test/crossfile/hover.lua | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'test/crossfile') diff --git a/test/crossfile/hover.lua b/test/crossfile/hover.lua index d1148309..e8a718d4 100644 --- a/test/crossfile/hover.lua +++ b/test/crossfile/hover.lua @@ -1525,3 +1525,32 @@ TEST { } ```]] } + +TEST { + { + path = 'a.lua', + content = [[ + ---@enum + local t = + { + x = 1, + y = 2, + z = 3, + } + ]] + }, + hover = [[ +```lua +(enum) A +``` + +--- + +```lua +{ + x: integer = 1, + y: integer = 2, + z: integer = 3, +} +```]] +} -- cgit v1.2.3 From f95cec2d31079134e3bfc35908ed1a6a6f9e7805 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Wed, 27 Jul 2022 20:02:18 +0800 Subject: fix hover of some operators --- test/crossfile/hover.lua | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'test/crossfile') diff --git a/test/crossfile/hover.lua b/test/crossfile/hover.lua index e8a718d4..e6517aa9 100644 --- a/test/crossfile/hover.lua +++ b/test/crossfile/hover.lua @@ -1554,3 +1554,31 @@ TEST { } ```]] } + +TEST { + { + path = 'a.lua', + content = [[ + ---@enum + local t = { + x = 1 << 0, + y = 1 << 1, + z = 1 << 2, + } + ]] + }, + hover = [[ +```lua +(enum) A +``` + +--- + +```lua +{ + x: integer = 1, + y: integer = 2, + z: integer = 4, +} +```]] +} -- cgit v1.2.3 From e1912470260bac17e7efc565cb59719beb810d01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Tue, 11 Oct 2022 16:57:21 +0800 Subject: fix #1608 --- test/crossfile/hover.lua | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'test/crossfile') diff --git a/test/crossfile/hover.lua b/test/crossfile/hover.lua index e6517aa9..c3d7078c 100644 --- a/test/crossfile/hover.lua +++ b/test/crossfile/hover.lua @@ -1582,3 +1582,27 @@ TEST { } ```]] } + +TEST { + { + path = 'a.lua', + content = [[ + ---@alias someType + ---| "#" # description + + ---@type someType + local + ]] + }, + hover = [[ +```lua +local someValue: "#" +``` + +--- + +```lua +someType: + | "#" -- description +```]] +} -- cgit v1.2.3 From ea2795520e68db8737bd6d0ab7a93d5e5a482346 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Wed, 12 Oct 2022 16:33:29 +0800 Subject: cleanup --- test/crossfile/completion.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'test/crossfile') diff --git a/test/crossfile/completion.lua b/test/crossfile/completion.lua index 4e573c0e..24a5f6c9 100644 --- a/test/crossfile/completion.lua +++ b/test/crossfile/completion.lua @@ -376,7 +376,7 @@ config.set(nil, 'Lua.runtime.path', { TEST { { - path = 'D:/xxxx/1.lua', + path = 'tt/xxxx/1.lua', content = '', }, { @@ -386,7 +386,7 @@ TEST { }, completion = { { - label = 'D:.xxxx', + label = 'tt.xxxx', kind = CompletionItemKind.File, textEdit = EXISTS, }, @@ -402,12 +402,12 @@ config.set(nil, 'Lua.runtime.path', originRuntimePath) local originRuntimePath = config.get(nil, 'Lua.runtime.path') config.set(nil, 'Lua.runtime.path', { - 'D:/?/1.lua', + 'tt/?/1.lua', }) TEST { { - path = 'D:/xxxx/1.lua', + path = 'tt/xxxx/1.lua', content = '', }, { -- cgit v1.2.3 From 0c7a22d1106cd97b47cb969e2ccfd86ca7ae2629 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Thu, 20 Oct 2022 20:49:11 +0800 Subject: ignore varargs if a function only has varargs and has `---@overload`, the varargs will be ignored resolve #1641 --- test/crossfile/hover.lua | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'test/crossfile') diff --git a/test/crossfile/hover.lua b/test/crossfile/hover.lua index c3d7078c..6d1f3df6 100644 --- a/test/crossfile/hover.lua +++ b/test/crossfile/hover.lua @@ -1606,3 +1606,41 @@ someType: | "#" -- description ```]] } + +TEST { { path = 'a.lua', content = [[ +---@overload fun(x: number) +---@overload fun(x: number, y: number) +local function (...) +end +]] }, +hover = [[ +```lua +function f(x: number) +``` + +--- + +```lua +function f(x: number, y: number) +```]] +} + +TEST { { path = 'a.lua', content = [[ +---@overload fun(x: number) +---@overload fun(x: number, y: number) +local function f(...) +end + + +]] }, +hover = [[ +```lua +function f(x: number) +``` + +--- + +```lua +function f(x: number, y: number) +```]] +} -- cgit v1.2.3 From 4d65d77f5214bf5dd935956c861580ff2b46bfe4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Mon, 31 Oct 2022 14:30:26 +0800 Subject: add `---@package` --- test/crossfile/diagnostic.lua | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'test/crossfile') diff --git a/test/crossfile/diagnostic.lua b/test/crossfile/diagnostic.lua index dd06351f..e574204a 100644 --- a/test/crossfile/diagnostic.lua +++ b/test/crossfile/diagnostic.lua @@ -140,3 +140,28 @@ TEST { content = 'require "f.a"', }, } + +TEST { + { path = 'a.lua', content = [[ + ---@class A + ---@field package x string + + ---@type A + local obj + + print(obj.x) + ]]}, +} + +TEST { + { path = 'a.lua', content = [[ + ---@class A + ---@field package x string + ]]}, + { path = 'b.lua', content = [[ + ---@type A + local obj + + print(obj.) + ]]} +} -- cgit v1.2.3 From 74e8cdc64719198018a565f438fa1ab66bfc71f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Tue, 1 Nov 2022 15:30:14 +0800 Subject: find reference respect `includeDeclaration` --- test/crossfile/references.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/crossfile') diff --git a/test/crossfile/references.lua b/test/crossfile/references.lua index 1a9f2508..22b13f42 100644 --- a/test/crossfile/references.lua +++ b/test/crossfile/references.lua @@ -83,7 +83,7 @@ function TEST(datas) end local sourcePos = (sourceList[1][1] + sourceList[1][2]) // 2 - local positions = core(sourceUri, sourcePos) + local positions = core(sourceUri, sourcePos, true) if positions then local result = {} for i, position in ipairs(positions) do -- cgit v1.2.3 From 625f5be9a6ae1c30dd5821f1dd2485073d054209 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Wed, 2 Nov 2022 17:29:18 +0800 Subject: `---@see` use workspace-symbol #1344 --- test/crossfile/definition.lua | 1 + 1 file changed, 1 insertion(+) (limited to 'test/crossfile') diff --git a/test/crossfile/definition.lua b/test/crossfile/definition.lua index 45f21697..ef9b5240 100644 --- a/test/crossfile/definition.lua +++ b/test/crossfile/definition.lua @@ -26,6 +26,7 @@ local function founded(targets, results) return true end +---@async function TEST(datas) local targetList = {} local sourceList -- cgit v1.2.3 From 02dd5b6557d3e70859bc3ddb234f8924b0166221 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Wed, 2 Nov 2022 19:20:22 +0800 Subject: improve `---@see` resolve #1344 --- test/crossfile/hover.lua | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'test/crossfile') diff --git a/test/crossfile/hover.lua b/test/crossfile/hover.lua index 6d1f3df6..4a567a31 100644 --- a/test/crossfile/hover.lua +++ b/test/crossfile/hover.lua @@ -1644,3 +1644,40 @@ function f(x: number) function f(x: number, y: number) ```]] } + +TEST { {path = 'a.lua', content = [[ +---@class A + +---@see A # comment1 +local +]]}, +hover = [[ +```lua +local x: unknown +``` + +--- + +See: [A](file:///a.lua:1:10) comment1]] +} + +TEST { {path = 'a.lua', content = [[ +---@class A + +TTT = 1 + +---@see A # comment1 +---@see TTT # comment2 +local +]]}, +hover = [[ +```lua +local x: unknown +``` + +--- + +See: + * [A](file:///a.lua:1:10) comment1 + * [TTT](file:///a.lua:3:0) comment2]] +} -- cgit v1.2.3 From 0fc72b8bb723f8fb38002dd4d10f8ef86c2c7dfd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Wed, 2 Nov 2022 19:29:35 +0800 Subject: cleanup --- test/crossfile/hover.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'test/crossfile') diff --git a/test/crossfile/hover.lua b/test/crossfile/hover.lua index 4a567a31..1cb48e61 100644 --- a/test/crossfile/hover.lua +++ b/test/crossfile/hover.lua @@ -1658,7 +1658,7 @@ local x: unknown --- -See: [A](file:///a.lua:1:10) comment1]] +See: [A](file:///a.lua#1#10) comment1]] } TEST { {path = 'a.lua', content = [[ @@ -1678,6 +1678,6 @@ local x: unknown --- See: - * [A](file:///a.lua:1:10) comment1 - * [TTT](file:///a.lua:3:0) comment2]] + * [A](file:///a.lua#1#10) comment1 + * [TTT](file:///a.lua#3#0) comment2]] } -- cgit v1.2.3 From 6176475e3fabd4506a8c59222d3c83dbeeb2f1eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Mon, 7 Nov 2022 14:38:41 +0800 Subject: don't find other locals fix #1670 --- test/crossfile/definition.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/crossfile') diff --git a/test/crossfile/definition.lua b/test/crossfile/definition.lua index ef9b5240..e924c43f 100644 --- a/test/crossfile/definition.lua +++ b/test/crossfile/definition.lua @@ -435,7 +435,7 @@ TEST { { path = 'a.lua', content = [[ - local + local x return { = x, } -- cgit v1.2.3 From decf02ad1f708f9e2eb7d50d9765b22ae21f0425 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Tue, 8 Nov 2022 17:00:50 +0800 Subject: fix description disapeared for overloaded function --- test/crossfile/hover.lua | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'test/crossfile') diff --git a/test/crossfile/hover.lua b/test/crossfile/hover.lua index 1cb48e61..c0b1691f 100644 --- a/test/crossfile/hover.lua +++ b/test/crossfile/hover.lua @@ -1681,3 +1681,27 @@ See: * [A](file:///a.lua#1#10) comment1 * [TTT](file:///a.lua#3#0) comment2]] } + +TEST { {path = 'a.lua', content = [[ +---comment1 +---comment2 +---@overload fun() +---@param x number +local function (x) end +]]}, +hover = [[ +```lua +function f(x: number) +``` + +--- + +comment1 +comment2 + +--- + +```lua +function f() +```]] +} -- cgit v1.2.3 From ccce6e0b430a29cd58bfcffc07fd17ebaba3ddc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Mon, 14 Nov 2022 20:25:50 +0800 Subject: `duplicate-doc-field` check cross files --- test/crossfile/diagnostic.lua | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'test/crossfile') diff --git a/test/crossfile/diagnostic.lua b/test/crossfile/diagnostic.lua index e574204a..58c89805 100644 --- a/test/crossfile/diagnostic.lua +++ b/test/crossfile/diagnostic.lua @@ -165,3 +165,14 @@ TEST { print(obj.) ]]} } + +TEST { + { path = 'a.lua', content = [[ + ---@class A + ---@field number + ]]}, + { path = 'b.lua', content = [[ + ---@class A + ---@field number + ]]} +} -- cgit v1.2.3 From bfeea5916effde22eae483a2f3b3077cbd7f6e52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Mon, 14 Nov 2022 22:32:31 +0800 Subject: `duplicate-set-field` supports cross files --- test/crossfile/diagnostic.lua | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'test/crossfile') diff --git a/test/crossfile/diagnostic.lua b/test/crossfile/diagnostic.lua index 58c89805..126a2ab8 100644 --- a/test/crossfile/diagnostic.lua +++ b/test/crossfile/diagnostic.lua @@ -8,6 +8,7 @@ local catch = require 'catch' config.get(nil, 'Lua.diagnostics.neededFileStatus')['deprecated'] = 'Any' config.get(nil, 'Lua.diagnostics.neededFileStatus')['type-check'] = 'Any' +config.get(nil, 'Lua.diagnostics.neededFileStatus')['duplicate-set-field'] = 'Any' config.get(nil, 'Lua.diagnostics.neededFileStatus')['codestyle-check'] = 'None' rawset(_G, 'TEST', true) @@ -176,3 +177,37 @@ TEST { ---@field number ]]} } + +TEST { + { path = 'a.lua', content = [[ + ---@class A + local mt + + function () + end + ]]}, + { path = 'b.lua', content = [[ + ---@class A + local mt + + function () + end + ]]} +} + +TEST { + { path = 'a.lua', content = [[ + ---@class A + local mt + + function mt:init() + end + ]]}, + { path = 'b.lua', content = [[ + ---@class B: A + local mt + + function mt:init() + end + ]]} +} -- cgit v1.2.3 From b137f3faf9225e4e4279e0aefc1d98bfb6aa4724 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Fri, 18 Nov 2022 17:47:11 +0800 Subject: resolve dead lock --- test/crossfile/references.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'test/crossfile') diff --git a/test/crossfile/references.lua b/test/crossfile/references.lua index 22b13f42..0b7beb82 100644 --- a/test/crossfile/references.lua +++ b/test/crossfile/references.lua @@ -361,15 +361,15 @@ TEST { { path = 'a.lua', content = [[ - local <~t~> = require 'b' - return + local <~x~> = require 'b' + return ]] }, { path = 'b.lua', content = [[ - local t = require 'a' - return t + local y = require 'a' + return y ]] }, } -- cgit v1.2.3