vscode-csharp
vscode-csharp copied to clipboard
Focus is repeatedly stolen from terminal
Reposted from https://github.com/microsoft/vscode/issues/125800
Issue Type: Bug
- Open dotnet/winforms project
- Click on the terminal tab
- Repeat step 2
https://user-images.githubusercontent.com/2119212/121288205-fd09a880-c8b0-11eb-848b-7cc668a30f70.mov
VS Code version: Code 1.56.2 (054a9295330880ed74ceaedda236253b4f39a335, 2021-05-12T17:44:30.902Z) OS version: Darwin x64 19.6.0
System Info
| Item | Value |
|---|---|
| CPUs | Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz (8 x 2500) |
| GPU Status | 2d_canvas: enabled gpu_compositing: enabled metal: disabled_off multiple_raster_threads: enabled_on oop_rasterization: enabled opengl: enabled_on rasterization: enabled skia_renderer: disabled_off_ok video_decode: enabled webgl: enabled webgl2: enabled |
| Load (avg) | 3, 3, 3 |
| Memory (System) | 16.00GB (0.71GB free) |
| Process Argv | --crash-reporter-id 1fc67ee2-0174-4598-9f98-4537df0dd32c |
| Screen Reader | no |
| VM | 0% |
Extensions (55)
| Extension | Author (truncated) | Version |
|---|---|---|
| vscode-bazel | Baz | 0.4.1 |
| LinkCheckMD | bla | 0.3.1 |
| open-in-macdown | Cod | 1.0.0 |
| vscode-zonefile | Com | 0.0.4 |
| vscode-markdownlint | Dav | 0.42.0 |
| jshint | dba | 0.11.0 |
| vscode-eslint | dba | 2.1.20 |
| dhall-lang | dha | 0.0.4 |
| docs-article-templates | doc | 0.2.11 |
| docs-authoring-pack | doc | 0.1.13 |
| docs-images | doc | 0.0.9 |
| docs-linting | doc | 0.0.7 |
| docs-markdown | doc | 0.2.94 |
| docs-metadata | doc | 1.0.6 |
| docs-preview | doc | 0.3.57 |
| docs-scaffolding | doc | 0.0.8 |
| docs-yaml | doc | 0.2.6 |
| EditorConfig | Edi | 0.16.4 |
| prettier-vscode | esb | 6.4.0 |
| go | gol | 0.25.1 |
| terraform | has | 2.12.0 |
| haskell | has | 1.4.0 |
| hive-sql | jos | 0.0.4 |
| language-haskell | jus | 3.4.0 |
| vscode-sbt-scala | lig | 0.2.4 |
| autoconf | mae | 0.1.0 |
| hg | mrc | 1.7.1 |
| vscode-docker | ms- | 1.13.0 |
| csharp | ms- | 1.23.12 |
| vscode-kubernetes-tools | ms- | 1.3.3 |
| vscode-postgresql | ms- | 0.3.0 |
| python | ms- | 2021.5.842923320 |
| vscode-pylance | ms- | 2021.6.0 |
| jupyter | ms- | 2021.6.832593372 |
| cmake-tools | ms- | 1.7.3 |
| cpptools | ms- | 1.4.1 |
| powershell | ms- | 2021.5.1 |
| vscode-typescript-tslint-plugin | ms- | 1.3.3 |
| fabric8-analytics | red | 0.3.3 |
| java | red | 0.79.2 |
| vscode-commons | red | 0.0.6 |
| vscode-xml | red | 0.16.1 |
| vscode-yaml | red | 0.19.2 |
| preview-vscode | sea | 2.2.5 |
| code-spell-checker | str | 1.10.2 |
| html-preview-vscode | tht | 0.2.5 |
| simple-rst | tro | 1.0.1 |
| cmake | twx | 0.0.17 |
| vscodeintellicode | Vis | 1.2.14 |
| vscode-java-debug | vsc | 0.34.0 |
| vscode-java-dependency | vsc | 0.18.4 |
| vscode-java-pack | vsc | 0.16.0 |
| vscode-java-test | vsc | 0.30.0 |
| vscode-maven | vsc | 0.31.0 |
| markdown-all-in-one | yzh | 3.4.0 |
A/B Experiments
vsliv368:30146709
vsreu685:30147344
python383cf:30185419
pythonvspyt602:30300191
vspor879:30202332
vspor708:30202333
vspor363:30204092
vswsl492:30256859
pythonvspyt639:30300192
pythontb:30283811
pythonvspyt551:30311712
vspre833:30267464
pythonptprofiler:30281270
vshan820:30294714
pythondataviewer:30285071
vscus158:30286553
pythonvsuse255cf:30311221
vscgsv2:30307504
vscorehov:30309549
vscod805cf:30301675
binariesv517:30312825
Environment data
dotnet --info output:
VS Code version:
C# Extension version:
Host (useful for support): Version: 5.0.6 Commit: 478b2f8c0e
.NET SDKs installed: 5.0.300 [/usr/local/share/dotnet/sdk]
.NET runtimes installed: Microsoft.AspNetCore.App 5.0.6 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 5.0.6 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
To install additional .NET runtimes or SDKs: https://aka.ms/dotnet-download
OmniSharp log
Steps to reproduce
Open a clone of dotnet/winforms Open a terminal tab Try to use it
Expected behavior
Focus should not be repeatedly stolen
Actual behavior
Focus is repeatedly stolen.
The likely culprit is: https://github.com/microsoft/vscode/issues/125800#issuecomment-859768879
Apparently, I'm supposed to play whack-a-mole and ask you to detect when I, the user, have recently clicked the terminal after you've stolen my focus and have you suppress future calls to steal my focus until focus leaves the terminal.
So, there you have it.
@jsoref You can set "csharp.showOmnisharpLogOnError" to false in your VS Code settings if you do not wish to see the OmniSharp log when errors are reported.
I'm glad there's a workaround.
I hope you understand that it isn't a particularly great thing.
@jsoref Most of the time this is a very useful behavior. When errors are reported it typically means that OmniSharp will be unable to provide language services, so getting that information to the user so they can resolve the reported issue is the right thing to do. This particular error is an unfortunate case because it will be reported for each project in the workspace until project loading is complete.
In this case, I'd much prefer one of the floating things than a tab steal. And I'm fairly certain I've gotten a bunch of those from this extension.
I'm not actually a C# dev. I installed the extension "because VSC told me to". And only much later tried to feed it a .net sdk (probably from a floating thing).
I understand how for normal users who are actively making their own changes, being shown output relevant to the work they're doing would be useful.
I claim that during initial load, the first or last notification is sufficient as a count (1) of focus steals. (Obviously, I'd prefer exactly 0 focus steals).
Not being able to provide language services is a thing, but it should probably be possible to just show a sad face in the status bar instead. If the user cares (I clearly don't), they can click to investigate.
For most of my C# projects when I open them in visual studio code, I am not building them and running them. For that, I open them in visual studio 2019. When I open projects in visual studio code, I just need a quick IDE and terminal to do some quick tasks, e.g. look at some code or git commands. Now I have to wait and be forced to watch a bunch of errors that is not necessary to do my work.
What is the goal for Visual Studio Code when it comes to C#? Is the goal for Visual Studio Code to replicate Visual Studio 2019 for C#? That would be redundant and defeat the purpose of a lightweight IDE.
Most of the time this is a very useful behavior...
@JoeRobich I'm sorry I must disagree. Stealing focus like this is a major UX violation and it is really an inappropriate way to handle errors in this case. There is no error that this plugin can produce that will ever warrant changing the users focus and there is no possible way for you to solve this bug in a way that will gracefully switch the users focus. It is a bug to steal the focus unless a direct user action has directed you to do so.
In the case where an error like this issue is encountered, you can use one of the non-focus stealing UI mechanisms to notify the user, such as popping up the toast alert message or perhaps an inline error in the code file or perhaps the color of the alert bar on the bottom or maybe a adding an error notification in a problem panel... There are numerous ways to notify the user when an unrecoverable error has been encountered without altering the users focus. This plugin, like every other plugin, must not alter the users focus unless the user has specifically instructed you to do so with a direct action (click a button, keyboard shortcut, command pallete, whatever).
Wikipedia identifies this behavior as an error state https://en.wikipedia.org/wiki/Focus_stealing
A classic opinion piece: https://blog.codinghorror.com/please-dont-steal-my-focus/
Mozilla considers focus stealing a category of bug: https://bugzilla.mozilla.org/buglist.cgi?quicksearch=focus+stealing
More...
Focus stealing is an accessibility "misfeature" https://computeraccessibility.fandom.com/wiki/Focus_stealing
You're my computer - I'm not your human http://radio-weblogs.com/0103807/stories/2002/06/07/dontStealMyFocus.html
This is such a classic issue, especially for Microsoft specifically, and I just can't believe in 2022 that there is any debate whatsoever that this absolutely a bug.
Other similar, open issues: https://github.com/OmniSharp/omnisharp-vscode/issues/5015 https://github.com/OmniSharp/omnisharp-vscode/issues/3708
Adding that the option csharp.showOmnisharpLogOnError is not respected for other channels on the output panel.
In my case, Razor Log repeatedly steals focus from terminal. Is frustrating that even hiding the Output panel-tab does not prevent this behavior.
This annoyed me so much that I modified the JavaScript file in my extensions folder. I replaced all occurrence of this.showChannel(, this.channel.show( and this.logger.outputChannel.show( with console.log(.
That way the extension still logs all the data it wants to log without constantly hiding the second most important window in my editor..