diff options
-rw-r--r-- | .vscode/tasks.json | 10 | ||||
-rw-r--r-- | test.lua | 7 | ||||
-rw-r--r-- | test/completion/init.lua | 2 | ||||
-rw-r--r-- | test/crossfile/completion.lua | 23 | ||||
-rw-r--r-- | test/crossfile/hover.lua | 17 |
5 files changed, 55 insertions, 4 deletions
diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 923029ad..4771a2ef 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -34,7 +34,15 @@ { "type": "shell", "label": "Compile", - "command": "chcp 65001 && ${workspaceFolder}/3rd/luamake/luamake rebuild" + "windows": { + "command": "chcp 65001 && ${workspaceFolder}/3rd/luamake/luamake rebuild.bat" + }, + "linux": { + "command": "${workspaceFolder}/3rd/luamake/luamake rebuild" + }, + "osx": { + "command": "${workspaceFolder}/3rd/luamake/luamake rebuild" + } }, ] } @@ -1,9 +1,10 @@ local currentPath = debug.getinfo(1, 'S').source:sub(2) local rootPath = currentPath:gsub('[/\\]*[^/\\]-$', '') -loadfile(rootPath .. '\\platform.lua')('script') +rootPath = rootPath == '' and '.' or rootPath +loadfile(rootPath .. '/platform.lua')('script') package.path = package.path - .. ';' .. rootPath .. '\\test\\?.lua' - .. ';' .. rootPath .. '\\test\\?\\init.lua' + .. ';' .. rootPath .. '/test/?.lua' + .. ';' .. rootPath .. '/test/?/init.lua' local fs = require 'bee.filesystem' ROOT = fs.path(rootPath) LANG = 'zh-CN' diff --git a/test/completion/init.lua b/test/completion/init.lua index b5eac60b..b117e4d8 100644 --- a/test/completion/init.lua +++ b/test/completion/init.lua @@ -1236,10 +1236,12 @@ loadstring$ { label = 'loadstring', kind = define.CompletionItemKind.Function, + deprecated = true, }, { label = 'loadstring()', kind = define.CompletionItemKind.Snippet, + deprecated = true, }, } diff --git a/test/crossfile/completion.lua b/test/crossfile/completion.lua index 6ac45c29..67c6d9e6 100644 --- a/test/crossfile/completion.lua +++ b/test/crossfile/completion.lua @@ -526,6 +526,7 @@ TEST { } } +if require 'bee.platform'.OS == 'Windows' then TEST { { path = [[abc/init.lua]], @@ -546,6 +547,28 @@ TEST { }, } } +else +TEST { + { + path = [[abc/init.lua]], + content = '' + }, + { + path = 'main.lua', + content = [[ + dofile 'ab$' + ]], + main = true, + }, + completion = { + { + label = [[abc/init.lua]], + kind = CompletionItemKind.Reference, + textEdit = EXISTS, + }, + } +} +end Cared['description'] = true TEST { diff --git a/test/crossfile/hover.lua b/test/crossfile/hover.lua index 9fc21461..715d658f 100644 --- a/test/crossfile/hover.lua +++ b/test/crossfile/hover.lua @@ -90,6 +90,7 @@ TEST { } } +if require 'bee.platform'.OS == 'Windows' then TEST { { path = 'Folder/a.lua', @@ -104,6 +105,22 @@ TEST { description = [[* [Folder\a.lua](file:///Folder/a.lua) (假设搜索路径包含 `Folder\?.lua`)]], } } +else +TEST { + { + path = 'Folder/a.lua', + content = '', + }, + { + path = 'b.lua', + content = 'require <?"a"?>', + }, + hover = { + label = '1 个字节', + description = [[* [Folder/a.lua](file:///Folder/a.lua) (假设搜索路径包含 `Folder/?.lua`)]], + } +} +end TEST { { |