-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
feat: Add auto_index_on_activate config option #798
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
base: main
Are you sure you want to change the base?
Conversation
Add a new project-level configuration option that automatically indexes the project when it is activated. This pre-populates symbol caches for faster first queries without requiring manual `serena project index`. Changes: - Add auto_index_on_activate field to ProjectConfig (default: false) - Implement _auto_index_project() method in SerenaAgent - Call auto-indexing after language server initialization - Add documentation in project.template.yml - Add unit tests for config parsing
143867f to
f5d42b6
Compare
|
I am not really convinced this is a useful feature, because it is likely to waste more time than it saves. Did you really find it beneficial to enable this? |
for large codebases and on startup for the day, yeah it's highly beneficial. normally im running |
I don't understand this, the indexing should be performed just once, the index is automatically and incrementally updated after. Why do you have to do this? Are you starting 5-10 new projects or switching computers every day? |
|
I see how it could help for cases where you switch between git branches where a large number of files are different, for example. |
| if self._project_activation_callback is not None: | ||
| self._project_activation_callback() | ||
|
|
||
| def _auto_index_project(self, project: Project) -> None: |
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 duplicates the indexing logic that we already have in other places. If we decide to implement this feature, the duplication should be resolved.
We also have to make sure that it doesn't block the MCP server from connecting. It may also be very annoying to users (or to the LLM that calls our tools) that tools are unresponsive before the project is indexed. Maybe it makes sense to run this one thing in a separate process
|
apologies for the late reply! i've been on a ☃️ snowy vacation (happy holidays 😄)
not sure if this is intended/unintentional behavior, but with Rust/Rust-Analyzer, the symbols don't incrementally update properly at all. i noticed this ~3-4 months ago maybe, but the "Enable Check on Save" RA config setting, as well as some other odd RA behavior will cause Serena's symbol cache to either expire or need to be rebuilt VERY often. Serena will freeze at times due to this when running the
i'm happy to rework this PR/create a new one to unblock this in my free time this week. in regards to your comment, in local testing i did notice that (at least in Rust codebases, which is a critical detail of this probably, i really only work with Rust, but i'll test this behavior with other languages) Serena will take a long time to initialize with this integrated in Rust codebases, especially large workspaces with many crates/artifacts, as Serena has to wait on Activation (where i placed the config setting call/command) for RA to check/build/compile artifacts before it's unblocked, mirroring the behavior that happens if you were to open two IDE's/terminal instances, and run i'll look into the behavior in other languages, but as far as Rust goes, it seems like there's not an easy way to have it be non-blocking and would definitely cause the annoyances you've mentioned here. |
Summary
auto_index_on_activateconfig option toProjectConfig(defaults tofalse)Changes
auto_index_on_activate: bool = Falsefield toProjectConfigdataclass_auto_index_project()method inSerenaAgentthat runs after LSP initializationproject.template.ymlwith documentation for the new optionTest plan
uv run poe format- passesuv run poe type-check- passesuv run poe test- all 10 config tests pass