diff --git a/CHANGELOG.md b/CHANGELOG.md index e4e528d1..f003270e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Fixed inlay hints no longer showing up - Fixed inlay hints not showing up in first load of file until a dummy change is made +- Fixed DM types not generated for `script` nodes. Improved autocomplete will now be provided for non-DataModel projects (e.g. `Tool` as Root) ## [1.11.1] - 2022-10-01 diff --git a/src/LuauExt.cpp b/src/LuauExt.cpp index fe5eebfb..e57b837a 100644 --- a/src/LuauExt.cpp +++ b/src/LuauExt.cpp @@ -348,8 +348,8 @@ void registerInstanceTypes(Luau::TypeChecker& typeChecker, Luau::TypeArena& aren if (auto node = fileResolver.isVirtualPath(name) ? fileResolver.getSourceNodeFromVirtualPath(name) : fileResolver.getSourceNodeFromRealPath(name)) { - if (expressiveTypes && node.value()->ty) - scope->bindings[Luau::AstName("script")] = Luau::Binding{node.value()->ty}; + if (expressiveTypes) + scope->bindings[Luau::AstName("script")] = Luau::Binding{getSourcemapType(typeChecker, arena, typeChecker.globalScope, node.value())}; } }; } diff --git a/src/include/LSP/WorkspaceFileResolver.hpp b/src/include/LSP/WorkspaceFileResolver.hpp index 852cac2f..34db2223 100644 --- a/src/include/LSP/WorkspaceFileResolver.hpp +++ b/src/include/LSP/WorkspaceFileResolver.hpp @@ -42,7 +42,7 @@ struct WorkspaceFileResolver /// The name points to a virtual path (i.e., game/ or ProjectRoot/) bool isVirtualPath(const Luau::ModuleName& name) const { - return name == "game" || name == "ProjectRoot" || Luau::startsWith(name, "game/") || Luau::startsWith(name, "ProjectRoot"); + return name == "game" || name == "ProjectRoot" || Luau::startsWith(name, "game/") || Luau::startsWith(name, "ProjectRoot/"); } // Return the corresponding module name from a file Uri