'index' operation
- Dominant language
- JavaScript
- Stars
- 2
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
Sometimes plugins need to do expensive queries, such as reading all of the files in a project.
We should add a way for them to do this occasionally when files change. It needs to be able to index from a cold state, as well as with a hot cache.
In the JS plugins, it should be modeled as an async function that takes the current state and a list of changed files, and returns a new state object, like a reducer in redux, but less pure.
When a command is run, if we're currently executing an index function, we wait for it to complete. If the index hasn't started, or our batched updates haven't been applied, we run and wait for the index before running the command.
Commands can be used from multiple editors or instances of those editors, so the cache files need to be per project path. This is extra important for inherited shide commands from parent directories (e.g. ~/.config/shide).
Would it make sense to have indexes that can be used by multiple shide functions? An example of this would be parsing imports and exports in a JS project. Multiple commands indexing the same files in the same way would be wasteful.
Contributor guide
No contributing guide indexed for this repository
Research direction
The issue names no files or tests; start by locating the JavaScript plugin entry points and command execution path. Define how cold and hot indexes consume changed files, persist per project path, share data, and block commands until updates finish; done means these behaviors are covered and verified.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- cli, developer-experience
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100