summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
Diffstat (limited to 'script')
-rw-r--r--script/core/command/autoRequire.lua2
-rw-r--r--script/core/completion/completion.lua2
-rw-r--r--script/core/hover/return.lua3
-rw-r--r--script/library.lua13
-rw-r--r--script/workspace/workspace.lua1
5 files changed, 10 insertions, 11 deletions
diff --git a/script/core/command/autoRequire.lua b/script/core/command/autoRequire.lua
index 30bd13a1..2f4dfa21 100644
--- a/script/core/command/autoRequire.lua
+++ b/script/core/command/autoRequire.lua
@@ -137,7 +137,7 @@ return function (data)
end
local path = furi.decode(target)
- local visiblePaths = rpath.getVisiblePath(path)
+ local visiblePaths = rpath.getVisiblePath(uri, path)
if not visiblePaths or #visiblePaths == 0 then
return
end
diff --git a/script/core/completion/completion.lua b/script/core/completion/completion.lua
index cbe782cc..401a3583 100644
--- a/script/core/completion/completion.lua
+++ b/script/core/completion/completion.lua
@@ -887,7 +887,7 @@ local function collectRequireNames(mode, myUri, literal, source, smark, position
goto CONTINUE
end
local path = workspace.getRelativePath(uri)
- local infos = rpath.getVisiblePath(path)
+ local infos = rpath.getVisiblePath(uri, path)
for _, info in ipairs(infos) do
if matchKey(literal, info.expect) then
if not collect[info.expect] then
diff --git a/script/core/hover/return.lua b/script/core/hover/return.lua
index 49f9536a..681e9747 100644
--- a/script/core/hover/return.lua
+++ b/script/core/hover/return.lua
@@ -1,4 +1,5 @@
local infer = require 'core.infer'
+local guide = require 'parser.guide'
local function getReturnDualByDoc(source)
local docs = source.bindDocs
@@ -67,7 +68,7 @@ local function asFunction(source)
end
end
if next(infers) or rtn[1] then
- local tp = infer.viewInfers(infers)
+ local tp = infer.viewInfers(guide.getUri(source), infers)
if rtn[1].name then
line[#line+1] = ('%s%s: %s'):format(
rtn[1].name[1],
diff --git a/script/library.lua b/script/library.lua
index 9b31410c..baa336f9 100644
--- a/script/library.lua
+++ b/script/library.lua
@@ -12,10 +12,11 @@ local await = require 'await'
local timer = require 'timer'
local encoder = require 'encoder'
local ws = require 'workspace.workspace'
-local scope = require 'workspace.scope'
local m = {}
+m.metaPaths = {}
+
local function getDocFormater(uri)
local version = config.get(uri, 'Lua.runtime.version')
if client.isVSCode() then
@@ -215,19 +216,16 @@ local function initBuiltIn(uri)
loadMetaLocale(langID, metaLang)
end
-
if scp:get('metaPath') == metaPath:string() then
return
end
scp:set('metaPath', metaPath:string())
- local suc, ok = xpcall(function ()
+ local suc = xpcall(function ()
if not fs.exists(metaPath) then
fs.create_directories(metaPath)
- return true
end
- return false
end, log.error)
- if not suc or not ok then
+ if not suc then
return
end
local out = fsu.dummyFS()
@@ -243,6 +241,8 @@ local function initBuiltIn(uri)
if metaDoc then
metaDoc = encoder.encode(encoding, metaDoc, 'auto')
out:saveFile(libName, metaDoc)
+ local outputPath = metaPath / libName
+ m.metaPaths[outputPath:string()] = true
end
::CONTINUE::
end
@@ -419,7 +419,6 @@ local function check3rdByFileName(uri, configs)
if hasAsked then
return
end
- local ws = require 'workspace'
local path = ws.getRelativePath(uri)
if not path then
return
diff --git a/script/workspace/workspace.lua b/script/workspace/workspace.lua
index c037baaa..1d20593f 100644
--- a/script/workspace/workspace.lua
+++ b/script/workspace/workspace.lua
@@ -6,7 +6,6 @@ local config = require 'config'
local glob = require 'glob'
local platform = require 'bee.platform'
local await = require 'await'
-local library = require 'library'
local client = require 'client'
local plugin = require 'plugin'
local util = require 'utility'