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

No candidates appear #46

Closed
uzimith opened this issue Mar 11, 2017 · 6 comments
Closed

No candidates appear #46

uzimith opened this issue Mar 11, 2017 · 6 comments
Assignees

Comments

@uzimith
Copy link

uzimith commented Mar 11, 2017

Problems summary

I can't see any candidates from this source.

I have used nvim-typescript. However, when I enter typescript buffer, I got a little time freeze everytime. I guessed that was TSServer staring time, so I tried reinstall, and I got this situation.

Expected

I want completion like README.md screenshot.

Environment Information

  • terminal: iTerm 2 Build 3.0.14 / tmux 2.3
  • vim/nvim version: nvim 0.1.7
  • OS: MaxOS Sierra 10.12.3

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

if &compatible
  set nocompatible
endif

let s:dein_dir = expand('~/.cache/dein')
let s:dein_repo_dir = s:dein_dir . '/repos/github.com/Shougo/dein.vim'

if &runtimepath !~# '/dein.vim'
  if !isdirectory(s:dein_repo_dir)
    execute '!git clone https://github.com/Shougo/dein.vim' s:dein_repo_dir
  endif
  execute 'set runtimepath^=' . fnamemodify(s:dein_repo_dir, ':p')
endif

if dein#load_state(s:dein_dir)
  call dein#begin(s:dein_dir)

  call dein#add('Shougo/deoplete.nvim')
  call dein#add('mhartington/nvim-typescript')
  call dein#add('HerringtonDarkholme/yats.vim')

  call dein#end()
  call dein#save_state()
endif

if dein#check_install()
  call dein#install()
  "call :UpdateRemotePlugins
endif
let g:deoplete#enable_at_startup = 1
let g:deoplete#enable_at_startup = 1
let g:deoplete#enable_debug = 1
let g:deoplete#enable_profile = 1
call deoplete#enable_logging('DEBUG', 'deoplete.log')

The reproduce ways from neovim starting

  1. start nvim
  2. :UpdateRemotePlugins
  3. start typing
  4. I can't see any candidates from this source.

Example project repo?

Sorry, this is not a minimal project.

https://github.com/uzimith/twitch-comment/tree/nvim-typescript

Screen shot (if possible)

When I didn't call :TSStart

yvedohtgki

screen shot 2017-03-11 at 17 23 33

When I call :TSStart

a

Sometimes I can see some candidates from other sources.

5p9svra1rn

@mhartington
Copy link
Owner

What is happening

Hmm first glance, it appears to be an issue where the pwd and the tsconfig are not in the same directory.

From the clone of the project and your gifs, I'm seeing:

  1. your pwd when you start nvim is src/
  2. your tsconfig.json is actually in your ./ directory

Why this is happening

Right now I do some checks for either a tsconfig.json or a jsconfig.json (for javascript projects).
If those files do not exist, the server cannot be started since it will not know how to read your project.

Possible fix

Right now I'm only searching for that config file if it exist in the current directory or any child directory.
A quick fix is to either

  • cd to the root directory and start vim from there

  • move the tsconfig.json to the src directory.

issue-46

Here's an example of moving the tsconfig.json to the src directory.

Or you could even create a symlink as well.

@uzimith
Copy link
Author

uzimith commented Mar 12, 2017

I created symlinks.

ln -s ../tsconfig.json ./

And now works well! Thank you!

I don't understand .tsconfig searching behavior because TSServer works even in children foler now, but could you include .git folder for .tsconfig searching path?

I wanted to put .tsconfig in root. I guess we can get gitroot path (like git rev-parse --show-toplevel), so it'll works well.

@mhartington
Copy link
Owner

So the root search will use this line here

https://github.com/mhartington/nvim-typescript/blob/master/rplugin/python3/nvim-typescript/dir.py#L9

So as soon as you start nvim, it will treat that directory as the root. I guess we could also do an if statement

if('git rev-parse --show-toplevel'):
  # set current project root to that
else: 
  # set project root to cwd

@uzimith
Copy link
Author

uzimith commented Mar 12, 2017

I read around here. What you said is very cool!

@mhartington
Copy link
Owner

Sorry for the silence on my end. Can you pull the latest and give it a test?

@mhartington
Copy link
Owner

Closing as there has been no reply. If this issue still happens, please feel free to open a NEW issue.

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

No branches or pull requests

2 participants