-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
perf: use cache for outdated rocks and trigger on more events #5
Conversation
Review ChecklistDoes this PR follow the Contribution Guidelines? Following is a partial checklist: Proper conventional commit scoping:
If applicable:
|
lua/rocks-edit/sources/updates.lua
Outdated
local cache_populated = false | ||
|
||
require("rocks-edit.api").register(function(toml, diagnostic) | ||
nio.run(function() | ||
local updates = require("rocks.state").outdated_rocks() | ||
local updates = require("rocks.api").try_get_cached_outdated_rocks() | ||
--- HACK: internal API! Rocks.nvim should provide an option to fall back to a | ||
--- luarocks query if the cache is not populated. | ||
if not cache_populated and #updates == 0 then | ||
updates = require("rocks.state").outdated_rocks() | ||
cache_populated = true | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is hacky and should be replaced with a rocks.nvim API (see commend).
Also, we need a user event that triggers a refresh when the cache has been updated.
a9eca46
to
8200e6e
Compare
I've ended up adding a bit more to this than initially planned:
|
@vhyrro this one is ready :) |
No description provided.