Skip to content

Lazy load workspace libraries #1745

Open
@musjj

Description

@musjj

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions