Skip to content

Commit 2ab426a

Browse files
committed
Another attempt to solve "no managed text document"
1 parent f1cf6d0 commit 2ab426a

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

src/WorkspaceFileResolver.cpp

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,20 @@ Luau::ModuleName WorkspaceFileResolver::getModuleName(const Uri& name)
1919
const TextDocument* WorkspaceFileResolver::getTextDocument(const Luau::ModuleName& name) const
2020
{
2121
auto it = managedFiles.find(name);
22-
if (it == managedFiles.end())
23-
return nullptr;
24-
return &it->second;
22+
if (it != managedFiles.end())
23+
return &it->second;
24+
25+
// HACK: attempting to solve "No managed text document"
26+
// Check to see if we have the file stored using the URI instead
27+
// https://github.com/JohnnyMorganz/luau-lsp/issues/26
28+
if (auto fsPath = resolveToRealPath(name))
29+
{
30+
it = managedFiles.find(fsPath->generic_string());
31+
if (it != managedFiles.end())
32+
return &it->second;
33+
}
34+
35+
return nullptr;
2536
}
2637

2738
std::optional<SourceNodePtr> WorkspaceFileResolver::getSourceNodeFromVirtualPath(const Luau::ModuleName& name) const

0 commit comments

Comments
 (0)