diff options
-rw-r--r-- | script-beta/core/completion.lua | 2 | ||||
-rw-r--r-- | script-beta/vm/getClass.lua | 6 | ||||
-rw-r--r-- | script-beta/vm/getLibrary.lua | 3 | ||||
-rw-r--r-- | test-beta/hover/init.lua | 29 |
4 files changed, 38 insertions, 2 deletions
diff --git a/script-beta/core/completion.lua b/script-beta/core/completion.lua index 7aacfa92..23f4a138 100644 --- a/script-beta/core/completion.lua +++ b/script-beta/core/completion.lua @@ -846,7 +846,7 @@ local function getCallArgInfo(call, text, offset) return index, arg end end - return nil, nil + return #call.args + 1, nil end local function tryCallArg(ast, text, offset, results) diff --git a/script-beta/vm/getClass.lua b/script-beta/vm/getClass.lua index c8eb2080..03cde93a 100644 --- a/script-beta/vm/getClass.lua +++ b/script-beta/vm/getClass.lua @@ -4,7 +4,11 @@ local guide = require 'parser.guide' local function getClass(source, classes, deep) local lib = vm.getLibrary(source) if lib then - classes[#classes+1] = lib.name + if lib.value.type == 'table' then + classes[#classes+1] = lib.value.name + else + classes[#classes+1] = lib.value.type + end return end if deep > 3 then diff --git a/script-beta/vm/getLibrary.lua b/script-beta/vm/getLibrary.lua index 4ce02024..8b955c7c 100644 --- a/script-beta/vm/getLibrary.lua +++ b/script-beta/vm/getLibrary.lua @@ -2,6 +2,9 @@ local vm = require 'vm.vm' local guide = require 'parser.guide' local function getLibrary(source) + if source.type == 'library' then + return source + end local defs = vm.getDefs(source) for _, def in ipairs(defs) do if def.type == 'library' then diff --git a/test-beta/hover/init.lua b/test-beta/hover/init.lua index 8b87249d..58f61094 100644 --- a/test-beta/hover/init.lua +++ b/test-beta/hover/init.lua @@ -504,6 +504,35 @@ global utf8: utf8 { ]] TEST [[ +print(io.<?stderr?>) +]] +[[ +global io.stderr: FILE* +]] + +TEST [[ +print(<?io?>) +]] +[[ +global io: io { + close: function, + flush: function, + input: function, + lines: function, + open: function, + output: function, + popen: function, + read: function, + stderr: FILE*, + stdin: FILE*, + stdout: FILE*, + tmpfile: function, + type: function, + write: function, +} +]] + +TEST [[ local <?sssss?> = require 'utf8' ]] [[ |