tomrijndorp/vscode-finditfaster

Add a setting to open the terminal inside of the active editor panel

Opened this issue · 1 comments

Hello,

When using "find-it-faster.general.restoreFocusTerminal": true, if the user add a terminal open before invoking vscode-finditfaster, then the console panel will be open even if it was closed before.

This is not something we can control, because we can't know the terminal panel state (lack of VSCode API).

CleanShot.2024-02-18.at.21.35.23.mp4

A workaround to this problem, is to drag and drop the "Find It Faster terminal" in the editor section. Like that the terminal panel is not touched by the extension and will stay in its current state:

  • "Active terminal" is the same as before invocation
  • And visibility if also the same
CleanShot.2024-02-18.at.21.38.03.mp4

Would you be open to adding a new setting allowing the user to configure if he wants the terminal to open inside of the Terminal panel or inside of the editor?

The changes required are (hardcoded as I was just exploring the feasibility):

function createTerminal() {
    term = vscode.window.createTerminal({
        name: 'F️indItFaster',
        // hideFromUser: true,
		location: vscode.TerminalLocation.Editor,
        env: {
            /* eslint-disable @typescript-eslint/naming-convention */
		// ...

Note that I needed to comment hideFromUser: true otherwise, the terminal always appear in the terminal panel. I believe this is a bug / limitation of VSCode. As in theory, nothing prevent them to open the terminal and re-focus the previous active editor to make it "hidden" from the user.

Would you be open to adding such feature?

For reference, I wanted this feature because I wanted to benefit from a combination of restoreFocusTerminal and showMaximizedTerminal because I often have terminals open in VSCode but always wanted to have the search happen in a bigger window.

After playing with VSCode commands it seems like we can restore the original size of the terminal panel by using View: Move panel to Bottom.

Perhaps executing this command when showMaximizedTerminal is set could be an easier implementation. I am saying that because if the terminal is inside of the editors section, if the user press Esc then ATM the moment the terminal stays visible and focuses instead of returning to the previous active editors. And it seems like there would be more edges cases like that to cover and which could make the implementation more complex.

CleanShot.2024-02-19.at.14.35.26.mp4

Edit: It seems like it only works if the panel doesn't have focus. I will open an issue on VSCode to see if this is normal. microsoft/vscode#205584