Skip to content

Add an option to keep focus on the model buffer when check with tlc command is invoked #381

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

FedericoPonzi
Copy link
Collaborator

Fixes #275.
I've added it as an option (as it would be a "breaking" change) and enabled it by default, but I would be pretty much in favor of get rid of the option and just keep it enabled, but happy to hear other opinions. The option is the most flexible solution.

@FedericoPonzi FedericoPonzi force-pushed the issue-275 branch 3 times, most recently from 4050eec to 992218b Compare May 31, 2025 15:30
@FedericoPonzi FedericoPonzi requested a review from lemmy May 31, 2025 15:31
@lemmy
Copy link
Member

lemmy commented May 31, 2025

Issue #275 uses the term "buffer," which I'm unable to interpret in this context. Does it refer to the focus shifting in the direction indicated by the arrow below? If so, the default behavior of the property should be to prevent focus from shifting. This is because the model checker windows don't support keyboard interaction, and the mouse is required to perform any meaningful actions within the view anyway.

Screenshot 2025-05-31 at 3 09 17 PM

package.json Outdated
"tlaplus.tlc.modelChecker.preserveEditorFocus": {
"type": "boolean",
"scope": "window",
"default": false,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is suggest to flip the default.

CheckResultViewPanel.currentPanel.panel.reveal();
const preserveFocus = vscode.workspace.getConfiguration()
.get<boolean>('tlaplus.tlc.modelChecker.preserveEditorFocus');
CheckResultViewPanel.currentPanel.panel.reveal(undefined, preserveFocus);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if the CheckResultView already has focus and the user clicks "Check again"?
Does it shift focus to the editor? In this case, the CheckResultView should retain focus.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the input to reveal is also called preserveFocus:

   * @param preserveFocus When `true`, the webview will not take focus.

Assuming CheckResultViewPanel is in focus and user clicks Check Again:

  • if preserveFocus is true, then focus won't change and CheckResultViewPanel stays focused.
  • if preserveFocus is false, the focus will shit to the new panel and CheckResultViewPanel will still stay focused
    does it answer your question?

Copy link
Member

@lemmy lemmy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but please consider my feedback.

…ommand is invoked

Signed-off-by: Federico Ponzi <me@fponzi.me>
Signed-off-by: Federico Ponzi <me@fponzi.me>
@FedericoPonzi
Copy link
Collaborator Author

Issue #275 uses the term "buffer," which I'm unable to interpret in this context. Does it refer to the focus shifting in the direction indicated by the arrow below? If so, the default behavior of the property should be to prevent focus from shifting. This is because the model checker windows don't support keyboard interaction, and the mouse is required to perform any meaningful actions within the view anyway.
Screenshot 2025-05-31 at 3 09 17 PM

Yes, that's my interpretation as well, I understood "buffer" in the Emacs sense. The idea of this change is that if your focus remains on the editor, you'll still be able to type after invoking the Check Model with TLC command. I've flip the default to true now.

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

Successfully merging this pull request may close these issues.

"Check with TLC": keep focus on model's buffer
2 participants