LuaLS / LuaLS/lua-language-server

Lazy load workspace libraries

未关闭
#1,745 8 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

enhancement
主要语言
Lua
星标
4.4k
派生
442
PR 合并指标
30 天内没有已合并 PR

描述

I'm using sumneko_lua with Neovim and I wanted to have completions from the Lua plugins I have installed, so I inserted all the paths to the plugins that I have into Lua.workspace.library

But the problem is that it that sumneko_lua loads all the files inside those libraries right on startup, causing a massive increase to my RAM usage. Normally sumneko_lua only takes up 100-200 MB, but after adding 40+ library paths, sumneko now takes up to 600-700 MB.

Is it possible to load the libraries into the workspace, only when it is needed?
For example, I don't believe the library needs to be loaded when you're only completing a require statement:

local foobar = require("foob|

sumneko_lua only needs to scan the directories listed in Lua.workspace.library to find the correct files.

Once the require statement is completed, and its return value is interacted with:

local foobar = require("foobar")
foobar.call_functi|

sumneko_lua can now then load the library in order to produce the completions.

Is it possible for something like this to be implemented?

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

首先跟踪 Lua.workspace.library 路径的加载方式,以及 require 语句补全如何查找匹配的文件。然后检查所需库何时可用于成员补全。完成的标准是:搜索库路径时无需在启动时加载每个文件,同时 require("foobar") 和 foobar.call_function 等补全仍然有效。

由索引模型根据 Issue 内容生成。

评估

技术栈
lua, neovim
领域
devtools, performance
Issue 类型
功能
难度
5/5
预计耗时
一周以上
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。