coc-extensions / coc-powershell

PowerShellEditorService integration for coc.vim

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error on active extension coc-powershell: TypeError: (intermediate value) is not iterable

mikeTWC1984 opened this issue · comments

This is a follow up on #34
I'm installing everything from scratch (on pwsh ubuntu container), then using this vimrc. After PlugInstall and CocInstall coc-powershell it start downloading PSES but soon after throwing this error:

[coc.nvim] Error on active extension coc-powershell: TypeError: (intermediate value) is not iterable

Here is CocInfo:

versions

~ |
~ | vim version: VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Jun 06 2019 17:31:41)
~ | node version: v10.16.0
~ | coc.nvim version: 0.0.72-36b226e965
~ | term: dumb
~ | platform: linux
~ |
~ | ## Messages
~ | Messages maintainer: Bram Moolenaar Bram@vim.org
~ | "test5.ps1" 0L, 0C
~ | [coc.nvim] Error on active extension coc-powershell: TypeError: (intermediate value) is not iterable
~ | ## Output channel: powershell
~ |
~ | starting.
~ | pwshPath = /usr/bin/pwsh
~ | bundledModulesPath = /root/.config/coc/extensions/node_modules/coc-powershell/PowerShellEditorServices

commented

This is interesting. Seems like polyglot needs to be included in both vim and nvim to get coc-powershell to work.

curl -s https://gist.githubusercontent.com/JayDoubleu/33ec55c27268fd707652e7f2bd7465f3/raw/40f0ab184f17c6ffe804be3eaba1e90eb1296221/Dockerfile|docker build -t coc-powershell -f - . && docker run -it coc-powershell /bin/bash
runuser -l vim -c 'vim test.ps1'

[coc.nvim] Error on active extension coc-powershell: TypeError: (intermediate value) is not iterable

runuser -l nvim -c 'nvim test.ps1'

[coc.nvim] Error on active extension coc-powershell: TypeError: this.consoleTerminal.processId.then is not a function

In NVIM Console starts however there is no auto complete.

Above errors might be related to running it in docker. I will re-run above steps in microVM to see if errors continue.

Edit: Seems like Plug 'neoclide/coc.nvim', {'tag': '*', 'do': { -> coc#util#install()}}" causes the

[coc.nvim] Error on active extension coc-powershell: TypeError: (intermediate value) is not iterable

However running it with "Plug 'neoclide/coc.nvim', {'branch': 'release'} makes terminal session pupup and displays the same error as nvim.

Running without polyglot:

curl -s https://gist.githubusercontent.com/JayDoubleu/c7c3bb5fe9b575e4b809b0ac363f8e91/raw/9f6a128441de67666aa3f1be18305dccc448fa98/Dockerfile|docker build -t coc-powershell -f - . && docker run -it coc-powershell /bin/bash
runuser -l vim -c 'vim test.ps1'

^^ vim Nothing happens

runuser -l nvim -c 'nvim test.ps1'

^^ neovim Nothing happens

commented

@mikeTWC1984

Replace your ~/.vimrc with below:

call plug#begin('~/.vim/plugged')
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'bling/vim-airline'
Plug 'sheerun/vim-polyglot'
call plug#end()

Run:

rm -rf ~/.vim/plugged/coc.nvim/
rm -rf ~/.config/coc/
vim +PlugInstall +qall
vim -c 'CocInstall -sync coc-powershell|q'
vim test.ps1

You should see "[coc.nvim] Update completed" message and few seconds after this you should see PowerShell Integrated console.

Unfortunately when I just tried this on fresh ubuntu18.04 VM with vim 8.0.1453 I got error:

[coc.nvim] Error on active extension coc-powershel...s.consoleTerminal.processId.then is not a function

Yeah, I'm getting same exact result after applying your configs. Do you think this is related to Ubuntu 18? I have it on a physical machine and as container. Which OS / config do you have working installation on?

commented

Its a bit odd to be honest. When I run from older commits this doesn't happen.
I had everything working two days ago. Now out of curiosity I reinstalled and getting the same error. I think we just need to give guys a little bit more time as this is early development.

I know I've gotten random errors if I close nvim before PSES has been downloaded. My goto when I get random errors is :CocUninstall coc-powershell then close and reopen nvim and :CocInstall coc-powershell then close it again, and open a ps1 file. Then leave it for a minute or two...

@JayDoubleu it looks like master for coc.nvim is currently broken for the terminal: neoclide/coc.nvim#949, and 0.0.72 appears to also be broken for other parts...

Thanks guys. Tried few different things, but still nothing. Tried on Ubuntu/Mint/Win10/Win2016 both vim/neovim. The best result was getting pwsh terminal when opening ps1 file, but it just froze the terminal. Will wait for newer releases and try again. Really hope to get it working on linux container

I think we’ve determined that this is an upstream issue, yeah? There was a release of coc.nvim yesterday. Maybe worth giving another go.

Note: I have gotten this running within Azure Cloud Shell which is just an ubuntu container so I know it’s possible

Also, we should probably do something about the polyglot issue - we use to set the filetype if it wasn’t already set, but ever since we moved to typescript, I don’t think we do that anymore.

commented

I can confirm it works for both vim and neovim with polyglot enabled.

curl -s https://gist.githubusercontent.com/JayDoubleu/33ec55c27268fd707652e7f2bd7465f3/raw/40f0ab184f17c6ffe804be3eaba1e90eb1296221/Dockerfile|docker build -t coc-powershell -f - . --no-cache && docker run -it coc-powershell /bin/bash

runuser -l vim -c 'vim test.ps1' < VIM works fine
runuser -l nvim -c 'nvim test.ps1' < NEOVIM works fine.

@TylerLeonhardt is there a quick way to enable disable shell from within VIM so it can be mapped? Have to exit vim twice now or use :qa

If you apply the setting:

In your CocConfig, you can add:

"powershell.integratedConsole.showOnStartup": false

but I’m not sure of a keybinding to show/hide the terminal. I think something like that should probably come from coc. It might already be possible.

@JayDoubleu in that Dockerfile have you considered starting from the Node or PowerShell images?

commented

@TylerLeonhardt I have originally been testing with powershell image, its just the same as ubuntu:18.04 anyway but then switched to just ubuntu as I had it working on my pc but not in container so decided to check if the powershell image isn't built in some funky way, then just didn't bother to switch it back to powershell.

Node images are debian based, no ppa for latest vim on it so getting the right nvim verison is just too much hassle.

I just tested on my end, it's working now. Thanks!

Awesome! Can we close this now?

@JayDoubleu makes sense! Would love to see a Dockerfile in this repo that has a full nvim/vim powershell dev experience if you’d like to contribute it! (my only suggestion would be to switch back to the PowerShell image 😄 )

Yes. We can close it.
I think it's a good idea to create some enhanced pwsh image that would also include your plugin, dotnet sdk (with psmodule template), omnisharp, mono , openssh. and come common pre-configured vim plugins. I think at this point it's really challenging to set good vim dev environment for vim newbes

Regarding that terminal, is it possible to execute current file in there, similar to what F5 would do in ISE/VSCode? Would be awesome to recreate F8 as well (execute selection).

commented

@TylerLeonhardt sure thing. Dropped a PR with powershell image.

@mikeTWC1984 you should be able to execute the current file with (something akin to) :CocCommand powershell.execute if you do :CocCommand <Tab> it should tab complete the available commands. IIRC there's evaluateLine, evaluateSelection, and execute. (evaluate selection currently does all lines in the selection, not just the selection.)

As for getting setup for developing, we are always looking for suggestions and PRs of the readme and other documents to help people get started. I'm currently working on bringing a CONTRIBUTING document to the project so it's easier to get setup (and hopefully others can avoid the potholes I stepped in to get it working).

@corbob Thanks. I just tested it in vim. evaluateLine works as expected. "execute" just prints results in a separate buffer and closes immediately (something similar to !pwsh %) . "evaluateSelection" throws error. Does it work any better on your end?

I've started getting this error when I open a Powershell script in gvim on Windows 10. I use vim-plug to load polyglot and coc:

...
Plug 'sheerun/vim-polyglot'
Plug 'neoclide/coc.nvim', {'branch': 'release'}
...

and have loaded the Powershell extension using :CocInstall coc-powershell.