diff --git a/changelog.md b/changelog.md index 492e79cc9eb486d954b5814d88a0544995ba403c..ed39ed42f6bc01d2224c199453020bdb96af5bd4 100644 --- a/changelog.md +++ b/changelog.md @@ -9,6 +9,7 @@ * `CHG` hover: improve showing multi defines * `CHG` hover: improve showing multi comments at enums * `CHG` hint: `Lua.hint.paramName` now supports `Disable`, `Literal` and `All` +* `CHG` only search first file by `require` * `CHG` no longer ignore file names case in Windows * `CHG` watching library changes * `FIX` runtime errors diff --git a/script/core/searcher.lua b/script/core/searcher.lua index e75293f1bb0820f760d7028e6fb1e7a9168e17ba..108a9c37f4af805ec5343d1f6920fd22595052b6 100644 --- a/script/core/searcher.lua +++ b/script/core/searcher.lua @@ -753,6 +753,7 @@ function m.searchRefsByID(status, suri, expect, mode) local ruri = uris[i] if uri ~= ruri then searchID(ruri, 'mainreturn', field, uri) + break end end end diff --git a/test/crossfile/definition.lua b/test/crossfile/definition.lua index 749231838711488637712fd4409233a1a3bca3a8..66e9b26938119e5cad5b8f8a7fb9a775f1807550 100644 --- a/test/crossfile/definition.lua +++ b/test/crossfile/definition.lua @@ -834,18 +834,24 @@ TEST { { path = 'a.lua', content = [[ ----@type Class -local m -m.<!xx!> = 1 - ]] +return { + <!x!> = 1, +} +]], + }, + { + path = 'f/a.lua', + content = [[ +return { + x = 1, +} +]] }, { path = 'b.lua', content = [[ ----@class Class -local m - -print(m.<?xx?>) +local t = require 'a' +print(t.<?x?>) ]] } }