summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--server-beta/src/core/definition.lua6
-rw-r--r--server-beta/src/files.lua12
2 files changed, 15 insertions, 3 deletions
diff --git a/server-beta/src/core/definition.lua b/server-beta/src/core/definition.lua
index b3b5c173..f9ba00d1 100644
--- a/server-beta/src/core/definition.lua
+++ b/server-beta/src/core/definition.lua
@@ -21,7 +21,7 @@ local function findDef(searcher, source, callback)
or info.mode == 'set'
or info.mode == 'return' then
local src = info.source
- local uri = info.uri
+ local uri = info.searcher.uri
if src.type == 'setfield'
or src.type == 'getfield'
or src.type == 'tablefield' then
@@ -81,7 +81,7 @@ return function (uri, offset)
guide.eachSourceContain(searcher.ast, offset, function (source)
checkRequire(searcher, source, offset, function (uri)
results[#results+1] = {
- uri = uri,
+ uri = files.getOriginUri(uri),
source = source,
target = {
start = 0,
@@ -92,7 +92,7 @@ return function (uri, offset)
findDef(searcher, source, function (target, uri)
results[#results+1] = {
target = target,
- uri = uri,
+ uri = files.getOriginUri(uri),
source = source,
}
end)
diff --git a/server-beta/src/files.lua b/server-beta/src/files.lua
index 6c0d8dae..4e8cd093 100644
--- a/server-beta/src/files.lua
+++ b/server-beta/src/files.lua
@@ -168,6 +168,18 @@ function m.getSearcher(uri)
return file.searcher
end
+--- 获取原始uri
+function m.getOriginUri(uri)
+ if platform.OS == 'Windows' then
+ uri = uri:lower()
+ end
+ local file = m.fileMap[uri]
+ if not file then
+ return nil
+ end
+ return file.uri
+end
+
--- 判断文件名相等
function m.eq(a, b)
if platform.OS == 'Windows' then