Typing continuation: convert imports to use require()#9887
Closed
vaisest wants to merge 26 commits into
Closed
Conversation
- adding a type hint for new() and newClass() - adding simple ---@Class x: y type hints for base class variables
… being an argument to newClass
…`) to fix type checking
…f using new() and varargs
Fix minion exports Fix ModCache generation Convert LoadModule calls which return multiple values to use require() Convert LoadModule calls which use .. Remove useless file extensions Rest of the owl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of the problem being solved:
This solves the remaining problems of #9861, which is that PoB uses
LoadModule(), which allows for importing modules in ways thatrequire()doesn't. For example, some modules are imported by passing them varargs containing the destination table and helper functions.require()does not take in other inputs, and does not allow returning multiple values.This solves that by:
I haven't been able to get a clear answer to what else
LoadModule()does differently, but the last part is technically extra. I assume there's reason to preferrequire(), because it's a standard Lua function, but just convertingLoadModule()to work exactly like it allows for treating it like it isrequire()in the language server. Either way typing info is retained. If necessary, the last change can be reverted.Note that due to running all export scripts, the amount of changed files is inflated somewhat.
Steps taken to verify a working solution:
Link to a build that showcases this PR:
Before screenshot:
After screenshot: