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