Cursor Focus Disruption During Tool Operations #1358
Replies: 4 comments 1 reply
-
I am having the same issue, it is extremely disrupting. It prevents me from reading plans, making commits and any other task I need to do while I wait for the LLM to work. |
Beta Was this translation helpful? Give feedback.
-
I've been looking at this. The 2 cases are going to need different fixes.
There's 2 possible ways to fix this. One is a targetted fix to the handling of the ask_followup_question tool. The focus switch is triggered because of the combination of the text box being enabled, and the buttons disabled when the tool completes. By changing the button handling so the buttons are explicitly not present, we can avoid the focus change. The other approach is to completely remove the code that grabs the focus for the text box here. Given that task completion can take a while, and the user may have navigated elsewhere in the IDE, it's not obvious to me that we ever want to grab focus back to the text window. The useEffect code was originally added to grab focus "when feedback is required". However it's not clear that's desirable behaviour, given the user might be in the middle of some other activity while waiting for Roo to complete its work... As far as I can tell, none of the other tools will trigger the focus grab when they complete. This is because the focus grab only happens when The one other time I can see this focus grab is triggered is when switching between Roo tabs (e.g. from Prompts/Settings etc.) to "New Task". I guess we do want to keep that behaviour. There is a different focus grab that is triggered when the Roo extension becomes visible (e.g. switch from another extension). I tried removing the I can do a PR for that. I will look at the 2nd issue now, and then add some more notes here. |
Beta Was this translation helpful? Give feedback.
-
On 2, I have found the following: We use vscode.diff to open the diff: This supports optional controls using TextDocumentShowOptions I have experimented with setting the option I am on this version of VSCode: Version: 1.98.2 (user setup) If we wanted to pursue this approach, proposed next step on this would be to create an isolated repro, and raise a bug with the VSCode team. But it looks like this might be a hard one to solve. For future records, the two lines of code I changed were:
and (for the case where a diff is already open - though I couldn't find a way to test this as apply_diff seems to begin by closing any pre-existing diffs...)
If we can't solve preserving focus on If Roo displayed an indication that a diff was ready for review, but didn't grab focus, then the user could continue with their work without interruption and then view the diff at the point they were ready. That should be a fairly easy change to the workflow, and might be an improvement, if we can't get VSCode to open diffs without losing focus? |
Beta Was this translation helpful? Give feedback.
-
#2263 fixes item 1. @hannesrudolph For item 2, any thoughts on the suggestion of adding an additional user interaction (without any focus grab) before displaying a diff? I'd be happy to look at this if you think that's a reasonable solution. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Which version of the app are you using?
3.3.14
Which API Provider are you using?
OpenRouter
Which Model are you using?
n/a
What happened?
The cursor focus is being unintentionally redirected during certain tool operations in Roo Code:
When the
ask_followup_question
tool is used, the cursor focus automatically shifts away from the current active location (e.g., if typing in another Roo Code tab).When using file modification tools (
write_to_file
orapply_diff
), the cursor focus automatically moves to the modified document, even if the user was actively typing in the task prompt box.This behavior disrupts the user's workflow and requires manual refocusing to continue their previous task.
Steps to reproduce
For ask_followup_question Tool:
ask_followup_question
toolask_followup_question
tool, observe that the cursor focus shifts away from Tab B where you were typingFor File Modification Tools:
write_to_file
orapply_diff
tool operationRelevant API REQUEST output
Additional context
No response
Beta Was this translation helpful? Give feedback.
All reactions