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

Do not treat opening command palette / quick panel as focus lost #4065

Closed
princemaple opened this issue Apr 9, 2021 · 4 comments
Closed

Comments

@princemaple
Copy link

Description

There is this setting in Sublime Text

// Set to true to automatically save files when switching to a different file
// or application
"save_on_focus_lost": false,

The current behavior actually does do what the setting says, auto saves when focus is lost.
However, it doesn't really match what the comment says, or the comment is at least ambiguous.

As the comment suggests, auto save should only kick in when you switch to a different file or window.
The fact is it's also triggered when you open command palette / quick panel.

This leads to some inconvenience.
I have save_on_focus_lost: true + auto format on save from various package (prettier/LSP)
And LSP recently changed their code action from using inline popup (like a context menu) to quick panel.
This gives me some pain when I try to auto import stuff.

The problem is roughly like this: I trigger auto import (code action) from LSP, it pops up a quick panel, which causes loss of focus from the file, it auto saves and triggers auto format, and the auto import becomes invalid (either because of request id or code change), choosing from the panel ends with up being a noop. I have to repeat what I just did, or explicitly save beforehand, which loses the point of auto save

Steps to reproduce

  1. Set the setting to true
  2. change a file
  3. open command palette
  4. back to the file and the file is saved (has been auto saved because of focus lost)

Expected behavior

Do not treat opening command palette / quick panel as focus lost, or do not kickoff auto save.

Actual behavior

Opening command palette / quick panel causes focus loss and triggers auto save.

Environment

  • Build: 4102
  • Operating system and version: Win10
@princemaple
Copy link
Author

I will totally accept it if the devs simply decided to fix the comment. 😂

@princemaple
Copy link
Author

Relevant LSP PR sublimelsp/LSP#1611 (comment)

@UltraInstinct05
Copy link
Contributor

Possible duplicate of #980. The issue described seems to be same (or similar) to point 5 of the linked issue (which seems to be a general collection of all issues associated with save_on_focus_lost)

@princemaple
Copy link
Author

Indeed same problem, but it (no.5) got a workaround #3603. I hope this one gets a fix or a workaround as well.

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

3 participants