LuaLS / LuaLS/lua-language-server

Lazy load workspace libraries

オープン
#1,745 コメント 8 件 リアクション 1 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

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. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず、Lua.workspace.library のパスがどのように読み込まれるか、また require ステートメントの補完が一致するファイルをどのように見つけるかを追跡します。次に、メンバー補完で必要なライブラリが利用可能になるタイミングを調べます。起動時にすべてのファイルを読み込まずにライブラリのパスが検索され、require("foobar") や foobar.call_function などの補完が引き続き機能すれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
lua, neovim
領域
devtools, performance
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。