diff options
-rw-r--r-- | script/core/diagnostics/different-requires.lua | 4 | ||||
-rw-r--r-- | test/crossfile/diagnostic.lua | 19 |
2 files changed, 21 insertions, 2 deletions
diff --git a/script/core/diagnostics/different-requires.lua b/script/core/diagnostics/different-requires.lua index 5b86d8de..909342f4 100644 --- a/script/core/diagnostics/different-requires.lua +++ b/script/core/diagnostics/different-requires.lua @@ -22,10 +22,10 @@ return function (uri, callback) end local literal = arg1[1] local results = ws.findUrisByRequirePath(literal) - local result = results and results[1] - if not result then + if not results or #results ~= 1 then return end + local result = results[1] if not files.isLua(result) then return end diff --git a/test/crossfile/diagnostic.lua b/test/crossfile/diagnostic.lua index 3d4eb552..a430cb4e 100644 --- a/test/crossfile/diagnostic.lua +++ b/test/crossfile/diagnostic.lua @@ -135,3 +135,22 @@ TEST { content = 'require "f.a"', }, } + +TEST { + { + path = 'a/init.lua', + content = '', + }, + { + path = 'f/a.lua', + content = '', + }, + { + path = 'b.lua', + content = 'require "a"', + }, + { + path = 'c.lua', + content = 'require "f.a"', + }, +} |