-
Notifications
You must be signed in to change notification settings - Fork 30.6k
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
Opening file with source:line breaks Cmd+D "Add Next Occurance" #79460
Comments
(Experimental duplicate detection) |
@alexandrudima how can we detect a keypress in the first place if the window is not focused? Are you maybe thinking of macOS where all keys go through the top level menu and not the active window? But this seems to be Windows... |
Hi, I clarified in the first message that it's Mac OS. I originally pasted in the version number but didn't specify that it was Mac, sorry about that. |
Got it, moving to @sbatten who owns menu interactions. |
#71553 does seem possibly related, but opening files from the command line (for me) does not exhibit the behavior I described in the issue. I am able to Cmd+D fine in that scenario. I tried a couple of other ideas:
It appears to be related to however VSCode is opening files and going to a specific line number. |
@bpasero The menu bar calls My guess would be that the |
@alexandrudima I tried to setup #71553 (comment) and my menu bar does not flash and I used a fresh user data dir to rule out the possibility of a setting having an impact. What are you doing different? |
@alexandrudima oh, now that I actually look into the menu code, this seems very fishy: // We make sure to not run actions when the window has no focus, this helps
// for https://github.com/Microsoft/vscode/issues/25907 and specifically for
// https://github.com/Microsoft/vscode/issues/11928
// Still allow to run when the last active window is minimized though for
// https://github.com/Microsoft/vscode/issues/63000
let activeWindow = this.windowsMainService.getFocusedWindow();
if (!activeWindow) {
const lastActiveWindow = this.windowsMainService.getLastActiveWindow();
if (lastActiveWindow && lastActiveWindow.isMinimized()) {
activeWindow = lastActiveWindow;
}
} @sbatten it looks like we fail to send the action to the last active window at least? any particular reason? E.g. when you check the implementation of
I wonder if we should change |
@bpasero based on the issues in the comments, it seems like that would break things elsewhere, no? That whole section has you for git blame. |
Ok, I think it is fine to leave the code as it is but then I wonder why starting Code from the command line would not correctly put focus into the window that opens. Or at least, why Electron would not return the window back that is opening. To clarify: it is the same window that gets opened, not a new one right? Do people see the window with inactive title color? Does it visually look focused? |
Correct, it is the same OS window that gets opened. VS Code is visually (and behaviorally) active, I am able to move the cursor, type, run commands, select text, etc. However, while testing your inquiry I found a new data point. This issue only happens if the file is already open in an editor. If the file is being opened into a new editor, it works as expected. Reproduction
Related shortcut keys not working I noticed while doing these reproduction steps, that this issue also affects the Additional Testing I wondered if this issue affected other "what's under the cursor?" commands, and they seem to be working fine.
Hope this helps. |
@bbugh do other keybindings like |
Yes, all of the other editor shortcuts I’ve tried work fine. I usually don’t even notice an issue opening files from the terminal unless I try to select occurrences. The issue seems to be isolated to the “select matches” behavior shortcuts. |
@alexandrudima is there anything specific to that command compared to closing editor? |
No, not that I can think of. |
@bbugh can you do an experiment and run "code --verbose" which will print a log statement to the console everytime a command is executed and then check the dev tools console for output? Should look like this: |
@bpasero Here's a gist with the logs, reproducing the issue. I put a break where I first opened the file ( https://gist.github.com/bbugh/b01c2c591fbd9a6afeb86ea1c2271a1f |
@bpasero the image didn't load on my phone earlier and I misunderstood what you meant. I re-ran vscode with When the issue is happening, It appears that something is preventing the command from activating altogether. |
@bbugh would you be willing to try to reproduce this running VSCode out of sources so that we can debug this further? There are instructions at https://github.com/microsoft/vscode/wiki/How-to-Contribute |
This issue has been closed automatically because it needs more information and has not had recent activity. See also our issue reporting guidelines. Happy Coding! |
@bpasero thank you for the reminder.
I recorded the reproduction if you'd like to see it, but it seems like |
@bbugh hm it should be version 1.39 though, can you check? Could it be by accident you got updated (actually downgraded)? Maybe disable updates from settings to be safe. |
Sorry, you're right, it was 1.39.
|
Wow good to know, looks like my changes fixed it then. |
@bbugh still good with latest insider release from today? Then I would go ahead and close this. |
Please report back otherwise. |
Actually duplicate of #71553 (comment) |
Issue
Here's a weird one for you! This is 100% reproducible, and only appeared recently.
Whenever I open Visual Studio Code using line numbers (from iTerm2 shortcut or others), the Cmd+D shortcut key to select other instances doesn't work until the VSCode window loses and regains focus.
Does this issue occur when all extensions are disabled?: Yes
Steps to Reproduce:
Part 1
Part 2
Part 3
The text was updated successfully, but these errors were encountered: