@@ -16,13 +16,21 @@ local function GetLibraries(RelativeTo: string, _Libraries, _Uri: Uri?)
1616 local Libraries = (_Libraries or {})
1717 local Uri = (_Uri or lsp .workspace .getRootUri ())
1818
19+ RelativeTo = string.gsub (RelativeTo , "[/\\ ]" , "/" )
20+
1921 for _ , Entry in lsp .fs .listDirectory (Uri ) do
2022 local Name = string.sub (Entry :toString (), # Uri :toString () + 2 )
2123 local Library = string.match (Name , "(.*)%.meta%.json$" )
2224
2325 if Library and IsLibrary (Entry ) then
2426 local FixedPath = Entry .path
2527
28+ FixedPath = string.gsub (FixedPath , "[/\\ ]" , "/" )
29+
30+ if string.find (FixedPath , "^/?%a:" ) then
31+ FixedPath = string.sub (FixedPath , 2 )
32+ end
33+
2634 for _ , Directory in ipairs (string.split (RelativeTo , "/" )) do
2735 if string.find (FixedPath , `{Directory }/` , 1 , true ) == 1 then
2836 FixedPath = string.sub (FixedPath , # Directory + 2 )
@@ -48,10 +56,10 @@ return {
4856 local Changes = {}
4957 local Line , LineStart = 1 , 1
5058
51- local Libraries = GetLibraries ((string.gsub (Context .filePath , "/ [^/]-$" , "" )))
59+ local Libraries = GetLibraries ((string.gsub (Context .filePath , "[/ \\ ] [^/\\ ]-$" , "" )))
5260
5361 for Index = 1 , # Source do
54- if Source [ Index ] == "\n " then
62+ if string.sub ( Source , Index , Index ) == "\n " then
5563 Line += 1
5664 LineStart = (Index + 1 )
5765 end
@@ -70,14 +78,22 @@ return {
7078 Success , LoadData = pcall (lsp .json .deserialize , LoadData )
7179
7280 if not Success then
73- lsp .client .sendLogMessage ("info " , `Failed to process match: "{Match }"` )
81+ lsp .client .sendLogMessage ("warning " , `Failed to process match: "{Match }" in { Context . filePath }. ` )
7482
7583 continue
7684 end
7785
7886 local Column = (Index - LineStart + 1 )
7987 local Library , NamedImports = unpack (LoadData )
8088
89+ lsp .client .sendLogMessage ("log" , `Setup require path {Libraries [Library ]} in {Context .filePath }:{Line }:{Column } for {Library }` )
90+
91+ if not Libraries [Library ] then
92+ lsp .client .sendLogMessage ("warning" , `No path for "{Library }" in {Context .filePath }.` )
93+
94+ continue
95+ end
96+
8197 if NamedImports then
8298 local NewText = ""
8399
0 commit comments