Skip to content
This repository has been archived by the owner on Oct 24, 2021. It is now read-only.

TSImport error #88

Closed
fox-eye opened this issue Oct 31, 2017 · 4 comments
Closed

TSImport error #88

fox-eye opened this issue Oct 31, 2017 · 4 comments

Comments

@fox-eye
Copy link

fox-eye commented Oct 31, 2017

Warning: I will close the issue without the minimal vimrc and the reproduce ways.

Problems summary

TSImport is not working.
I place cursor under a symbol I want to auto import, type :TSImport

This displays an error and nothing is imported.

error caught in async handler '/Users/fox/.vim/plugged/nvim-typescript/rplugin/python3/nvim-typescript:command:TSImport []' Traceback (most recent call last): File "/Users/fox/.vim/plugged/nvim-typescript/rplugin/python3/nvim-typescript/__init__.py", line 348, in tsimport currentlyImportedItems, lastImportLine = utils.getCurrentImports(self._client, self.relative_file()) File "/Users/fox/.vim/plugged/nvim-typescript/rplugin/python3/nvim-typescript/utils.py", line 86, in getCurrentImports imports = [x for x in client.getDocumentSymbols(inspectedFile)["childItems"] TypeError: list indices must be integers, not str

Expected

I should see an import declaration.

Environment Information

  • terminal: ITerm / zsh
  • vim/nvim version: v0.2.1-dev

Mac OS X 10.13

Provide a minimal vim rc with less than 50 lines (Required!)

" should be always first, use Vim settings instead of VI
set nocompatible

filetype plugin indent on
syntax on

let $NVIM_TUI_ENABLE_TRUE_COLOR=1 " This line enables the true color support.

set number
set backspace=indent,eol,start "Allow backspace in insert mode
set history=200 "command history length
set ruler
set laststatus=2
set visualbell "no sounds
set autoread  "reload files changed outside of vim

" Vim plug - plugins - :PlugInstall to install 
call plug#begin('~/.vim/plugged')
Plug 'scrooloose/nerdtree'
Plug 'kien/ctrlp.vim'
Plug 'mattn/emmet-vim'
Plug 'vim-airline/vim-airline'
Plug 'tpope/vim-commentary'
Plug 'tpope/vim-fugitive'
Plug 'airblade/vim-gitgutter'
Plug 'tpope/vim-surround'
Plug 'rakr/vim-one'
Plug 'jlanzarotta/bufexplorer'
Plug 'mhartington/nvim-typescript'
Plug 'brooth/far.vim'
Plug 'HerringtonDarkholme/yats.vim'

if has('nvim')
  Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
else
  Plug 'Shougo/deoplete.nvim'
  Plug 'roxma/nvim-yarp'
  Plug 'roxma/vim-hug-neovim-rpc'
endif

call plug#end()

" Deoplete
let g:deoplete#enable_at_startup = 1

" Python
let g:python3_host_prog = '/Users/fox/.pyenv/versions/neovim3/bin/python'

The reproduce ways from neovim starting

  1. Place cursor on a symbol (like a angular 2 service type declaration in a constructor)
  2. Type :TSImport
  3. See error message as described above
@mhartington
Copy link
Owner

Would you be able to provide a minimal project example? I just tried to reproduce this in a ionic/angular project and it seems to be working on my end.

@fox-eye
Copy link
Author

fox-eye commented Nov 2, 2017

Hello,

Thanks for your answer. Maybe something wrong in the project example I tried at first ?

https://github.com/AngularShowcase/angular2-sample-app
There I see the error described.

Then I tried with this one:
https://github.com/angular/angular2-seed
There, it works perfectly.

@symbyte
Copy link
Collaborator

symbyte commented Nov 22, 2017

Maybe this has to do with the Typescript version? I observed an error message very similar to this one when moving from 2.4.2 up to 2.6.1 in my project. Moving back to 2.4.2, the error was gone again.

This would make sense because the Typescript team may have changed the TSServer interface for imports to support microsoft/TypeScript#19069.

@mhartington
Copy link
Owner

Im unable to replicate this even when switching between 2.4 and 2.6 of typescript. Going to close this. Please update your plugin install to get the latest version.

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

No branches or pull requests

3 participants