Skip to content

Comments

Quality of Life Improvements for UI namespace#738

Merged
Endaris merged 4 commits intopanel-attack:betafrom
Endaris:importNamespaceQoL
Jan 24, 2026
Merged

Quality of Life Improvements for UI namespace#738
Endaris merged 4 commits intopanel-attack:betafrom
Endaris:importNamespaceQoL

Conversation

@Endaris
Copy link
Collaborator

@Endaris Endaris commented Jan 16, 2026

There will be a bunch of smaller PRs that I'll try to extract from #649 that provide some tangible benefits for the project without the rest of the resizeable UI package.

With the PATH substitution for the requires in ui/init.lua, the requires only get resolved at runtime. That's bad because it means LuaLS does not resolve them when running diagnostics and intellisense stops there. One idea of doing that in the first place was making the entire ui folder easy to move around as a package without having to adjust all explicit requires

Introduce: Relative require via a dedicated import function
Internally this accesses lua's debug functions to figure out the actual path and make a path substitution. Simple enough, does on its own not solve the above problem as that too is a runtime property.

Introduce next: The plugin functionality of LuaLS. By using an OnSetText method we can effectively "live search & replace". Which means we can pattern match for import("%s") and then replace the import with an actual full path require that LuaLS then resolves correctly so that Intellisense can work for these.

By annotating each entry in the ui table with ---@source filename.lua, Go To Source/F12 immediately directs to the correct file instead of init.lua and if the ui class itself is properly annotated it starts to be not that terrible.

@Endaris Endaris added the Cleanup Cleans up code or adds documentation, does not affect gameplay label Jan 16, 2026
@Endaris Endaris merged commit e9ba361 into panel-attack:beta Jan 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Cleanup Cleans up code or adds documentation, does not affect gameplay

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant