Skip to content
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

#1841 not good enough #7355

Closed
amoldeshpande opened this issue Aug 20, 2020 · 5 comments
Closed

#1841 not good enough #7355

amoldeshpande opened this issue Aug 20, 2020 · 5 comments
Labels
Needs-Tag-Fix Doesn't match tag requirements Resolution-External For issues that are outside this codebase

Comments

@amoldeshpande
Copy link

Environment

Windows build number: Microsoft Windows [Version 10.0.19041.450]
Windows Terminal version (if applicable): 1.1.2233.0

Any other software?

Steps to reproduce

I have some sort of phantom association with .json files and a version of Visual Studio (2015) that I no longer actually have. This is a long-standing situation due to some incompetence on my part, but not really relevant.

Anyway, this leads to a situation where I tried to open settings after installing Terminal and it kept beeping with no error message.

According to #1841 it should fire up notepad if ShellExecute() fails, but it does not show me notepad either.

Expected behavior

At least pop-up a message box saying "Couldn't open settings.json, check that you have an editor associated".

Regardless of how I got into this sorry state, lack of user feedback is inexcusable.

Actual behavior

DING ! DING!

@ghost ghost added Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Needs-Tag-Fix Doesn't match tag requirements labels Aug 20, 2020
@DHowett
Copy link
Member

DHowett commented Aug 20, 2020

I legitimately wish we could help you get out of this state from the Terminal side, but here's how it plays out.

  1. Terminal says "hey, open this JSON file"
  2. ShellExecute says "gotcha"
  3. (something) launches and emits a ding

We can only switch to notepad if the API in step 2 tells us it failed. Anything that succeeds, or looks like success, must contractually be taken to mean that it succeeded. There's a couple different avenues we could take to determine whether something actually launched in response to our ShellExecute, but they fall apart on closer inspection.

  • Detect a new process in the entire process tree
    • prone to false positives
    • editors like code and perhaps notepad++ like to single-instance themselves, so there would be no durable new process
  • Detect a new window
    • prone to false positives, but less so than with processes because windows are spawned less often
    • editors like code and perhaps notepad++ like to single-instance themselves, so there would be no durable new window
    • slow editors might take a long time to come up.
  • ???

It's not a tractable problem. Terminal has to trust, to some extent, the OS APIs that it uses. If an application is successfully launching when we ask to open a JSON file, and then that application is failing silently (or loudly, as the case may be for you!) after telling the OS that it was a great and complete success . . . that's the brakes.

Would you mind running assoc .json from the command prompt? It might not turn up anything useful, but perhaps we can get to the actual root cause here.

@DHowett DHowett added the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Aug 20, 2020
@DHowett
Copy link
Member

DHowett commented Aug 20, 2020

If there were any way for us to reliably detect that our otherwise apparently successful request to open the JSON file failed ... we would be doing it. 😄

@amoldeshpande
Copy link
Author

Ahh, I see. I was able to reproduce the annoying behavior by just trying to open the settings file with "Visual Studio 2015" which is the bad installer state that I mentioned I'm in.

assoc output : .json=VisualStudio.json.14.0

when I set it back from gvim, but I already know the reason I guess.

So, I guess there is no Terminal bug here :(

As a side note, is there any interest in a GUI for settings ? I absolutely hate GUI apps having json settings (it's kinda excusable for editors like VSCode and Sublime, but not really) .

I would be happy to add one as a side project. Should be easy enough in XAML/MVVM to bind a nice view to the settings file ?

@ghost ghost added Needs-Attention The core contributors need to come back around and look at this ASAP. and removed Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something labels Aug 20, 2020
@DHowett
Copy link
Member

DHowett commented Aug 20, 2020

Oh, absolutely. Work is ongoing in #6720 to spec the UI, tracked in #1564. We've got datamodel changes going in #7141 that'll make life easier in the future when we do want to do XAML data binding. That's all scheduled for "by 2.0" 😄

@DHowett
Copy link
Member

DHowett commented Aug 20, 2020

Gonna mark this one resolved/external... but thanks for all the info!

@DHowett DHowett closed this as completed Aug 20, 2020
@DHowett DHowett added Resolution-External For issues that are outside this codebase and removed Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Needs-Attention The core contributors need to come back around and look at this ASAP. labels Aug 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs-Tag-Fix Doesn't match tag requirements Resolution-External For issues that are outside this codebase
Projects
None yet
Development

No branches or pull requests

2 participants