## versions
vim version: NVIM v0.3.5
node version: v10.14.1
coc.nvim version: 0.0.72-471db1a4c4
term: iTerm.app
platform: darwin
## Messages[coc.nvim] Error on active extension coc-powershell: Timed out waiting for session file to appear.
## Output channel: powershell
starting.
pwshPath = /usr/local/bin/pwsh
bundledModulesPath = /Users/tyler/Code/PowerShell/coc-powershell/PowerShellEditorServices
We have a piece of code in coc-powershell that will create a Terminal and then if the user has chosen to hide this terminal at start up, we then call Terminal.hide():
this.consoleTerminal = await workspace.createTerminal({
name: this.title,
shellPath: this.pwshPath,
shellArgs: powerShellArgs
})
if (!this.config.integratedConsole.showOnStartup) {
this.consoleTerminal.hide()
}
When Terminal.hide() is called, the shell running in the terminal is killed.
Instead of the process getting killed, it should be running in the background or hidden.
Because of this behavior, I lose all editor features in the PowerShell extension because it runs the language server in that shell and coc connects via named pipes.
If applicable, add screenshots to help explain your problem.

Use code like:
let buf = nvim.createBuffer(terminal.bufnr)
await buf.setOption('bufhidden', 'hide')
after terminal created.
where does terminal come from? The Terminal object created from workspace.createTerminal(..) doesn’t have a property called bufnr.
It's not exported, need a fix, you can use (terminal as any).bufnr
Thanks!
It would be nice if Terminal.hide() did await buf.setOption('bufhidden', 'hide') under the hood.
btw, just moved to:
let buf = nvim.createBuffer(terminal.bufnr)
await buf.setOption('bufhidden', 'hide')
However, this only hides it until the buffer changes (for example, if something caused the terminal to write something to the output).
Anyway to hide it forever, basically?
this only hides it until the buffer changes
It should not unless you have called show method, maybe bug of neoivm.
Another issue is this module not working on vim for now.
maybe bug of neovim.
You might be right… https://github.com/neovim/neovim/issues/2368
Another issue is this module not working on vim for now.
coc.nvim isn’t working on vim?
Terminal module not work on vim8 for now.
I've made terminal work on vim8, the hide issue doesn't exists with neovim 0.4.0
@chemzqm once the terminal is hidden, is there any API to determine if it’s hidden or not?
we have a “Scroll to bottom” function that looks like this:
public async scrollToBottom() {
if (/* TERMINAL IS VISIBLE */) {
this.consoleTerminal.show(false)
await utils.sleep(100)
await vscode.workspace.nvim.command("wincmd w")
}
}
but haven’t figured out the best API to determine hidden state.
Worst case, we can keep track of the state since we create the terminal, but if there was API for already, we’d love to take advantage.
You should use bufwinid(terminal.bufnr) and use win_gotoid() with the result.
Coc.nvim does scroll to bottom on show https://github.com/neoclide/coc.nvim/blob/master/src/model/terminal.ts#L49, so you don't need that code.
FYI the fix is here: https://github.com/neoclide/coc.nvim/blob/master/autoload/coc/terminal.vim#L15
@chemzqm in theory, coc.nvim’s show which has a parameter for preserve focus, would “just work” and we wouldn’t need to use win_gotoid() at all, right?
I don’t think I quite understand how what you say here:
You should use bufwinid(terminal.bufnr) and use win_gotoid() with the result.
Allows me to test for whether the terminal is hidden or not
show method would focus terminal by default, so you don't need win_gotoid() and coc.nvim would always scroll the window to bottom after sendText, so you don't need to implement it.
Use bufloaded to detect if terminal buffer still available, and bufwinid to get a associated window id.
awesome thanks!