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

New repl output tab hijacks focus #717

Closed
svdo opened this issue Aug 1, 2020 · 20 comments
Closed

New repl output tab hijacks focus #717

svdo opened this issue Aug 1, 2020 · 20 comments

Comments

@svdo
Copy link
Contributor

svdo commented Aug 1, 2020

Hi! Just to make sure that I say it often enough: Thanks for Calva and for the great work you're doing!

The new repl output window has a (to me annoying) feature that it is automatically focussed now and then, mainly when I save my source file while it has a compilation error. This hides my editor window, which is obviously not what I want. Suggested fix would be to not auto-focus the repl output window.

Thanks again!

@PEZ
Copy link
Collaborator

PEZ commented Aug 1, 2020

Checking: Do you have the output window in the same editor group as the file you save?

@svdo
Copy link
Contributor Author

svdo commented Aug 1, 2020

If I understand correctly, then yes. See screenshot. This is how I always work with any ide/language if at all possible: test on the left, code on the right.

Screenshot 2020-08-01 at 17 24 56

@PEZ
Copy link
Collaborator

PEZ commented Aug 1, 2020

Thanks. Yes, that's what I meant. We added the reveal of the output window to the loadFile op, because this otherwise does not show anywhere. Obviously we didn't think about the test-on-save settings. Let's see if we can fix this in a nice way. Worst case, we'll add a setting for it.

@mtnygard
Copy link

mtnygard commented Aug 1, 2020

I hope this is a quick thing to solve, because the new tab is stealing focus from me every few seconds.

Edited to add: this seems to happen whenever clj-kondo updates problems in my current tab.

@bpringe
Copy link
Member

bpringe commented Aug 1, 2020

@PEZ Maybe we could use vscode.window.showErrorMessage to make a little popup notifying the user of an error if the output window is not visible, with a link in that popup to open the output window. I'm not sure if these notifications must be closed by the user or if we can make them close/fade after some time like a toast.

If the user must close them, I guess that's a little annoying, but they have to be notified of an error somehow.

@svdo
Copy link
Contributor Author

svdo commented Aug 1, 2020

Would it be possible to just have an error indication in the editor itself like normal compilation / linting errors the standard vscode way? Eg squigly lines etc?

@svdo
Copy link
Contributor Author

svdo commented Aug 1, 2020

Like this when I'm doing Haskell:

Screenshot 2020-08-01 at 22 39 54

@svdo
Copy link
Contributor Author

svdo commented Aug 1, 2020

@bpringe Personally I would categorise this as a "bug" rather than an "enhancement", because it makes Calva very hard to use, but I'll leave it up to you :)

@PEZ
Copy link
Collaborator

PEZ commented Aug 1, 2020

I'll revert the change for now. We need to figure out a better way to do it. Stay tuned.

@PEZ PEZ closed this as completed in fe360ad Aug 1, 2020
@PEZ
Copy link
Collaborator

PEZ commented Aug 1, 2020

There, please update to v2.0.114. Please continue to report when you find quirks with this new output/repl thing. (Or anything, of course.)

About squiggles. For errors when loading a file, it is not clear to me where those should be put. We could of course add it to the problems tab, but that still risks being looked over, since many people live with lots of warnings there.

Popping up an info/error dialog also seems a bit intrusive to me.

@PEZ
Copy link
Collaborator

PEZ commented Aug 1, 2020

@mtnygard:

Edited to add: this seems to happen whenever clj-kondo updates problems in my current tab.

This is hopefully just a ”seems”, but if it continues to seem like that, please let us know, because then something is really messed up.

@bpringe
Copy link
Member

bpringe commented Aug 1, 2020

@svdo Fair enough. I see your point. Since the functionality was intended (at least focusing the output window on error of loading file), and removing this intended functionality would make Calva easier to use in your case, I saw it as an enhancement. 😄

All good though, we will figure something better out. Thanks for notifying us and your feedback here!

@svdo
Copy link
Contributor Author

svdo commented Aug 2, 2020

