carlitux / deoplete-ternjs

deoplete.nvim source for javascript
MIT License
277 stars 24 forks source link

how to set for reactjs #78

Closed glepnir closed 5 years ago

glepnir commented 5 years ago

Hi carlitux,When I was writing react, I couldn't get some react method completion.like this, 11 in vscode is well。 2

this is my .tern-project setting

{
  "libs": [
    "browser",
    "ecmascript",
    "jquery",
    "react",
    "underscore"
  ],
  "plugins": {
    "node": {},
    "esmodules": {},
    "jsx":{},
  }
}

and this is my min init.vim

let g:deoplete#sources#ternjs#filetypes = [
    \ 'jsx',
    \ 'javascript.jsx',
    \ 'javascript'
    \ ]
let g:deoplete#sources#ternjs#timeout = 3
let g:deoplete#sources#ternjs#types = 1
let g:deoplete#sources#ternjs#docs = 1
glepnir commented 5 years ago

like this. 2 but in vim I can't get these 4

carlitux commented 5 years ago

Please take a look VS is using same version as you are using in vim. Also take care you have compatible tern with plugins you are using.

screenshot from 2018-11-17 15-19-03

glepnir commented 5 years ago

Please take a look VS is using same version as you are using in vim. Also take care you have compatible tern with plugins you are using.

screenshot from 2018-11-17 15-19-03

@carlitux wow its cool,I have been writing go with vim. But recently I need some react. I am still a newbie on js. Can you share your relevant configuration?like.tern-project and min init.vim

glepnir commented 5 years ago

I am a newcomer to vim. Looking forward to getting your better help。I don't know where the problem is. Google has not been solved for a long time, which makes me very depressed sceenshot

glepnir commented 5 years ago

I have the same problem with him, but I can't understand his solution. Sorry, I am a gopher and I just started learning react. https://medium.com/@jrwillette88/tern-why-it-breaks-and-how-to-fix-it-8d1677df05f9

carlitux commented 5 years ago

@MartiniGo sorry for late reply. Please read this to see what community find the correct versions for tern and tern-jsx https://github.com/carlitux/deoplete-ternjs/issues/66.

About blinking if I am not wrong that is because you have the +preview option. You could search/ask here https://github.com/Shougo/deoplete.nvim.

And about post, that is how tern start. If engine see one module start collecting metadata so at first time you will have a delay you can setup to .tern-project http://ternjs.net/

I hope this helps.

glepnir commented 5 years ago

It doesn't matter, there is a time difference between us, because I am in China, I found the problem is that I created a .tern-project in my working directory very long ago, and it is a wrong json, I deleted it.It started working, There is also a completion list that doesn't have much in your picture. 1

glepnir commented 5 years ago

Only some basic support? The render function does not prompt, is this normal? 33

ihechiwilliams commented 3 years ago

@glepnir please can you share your config file