Venryx / vscode-vtools

A collection of small tools for Visual Studio Code.
MIT License
21 stars 10 forks source link

Doesn't work with auto-lose focus #10

Open AntonPuko opened 6 years ago

AntonPuko commented 6 years ago

Hi, thanks for the feature. But it seems the plugin works only when I manually click on editor area with my mouse. If I switch from a sidebar another way, like with ctrl+[number] or just selecting the file in a file tree with enter key, the sidebar still there.

Venryx commented 6 years ago

Yeah unfortunately, for now, I'm just detecting editor focus by means of the "editor selection changed" event. Which of course, doesn't trigger from just a focus change.

There might be a better way to detect editor focus, though. If you find an event in the vscode API for detecting it more universally, I'll look into adding it.

AntonPuko commented 6 years ago

what are the reasons behind those checks: singlePos and selection.kind != TextEditorSelectionChangeKind.Mouse ? seems if I remove those, it works just fine with all the cases.

Venryx commented 6 years ago

I think those checks were mainly to fix a problem when scrolled to the right -- changing the selected text range would trigger the sidebar-open-then-close, which would shift the scroll left and then right, causing the selection and scroll position to be messed up. This way, it only triggers when you first click onto a new position, which doesn't cause the same issue. (I forget the details, but I know this was at least one of the problems solved by some added checks; another check was added to prevent auto-hide when merely selecting text in the terminal panel.)

witek commented 3 years ago

another check was added to prevent auto-hide when merely selecting text in the terminal panel

Why would you not want to auto-hide when selecting text in the terminal panel? I would expect auto-hide on all actions, which don't happen in the sidebar itself.