-
Notifications
You must be signed in to change notification settings - Fork 17
fix: update via code change correctly #48
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
Conversation
📝 WalkthroughWalkthroughThe activation function in the extension now listens to three VSCode workspace events: text document changes, saves, and opens. The event handlers pass the relevant Changes
Sequence Diagram(s)sequenceDiagram
participant VSCode
participant Extension
participant SnakemakeManager
VSCode->>Extension: onDidChangeTextDocument / onDidSaveTextDocument / onDidOpenTextDocument (TextDocument)
Extension->>SnakemakeManager: onDocumentChange(document)
SnakemakeManager->>SnakemakeManager: Process document change (debounced update)
Assessment against linked issues
Assessment against linked issues: Out-of-scope changesNo out-of-scope changes found. 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🔇 Additional comments (4)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
|
@johanneskoester Dear Professor, sorry for the mistake I made in the last PR. This PR should fix that. Would you mind to have a look? Thanks! |
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.
Pull Request Overview
This PR enhances document event handling for Snakemake files by listening to additional VS Code events and updating the manager API accordingly.
- Added
onDidSaveTextDocumentandonDidOpenTextDocumentsubscriptions alongside change events - Exported
SnakemakeManagerand refactoredonDocumentChangeto take aTextDocument - Debounced manager updates with a 200 ms delay
Comments suppressed due to low confidence (2)
src/extension.ts:61
- [nitpick] The method name
onDocumentChangenow handles change, save, and open events. Consider renaming it to something likehandleDocumentEventorscheduleDocumentUpdateto better reflect its broader responsibility.
onDocumentChange(document: vscode.TextDocument) {
src/extension.ts:12
- New handlers for save and open events have been added; consider adding unit or integration tests to verify that updates are triggered correctly for
onDidSaveTextDocumentandonDidOpenTextDocument.
vscode.workspace.onDidSaveTextDocument((document) => snakemakeManager.onDocumentChange(document)),
| this.updateTimeout.set(document.uri.toString(), setTimeout(() => { | ||
| this.update(document); | ||
| this.updateTimeout.delete(document.uri.toString()); | ||
| }, 200)); |
Copilot
AI
Jul 14, 2025
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.
[nitpick] The hardcoded debounce delay of 200 ms could be extracted into a named constant (e.g., UPDATE_DEBOUNCE_DELAY_MS) to make the purpose clear and simplify future adjustments.
| }, 200)); | |
| }, UPDATE_DEBOUNCE_DELAY_MS)); |
will fix #47
Summary by CodeRabbit
Bug Fixes
Chores