Repository navigation
feat(config): add imports for files loaded without an fxmanifest entry - #6
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.
Changes
Some resources run code from another resource without an
fxmanifest.luaentry, for example a shared library whose loader callsload(LoadResourceFile(...))for each of its files. The linter cannot follow that, so every global those files define is reported asundefined-globalin the resources that use them. Listing them underglobalsmeans naming each one by hand and losing the client/server checks.importslists those files as@resource/pathpatterns, grouped by the side they run on. Each resource then sees their globals as if its manifest imported them:*stays within a folder,**crosses folders, and case is ignored.clientimports, and client scripts do not see those ofserverimports.@oxmysql/lib/MySQL.luakeep their built-in globals when the resource is not installed. Any other pattern that matches no file is reported like an unresolved manifest import.@resource/pathLua pattern stops the config from loading, with an error naming it.docs/reference.md;examples/qbxlint.tomlshows the new table.Implementation:
resource_imports(manifest plus configured imports) andResourceEnv::add_importinproject.rsreplace theadd_importfree function. qbx-lua-ls uses them too, so both build the same environment; only resolving a pattern to files differs (disk here, the index there).ResourceLocatorkeeps each imported file's parsed summary, so a library imported by many resources is parsed once per run.@res/client/*.lua, are now followed instead of reported as unresolved.Language server support: Qbox-project/qbx-lua-ls#6
Checks
cargo fmt --check,cargo clippy --all-targets(no warnings) andcargo testpass on Windows. Not run on Linux locally.config.rs; an end-to-end CLI test intests/cli.rscovering sides and a resource the override does not match.load(LoadResourceFile(...)),undefined-globalwent from 349 to 25 with the same run time (about 0.5 s). The remaining reports come from escrowed resources and unrelated third-party code.Generated with Claude Code