coc-extensions / coc-powershell

PowerShellEditorService integration for coc.vim

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Console issues

mikeTWC1984 opened this issue · comments

This configuration doesn't seem to work:
"powershell.integratedConsole.focusConsoleOnExecute":true

If I close PSIC window and execute evaluateSelection or Execute commands PSIC window will not come back.

Other thing. I was browsing extensions.js file, I see that consoleTerminal has show and hide methods. Is it possible to map those as coc commands? (assuming these methods showing/hiding that terminal window indeed). This would let us to implement proper toggling feature (I opened a ticket with cocnvim but it probably will take a while/forever)

If I close PSIC window

How do you close the PSIC window? With :q? If so, do you still get intellisense in the editor buffer?

I opened a ticket with cocnvim but it probably will take a while/forever

Do you have a link to the issue? Maybe I can help - this really should be a thing in coc.nvim.

Yeah, I close it with q. But I do it just to get more space for my script, so if I run script or selection I definitely need get that console back. I realized that showTerminalIfVisible function is just used to move cursor to the PSIC buffer (when running F5/F8). I think we actually should do the opposite (same way as VSCode) - show it if it's hidden, that would make this function much more meaningful (it still can manage cursor location).

   public async showTerminalIfVisible() {
        if (this.consoleTerminal) {
            const winid: number = await vscode.workspace.nvim.eval(`bufwinid(${this.consoleTerminal.bufnr})`) as number;

            // If winid is -1, it means the window is not visible/is hidden.
            if (winid == -1) {this.consoleTerminal.show()}
             this.consoleTerminal.show(!this.config.integratedConsole.focusConsoleOnExecute);
            // mike1984 -  always show if hidden and do the cursor trick based on settings 
        }
    } 

Also, if we add extra else statement to that function it would actually do the toggling

     if (winid == -1) {this.consoleTerminal.show()} else {this.consoleTerminal.hide()}

I guess we can add it in this form until (and if) it's implemented on cocnvim's end

Also, I'm still looking forward to use dot sourcing (vs &) for execute command, so it works the same way as ISE. I guess we can create extra configuration to keep both options

@mikeTWC1984 well unfortunately coc.nvim has asked us to implement the toggle ourselves. Since you seem to have an understanding of what needs to be done, do you wanna submit a PR?

Also, I'm still looking forward to use dot sourcing (vs &) for execute command, so it works the same way as ISE. I guess we can create extra configuration to keep both options

It really dot sources it? That seems like it could cause some problems with scoping that could confuse the user? I'm fine adding it in with a configuration but I am inclined to say that & should be the default since it's safer. What do you think about that?

@TylerLeonhardt OK, I submitted PR, although it didn't pass autocheck (it wants some syntax improvements), I'll keep it as is for now.

This setting was added in #94. Closing this.