About squiggles. For errors when loading a file, it is not clear to me where those should be put. We could of course add it to the problems tab, but that still risks being looked over, since many people live with lots of warnings there.

Given the way I use Calva and VSCode, the only thing that I need is some sort of red/green indicator. So that I know whether or not my source code has compiled. Are my tests not-failing because all is good, or because they didn't run due to a compilation error. An auto-disappearing balloon on compilation error in the bottom-right window would do it. Similar to the ones that are displayed when there is a new version available IIRC (AFK atm). Maybe even a small red/green icon in the bottom status bar of the window, but I would have to see it to know whether that is too subtle or just right.

Popping up an info/error dialog also seems a bit intrusive to me.

A dialog that requires interaction is definitely too intrusive. A balloon like I meant above might be fine.

@PEZ
Copy link
Collaborator

PEZ commented Aug 2, 2020

Those balloons stays for a very long time. Grabs my attention and my patience isn't such that it allows me to ignore it until it disappears by itself. 😄 But, maybe it is worth that to get to know that my file has compilation errors.

@svdo
Copy link
Contributor Author

svdo commented Aug 2, 2020

Hmm yes indeed. This is from Clojure-linter:

Screenshot 2020-08-02 at 13 36 13

It doesn't bother me (well, a bit maybe sometimes...), but if there are too many stacked on top of each other then it will definitely be annoying.

Some kind of icon in the status bar might be a quick thing to do and would probably go a long way.

Screenshot 2020-08-02 at 13 39 27

@svdo
Copy link
Contributor Author

svdo commented Aug 2, 2020

But I think this would be the best solution:

I might see in the REPL output window something like this:

; Syntax error compiling at (perfect_numbers.clj:3:1).
; Unable to resolve symbol: bla in this context
; Evaluation of file perfect_numbers.clj failed: class clojure.lang.Compiler$CompilerException

It sounds like maybe the best solution to me to just put a red squiggly for that under the entire line (3 in this case) with error details. That would totally match my expectations, it's not intrusive, nothing else would be needed... Does that seem like an option?

@PEZ
Copy link
Collaborator

PEZ commented Aug 2, 2020

Yes, I'm not sure what case I had in mind anymore, but it certainly makes sense, that if we have a source file location like that, we can mark it. It introduces some state, that we need to clear at some point, but that is not unheard of in the Calva codebase.

That particular error should already be flagged by clj-kondo. Not sure we should let that bother us, just thinking out loud here.

@bpringe
Copy link
Member

bpringe commented Aug 2, 2020

I was thinking as well that a status bar indicator might be good (I think in addition to the in-file indication that @svdo mentions, if it makes sense along with clj-kondo).

I was wondering, with the status bar indicator, if there would be an issue with "dirty"/in-between states, such as I eval the file and it's successful (no error), then I change something and maybe even save it (if eval-on-save not enabled, the saved state is not the current state in the repl, essentially). So say I save an error into the file but don't eval it, the status bar still shows successful eval, but this is indication of the last eval, and will not show failure until I eval the new version of the file.

However, I think this workflow still makes sense. The status bar indicator is just an indication of last file eval success.

The question then is... when I switch to a new active editor/file, does the indicator have knowledge of this file's eval status and switch to show that? I'm not sure exactly how this would work, but my first inclination is to make that indicator only respond to and represent the last file load, not necessarily the status of the active file load.

Sorry this is a bit wordy 😄

@svdo
Copy link
Contributor Author

svdo commented Aug 3, 2020

I just took a shower and now I changed my mind :) I don't think the status bar icon should be implemented. Because: why? If you can show it in the editor like it is supposed to be (squiggly red underline, that's the VSCode way of doing compilation errors), then it should, shouldn't it? And given that, the status bar icon doesn't really add any more information, to a status bar that is already crowded and (for me) reaching the point where not everything fits anymore... just my 2 cents :)

@bpringe
Copy link
Member

bpringe commented Aug 3, 2020

I agree with you @svdo. We probably could just indicate errors in the editor for load errors. Is there always a location in the file for a given error? I think so. Something to work toward / check out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants