3030function m .getVisiblePath (path )
3131 local searchers = config .get ' Lua.runtime.path'
3232 local strict = config .get ' Lua.runtime.pathStrict'
33- path = path : gsub ( ' ^[/ \\ ]+ ' , ' ' )
33+ path = workspace . normalize ( path )
3434 local uri = furi .encode (path )
3535 local libraryPath = files .getLibraryPath (uri )
3636 if not m .cache [path ] then
@@ -42,6 +42,7 @@ function m.getVisiblePath(path)
4242 for _ , searcher in ipairs (searchers ) do
4343 local isAbsolute = searcher :match ' ^[/\\ ]'
4444 or searcher :match ' ^%a+%:'
45+ searcher = workspace .normalize (searcher )
4546 local cutedPath = path
4647 local currentPath = path
4748 local head
@@ -87,37 +88,36 @@ function m.findUrisByRequirePath(path)
8788 if type (path ) ~= ' string' then
8889 return {}
8990 end
91+ local separator = config .get ' Lua.completion.requireSeparator'
92+ local fspath = path :gsub (' %' .. separator , ' /' )
9093 local vm = require ' vm'
9194 local cache = vm .getCache ' findUrisByRequirePath'
9295 if cache [path ] then
9396 return cache [path ].results , cache [path ].searchers
9497 end
9598 tracy .ZoneBeginN (' findUrisByRequirePath' )
9699 local results = {}
97- local mark = {}
98100 local searchers = {}
99101 for uri in files .eachDll () do
100102 local opens = files .getDllOpens (uri ) or {}
101103 for _ , open in ipairs (opens ) do
102- if open == path then
104+ if open == fspath then
103105 results [# results + 1 ] = uri
104106 end
105107 end
106108 end
107109
108- local input = path :gsub (' %.' , ' /' )
109- :gsub (' %%' , ' %%%%' )
110- for _ , luapath in ipairs (config .get ' Lua.runtime.path' ) do
111- local part = workspace .normalize (luapath :gsub (' %?' , input ))
112- local uris , posts = workspace .findUrisByFilePath (part )
113- for _ , uri in ipairs (uris ) do
114- if not mark [uri ] then
115- mark [uri ] = true
110+ for uri in files .eachFile () do
111+ local infos = m .getVisiblePath (furi .decode (uri ))
112+ for _ , info in ipairs (infos ) do
113+ local fsexpect = info .expect :gsub (' %' .. separator , ' /' )
114+ if fsexpect == fspath then
116115 results [# results + 1 ] = uri
117- searchers [uri ] = posts [ uri ] .. luapath
116+ searchers [uri ] = info . searcher
118117 end
119118 end
120119 end
120+
121121 tracy .ZoneEnd ()
122122 cache [path ] = {
123123 results = results ,
0 commit comments