Skip to content

[Feature request] Class-based auto-require #3202

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
NyakoFox opened this issue Jun 13, 2025 · 0 comments
Open

[Feature request] Class-based auto-require #3202

NyakoFox opened this issue Jun 13, 2025 · 0 comments

Comments

@NyakoFox
Copy link
Contributor

NyakoFox commented Jun 13, 2025

My project has some strict styling, and what we have is a system where:

  • MyClass is the sole returned class in myclass.lua, annotated and everything
  • Usage is local MyClass = import("src.myclass")

The language server has a setting for auto-requires. Unfortunately, it hardcodes the require function & is completely filename based.

I've just opened #3201 to add the import thing, but I'd like to request a setting which makes auto-requires work better with the class names, rather than being filename-based.

Ex. MyClass.something() suggests to require the file as local MyClass = import("src.myclass") rather than myclass.

We've considered either not caring (very ugly for code-style), manually fixing it every time (makes auto-requires kind of useless) or changing the filenames to be cased the same as the class (not a proper solution but a workaround -- one that would make the file structure look worse & fear for case sensitive filesystems)

As far as I can tell, this seems like a language server limitation rather than a design limitation. I would try to contribute this option myself, but this codebase seems too complicated for me to understand unfortunately...

(I just realized I opened a similar request a year ago -- I completely forgot and have closed it now.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant