Skip to content

Commit

Permalink
Fix getSourcemapType for script nodes
Browse files Browse the repository at this point in the history
Fixes #171
  • Loading branch information
JohnnyMorganz committed Oct 8, 2022
1 parent eb50e18 commit 1434159
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions src/LuauExt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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())};
}
};
}
Expand Down
2 changes: 1 addition & 1 deletion src/include/LSP/WorkspaceFileResolver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1434159

Please sign in to comment.