@@ -32,7 +32,7 @@ ev.on('initializing', function(config)
3232 local sm = {}
3333 sm [1 ] = (' ^%s$' ):format (fs .source_native (fs .source_normalize (pattern [1 ])):gsub (' [%^%$%(%)%%%.%[%]%+%-%?]' , ' %%%0' ))
3434 if sm [1 ]:find ' %*' then
35- sm [1 ] = sm [1 ]:gsub (' %*' , ' (.*) ' )
35+ sm [1 ] = sm [1 ]:gsub (' %*' , ' ().* ' )
3636 end
3737 sm [2 ] = fs .path_normalize (pattern [2 ])
3838 sourceMaps [# sourceMaps + 1 ] = sm
@@ -50,12 +50,13 @@ local function glob_match(pattern, target)
5050 return target :match (pattern ) ~= nil
5151end
5252
53- local function glob_replace (pattern , target )
54- local res = table.pack (target :match (pattern [1 ]))
53+ local function glob_replace (pattern , path , nativePath )
54+ local res = table.pack (nativePath :match (pattern [1 ]))
5555 if res [1 ] == nil then
5656 return false
5757 end
58- return pattern [2 ]:gsub (" %*" , res [1 ])
58+ local sz = res [1 ]
59+ return pattern [2 ]:gsub (" %*" , path :sub (sz ))
5960end
6061
6162local function covertPath (p )
@@ -73,15 +74,16 @@ local function serverPathToClientPath(p)
7374 p = fs .a2u (p )
7475 end
7576 local skip = false
76- local nativePath = fs .source_native (fs .source_normalize (p ))
77+ local path = fs .source_normalize (p )
78+ local nativePath = fs .source_native (path )
7779 for _ , pattern in ipairs (skipFiles ) do
7880 if glob_match (pattern , nativePath ) then
7981 skip = true
8082 break
8183 end
8284 end
8385 for _ , pattern in ipairs (sourceMaps ) do
84- local res = glob_replace (pattern , nativePath )
86+ local res = glob_replace (pattern , path , nativePath )
8587 if res then
8688 return skip , covertPath (res )
8789 end
0 commit comments