twinnydotdev / twinny

The most no-nonsense, locally or API-hosted AI code completion plugin for Visual Studio Code - like GitHub Copilot but completely free and 100% private.
https://twinny.dev
MIT License
2.3k stars 126 forks source link

Sidebar shortcut/binding doesn t focus/unfocus properly #259

Open crimsonduelist opened 4 weeks ago

crimsonduelist commented 4 weeks ago

Describe the bug

I assume that by default the twinny focus sidebar shortcut should actually focus the chat box cuz that s what it actually does when it focuses properly. I can focus on the sidebar only if I go to explorer view (ctrl+shift+e default) or similar sidebar item and then hit shortcut bound to workbench.view.extension.twinny-sidebar-view. If I m on editor view it will not I tried with workbench.view.extension.twinny-sidebar-view twinny.sidebar.removeView twinny.sidebar.resetViewLocation workbench.view.extension.twinny-sidebar-view.resetViewContainerLocation thinking maybe on of those would be responsible for reseting the view to last focused item or going back to editor view. Like how pressing ctrl+shift+e (explorer view) goes to editor when u use it from within explorer view. I tried with the when clause from the other other similar bindings like viewContainer.workbench.view.XXX.enabled but doesnt seem to be smthing (XXX) for twinny currently

To Reproduce

  1. Set keybinding for workbench.view.extension.twinny-sidebar-view (view: show twinny)
  2. Open the sidebar and navigate to twinny s tab
  3. Change focus to another view i.e. some open file or a integrated terminal
  4. Hit the shortcut u set in step 1. ->

Expected behavior

Hitting the shortcut bound to workbench.view.extension.twinny-sidebar-view should just focus inside twinny s sidebar s chat box

Logging

Not sure which logs u d need, I just went in show log file...-> extension host cuz there doesnt seem to be a file like Code/logs/twinny.logs exthost.log

API Provider

Ollama

Desktop (please complete the following information):

Additional context

As I was making this I noticed that the focus is actually inside the twinny sidebar it just doesnt automatically go to the chat box in those cases i.e. unless u re already in another sidebar tab like explorer -> close the sidebar -> now view twinny sidebar it will focus in the chatbox correctly. To verify select some text from within the sidebar like some output of the model or in the providers tab select some text like label, type, hostname etc. If u focus to smthing else like editor view or integrated terminals or smthing it will become gray. Then hitting the shortcut again focus goes back in and it s blue (i.e. selected). Now if u rwere to close the sidebar go to another view and then click the shortcut it will correctly focus in the twinny chatbox no matter the twinny tab you were in (i.e. providers tab)