diff options
Diffstat (limited to 'server')
-rw-r--r-- | server/src/core/find_lib.lua | 13 | ||||
-rw-r--r-- | server/test/find_lib/init.lua | 10 | ||||
-rw-r--r-- | server/test/hover/init.lua | 14 |
3 files changed, 30 insertions, 7 deletions
diff --git a/server/src/core/find_lib.lua b/server/src/core/find_lib.lua index 3ba7865f..e76549a8 100644 --- a/server/src/core/find_lib.lua +++ b/server/src/core/find_lib.lua @@ -1,3 +1,5 @@ +local hoverName = require 'core.hover.name' + local function getParentName(lib, isObject) for _, parent in ipairs(lib.parent) do if isObject then @@ -37,8 +39,15 @@ local function findLib(source) end end else - local name = lib.nick or lib.name - return lib, name + local name = hoverName(source) + local libName = lib.nick or lib.name + if name == libName or not libName then + return lib, name + elseif name == '' then + return lib, libName + else + return lib, ('%s<%s>'):format(name, libName) + end end end diff --git a/server/test/find_lib/init.lua b/server/test/find_lib/init.lua index accf1b35..bc60cfad 100644 --- a/server/test/find_lib/init.lua +++ b/server/test/find_lib/init.lua @@ -24,11 +24,11 @@ TEST 'require' [[ <?require?> 'xxx' ]] -TEST 'require' [[ +TEST 'req<require>' [[ local <?req?> = require ]] -TEST 'require' [[ +TEST 'req<require>' [[ local req = require local t = { xx = req, @@ -40,11 +40,11 @@ TEST 'table' [[ <?table?>.unpack() ]] -TEST 'table' [[ +TEST 'xx<table>' [[ local <?xx?> = require 'table' ]] -TEST 'table' [[ +TEST 'xx<table>' [[ local rq = require local lib = 'table' local <?xx?> = rq(lib) @@ -87,7 +87,7 @@ TEST '*string.sub' [[ ('xxx').<?sub?>() ]] -TEST 'bee::filesystem' [[ +TEST 'fs<bee::filesystem>' [[ local <?fs?> = require 'bee.filesystem' ]] diff --git a/server/test/hover/init.lua b/server/test/hover/init.lua index 09c14bee..b144fd72 100644 --- a/server/test/hover/init.lua +++ b/server/test/hover/init.lua @@ -387,3 +387,17 @@ local self: *obj { remove: function, } ]] + +TEST[[ +local <?sssss?> = require 'utf8' +]] +[[ +local sssss<utf8>: { + char: function, + charpattern: string, + codepoint: function, + codes: function, + len: function, + offset: function, +} +]] |