LuaLS / LuaLS/lua-language-server
[Feature request] Class-based auto-require
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Lua
- Sterne
- 4.4k
- Forks
- 442
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
My project has some strict styling, and what we have is a system where:
MyClassis the sole returned class inmyclass.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.)
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Prüfe zuerst die vorhandene auto-require-Einstellung des Language Servers und die zugehörige Anfrage #3201. Die Arbeit ist abgeschlossen, wenn klassenbasierte Vorschläge die angeforderte Anweisung im Import-Stil erzeugen können, anstatt sich nur auf Dateinamen zu stützen.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- lua
- Bereich
- tooling
- Issue-Typ
- Feature
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100