LuaLS / LuaLS/lua-language-server
[Feature request] Class-based auto-require
還沒有人認領這個 Issue。
- 主要語言
- Lua
- 星號
- 4.4k
- 分支
- 442
- PR 合併指標
- 30 天內沒有已合併 PR
描述
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.)
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
首先檢視 language server 現有的 auto-require 設定,以及相關的 #3201 請求。當以類別為基礎的建議可以產生所要求的 import 風格陳述式,而不只是依賴檔名時,這項工作就完成了。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- lua
- 領域
- tooling
- Issue 類型
- 功能
- 難度
- 5/5
- 預估耗時
- 一週以上
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100