Repository navigation
fix(imports): count @ox_core/lib/init.lua as loading @ox_lib/init.lua - #22
Merged
Merged
Conversation
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.
Closes #19
@ox_core/lib/init.luaruns@ox_lib/init.luaitself whenlibis not defined yet, so a resource that imports it haslib,cacheand the other ox_lib globals at runtime. The linter and the language server only knew the ox_core import forOx, andfivem/import-not-declaredasked for an@ox_lib/init.luaentry that is redundant at runtime.Resulting behaviour
KnownImport::loads);@ox_core/lib/init.lualoads@ox_lib/init.lua.resource_importsadds those on the side of the import that runs them, unless the manifest or the configured imports already load them there. Both tools build the resource environment from it, so the ox_lib globals, the ox_libtableandmathextensions,qbox/prefer-cacheand provider-scoped definition files follow an ox_core import. ox_core's ownlib/init.luaseeslibin the resources that run it, too.lib.notifyresolves to ox_lib's definition, and definition files in a library folder namedox_libreach those resources.manifest/missing-dependencytreats a resource that an import loads like one the manifest imports directly.@ox_lib/init.luaas well keeps working and adds nothing twice.Tests
qbx_lua_analysis: unit test for the expansion, including sides and imports already listed.qbx_lint: the ox_core import on each side, with the wrong-side cases still reported, and an installed ox_core with the manifest shape its build generates.qbx_lua_ls: ox_lib indexed andlib.notifyresolved through the ox_core import; anox_libdefinition folder reaching importers of ox_core only.Checks
cargo fmt --all --checkcargo clippy --workspace --all-targets --locked -- -D warningscargo test --workspace --locked