Repository navigation
Allow report_change to skip static object analysis - #970
Open
wozhenbang2004 wants to merge 5 commits into
Open
wozhenbang2004 wants to merge 5 commits into
wozhenbang2004 wants to merge 5 commits into
Conversation
Preserve resource notifications and default automatic_soa behavior. Related to python-rope#925.
Cover skipping analysis, resuming default analysis, and preserving automatic_soa preferences.
Use an editor-style filesystem overlay and verify parsed modules refresh without writing the buffer to disk.
Explain notification-only updates and how to resume analysis after several edits.
Document the additive public API for editor buffer notifications.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #970 +/- ##
==========================================
+ Coverage 95.44% 95.45% +0.01%
==========================================
Files 134 134
Lines 26910 26960 +50
==========================================
+ Hits 25685 25736 +51
+ Misses 1225 1224 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Editor integrations that provide unsaved buffers through
fscommands.read()need to refresh Rope's cached modules after buffer edits.report_change()already notifies the resource observers, but it also runs static object analysis whenautomatic_soais enabled. That makes using it on every keystroke unnecessarily expensive.Add a keyword-only
perform_soa=Trueoption. An editor can callreport_change(..., perform_soa=False)to refresh the caches and defer analysis. Existing calls retain their behavior, and the option leaves the project'sautomatic_soapreference unchanged. The library documentation explains how to analyze the whole module or retain the last analyzed contents after several deferred edits.This follows the suggested API direction in #925. The broader filesystem work in #911 remains separate; this change only adds the notification-only
report_change()path and its documentation.Related to #925.
Three new tests use real module caches and inferred objects to cover an unsaved buffer update, skipping analysis followed by the existing default analysis, and respecting
automatic_soa=False. They fail on the base because the new keyword is unavailable, then pass with this change.Validation on Python 3.12.14:
report_changetests pass: 4 passed.AF_UNIXsocket in this environment; the compiled-module fixture expects_sqlite3.__file__, which this statically linked runtime does not provide.This patch and its validation were prepared with ChatGPT (GPT-6 Astra Pro).
Checklist (delete if not relevant):