carlitux / deoplete-ternjs Goto Github PK
View Code? Open in Web Editor NEWdeoplete.nvim source for javascript
License: MIT License
deoplete.nvim source for javascript
License: MIT License
Hi there,
Thanks for your awesome work on this plugin.
Forgive me if I've missed this configuration option but completions using this plugin typically result in a buffer appearing at the top of the screen showing the function being completed and it's signature. This feature is not my cup of tea and I can't find a way to switch it off.
Is there a way of turning this buffer pop up off?
:)
Hi @carlitux
what do you think about adding some options to control what's shown in the popup menu?
Specifically I would like to:
menu
option from [tern]
to simply [js]
g:deoplete#tern#show_signature_in_pum
, g:deoplete#tern#menu_symbol
and g:deoplete#tern#hide_object_prototype
options to control these settings.If you like the idea I may try to implement it (although I don't really know python at all, I suppose I can find my way around for that) and make a pr
for now I have those hardcoded in a fork of your project but I would rather be synced to your master
10x
Deoplete can't complete javascript files after updated the whole plugins. (javacomplete2 and jedi work just fine)
I switch to vim with youcompleteme, it worked well, which means it had nothing to do with ternjs.
Then I added some print into plugin files:
deoplete-ternjs.vim
echom 'ternjs start'
...
let g:tern#filetypes = [
...
endif
echom 'end'
ternjs.py
class Source(Base):
def __init__(self, vim):
super(Source, self).__init__(vim)
print('ternjs init')
...
output
ternjs start
end
Looks like the python part never get chance to run
My vimrc
if has("nvim")
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
Plug 'zchee/deoplete-jedi', {'for': 'python'} " autocomplete for Python
" autocomplete for Javascript. Need add .tern-project to take effect
Plug 'carlitux/deoplete-ternjs', { 'for': ['javascript', 'javascript.jsx'] }
else
Plug 'Valloric/YouCompleteMe', { 'do': './install.py' }
Plug 'amerlyq/vim-focus-autocmd' " Add focus event support for vim
endif
Plug 'ternjs/tern_for_vim', { 'do': 'npm install', 'for': ['javascript', 'javascript.jsx'] }
if has("nvim")
let g:deoplete#enable_at_startup = 1
let g:deoplete#enable_ignore_case = 1
let g:deoplete#enable_smart_case = 1
"let g:deoplete#omni#functions = {}
"let g:deoplete#omni#functions.javascript = [
"\ 'tern#Complete',
"\ 'jspc#omni'
"\]
if exists('g:deoplete#enable_at_startup')
let g:deoplete#enable_at_startup = 1
call deoplete#custom#set('buffer', 'mark', 'ℬ')
call deoplete#custom#set('ternjs', 'mark', '')
call deoplete#custom#set('omni', 'mark', '⌾')
call deoplete#custom#set('file', 'mark', 'file')
call deoplete#custom#set('jedi', 'mark', '')
call deoplete#custom#set('javacomplete2', 'mark', '')
call deoplete#custom#set('typescript', 'mark', '')
call deoplete#custom#set('ultisnips', 'mark', '')
endif
endif
Is it possible to utilize a trigger command to open up autocompletion with Tern such as is described here: https://ternjs.net/doc/demo/index.html#simple
For instance the autocomplete trigger command is ctrl-space
.
I am not sure if that would be initiated here or in deoplete itself.
Thanks
*** Edit ***
I tried this out and it seems to do what I need:
https://vi.stackexchange.com/questions/9468/cant-get-deoplete-plugin-working-in-neovim
If you have anything to add that you think would help, please add, if not feel free to close.
Thanks!
Typing ''.toE
causes the error messages to show up.
After disabling the plugin, it is ok.
From README, it is not quite clear if the plugin depends on tern_for_vim, or it can work without it. Could you please clarify, if it is ok to have both?
Similar to how tern_for_vim does here, turned on by setting g:tern_show_signature_in_pum
, and disabled by default.
This option shows the function signature / TernType in the popup menu.
Here http://ternjs.net/doc/demo/#simple
If I complete at document.|
(|
is my cursor) I get many different completions.
However if I do the same with this plugin, I get none.
Hi,
I'm using deoplete-ternjs to edit vue files. The file is composed from 3 sections, (for HTML), <script> (for JS) and <style> (for CSS / SaSS / etc.)
I'm using vueim for easy editing, which identifies each section and opens a new buffer for it. For example, given the file: /Projects/vue/components/MyComponent.vue
, when I run :VueimTabEditScript
to edit the JS, will create a "virtual" file with the following descriptor: vueim://Projects/vue/components/MyComponent.js
and this confuses deoplete-tern which yields the following error:
[deoplete] Traceback (most recent call last):
[deoplete] File "/Users/tudor/vim/bundle/deoplete.nvim/rplugin/python3/deoplete/deoplete.py", line 98, in gather_results
[deoplete] ctx['candidates'] = source.gather_candidates(ctx)
[deoplete] File "/Users/tudor/.vim/bundle/deoplete-ternjs/rplugin/python3/deoplete/sources/ternjs.py", line 353, in gather_candidates
[deoplete] result = self.completation(pos) or []
[deoplete] File "/Users/tudor/.vim/bundle/deoplete-ternjs/rplugin/python3/deoplete/sources/ternjs.py", line 309, in completation
[deoplete] data = self.run_command(command, pos)
[deoplete] File "/Users/tudor/.vim/bundle/deoplete-ternjs/rplugin/python3/deoplete/sources/ternjs.py", line 182, in run_command
[deoplete] self.start_server()
[deoplete] File "/Users/tudor/.vim/bundle/deoplete-ternjs/rplugin/python3/deoplete/sources/ternjs.py", line 94, in start_server
[deoplete] portFile = os.path.join(self._project_directory, ".tern-port")
[deoplete] File "/usr/local/Cellar/python3/3.5.2_1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/posixpath.py", line 89, in join
[deoplete] genericpath._check_arg_types('join', a, *p)
[deoplete] File "/usr/local/Cellar/python3/3.5.2_1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/genericpath.py", line 143, in _check_arg_types
[deoplete] (funcname, s.__class__.__name__)) from None
[deoplete] TypeError: join() argument must be str or bytes, not 'NoneType'
[deoplete] Could not get completions from: ternjs. Use :messages for error details.
However if I run :set ft=javascript
on the .vue file, autocomplete something and it works once, then it will work even in the new buffer opened by :VueimTabEditScript
, which leads me to believe that the index is lazy-loaded on demand. Is there a way to programmatically force it to load the index, like calling :call <magic>
to load the index before doing the :VueimTabEditScript
, which will prompt the script to work on the new buffer?
Or maybe I can set the location from where the files should be loaded?
Thank you,
I have a big javascript project with a lot of directories and files. And every time when I open a file, the .tern-port file is created in the parent directory. So I always have multiple tern servers running, but want only one :)
My configs:
let g:deoplete#enable_at_startup = 1
let g:tern_show_signature_in_pum = 1
let g:tern#command = ["tern"]
let g:tern#arguments = ["--persistent"]
let g:tern_request_timeout = 1
I've been getting this error quite a bit lately
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/Cellar/python3/3.6.4_2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/threading.py", line 916, in _bootstrap_inner
self.run()
File "/usr/local/Cellar/python3/3.6.4_2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/threading.py", line 864, in run
self._target(*self._args, **self._kwargs)
File "/Users/matt/.vim/plugged/deoplete-ternjs/rplugin/python3/deoplete/sources/ternjs.py", line 317, in completation
data = self.run_command(command, pos)
File "/Users/matt/.vim/plugged/deoplete-ternjs/rplugin/python3/deoplete/sources/ternjs.py", line 258, in run_command
data = self.make_request(doc, silent)
File "/Users/matt/.vim/plugged/deoplete-ternjs/rplugin/python3/deoplete/sources/ternjs.py", line 229, in make_request
req = opener.open(self._url, payload)
File "/usr/local/Cellar/python3/3.6.4_2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 526, in open
response = self._open(req, data)
File "/usr/local/Cellar/python3/3.6.4_2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 544, in _open
'_open', req)
File "/usr/local/Cellar/python3/3.6.4_2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 504, in _call_chain
result = func(*args)
File "/usr/local/Cellar/python3/3.6.4_2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 1346, in http_open
return self.do_open(http.client.HTTPConnection, req)
File "/usr/local/Cellar/python3/3.6.4_2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 1320, in do_open
raise URLError(err)
urllib.error.URLError: <urlopen error [Errno 61] Connection refused
Hey what do the following lines do?
let g:tern_request_timeout = 1
let g:tern_show_signature_in_pum = '0'
Cheers.
With deoplete: extra leading '
import React from '|
# (why?) Have to press <Tab> to trigger deoplete#manual_complete()
# select from popup: 'react'
# result is
import React from ''react'
With <C-X><C-O>
: works
import React from '|
# <C-X><C-O>
# select from popup: 'react'
# result is
import React 'react'
Related: if using something that automatically adds quote pairs.
With deoplete: extra leading '
import React from '|'
# (why?) Have to press <Tab> to trigger deoplete#manual_complete()
# select from popup: 'react'
# result is
import React from ''react'
With <C-X><C-O>
: extra trailing '
import React from '|'
# <C-X><C-O>
# select from popup: 'react'
# result is
import React 'react''
Tern config:
{
"plugins": {
"node": {},
"node_resolve": {},
"modules": {},
"es_modules": {}
}
}
I switch node/npm versions in different projects and having to install globally means that I have to install it on every version that I use, which is kind of a pain. So if we can make this a local dependency for the plugin like tern_for_vim
this would be great.
That's fine, but it's a real head-scratcher for those of us who assumed there'd be a default. Please document that you need one (and an example .tern-project file would be nice, too)
Having deoplete-ternjs stops deoplete from working at all for me. Not sure why, manual invocations freeze neovim and the autocomplete doesn't work at all.
I have a weird issue, I have a project with a .tern-profile
file. When I open any .js
file from inside that project folder, tern completion doesn't work but if I open the same exact from a different directory everything is working fine!
This is the project .tern-project
{
"libs": [
"ecma5",
"ecma6",
"browser",
"jquery"
],
"loadEagerly": [],
"async": true,
"dontLoad":[
"node_modules",
"dist",
"tmp",
"vendor",
"public"
],
"exclude": [
"node_modules/**",
".git/**",
"*.min.js",
"*.prod.js",
"*.debug.js",
"tmp",
"vendor"
],
"plugins": {
"doc_comment": {
"fullDocs": true
},
"complete_strings": {},
"es_modules": {},
"modules": {},
"node": {},
"commonjs": {},
"node_resolve":{}
}
}
This is my global .tern-config
{
"libs": [
"ecma5",
"ecma6",
"browser"
],
"loadEagerly": [],
"async": true,
"plugins": {
"doc_comment": {
"fullDocs": true
},
"complete_strings": {},
"es_modules": {},
"modules": {},
"node": {},
"commonjs": {},
"node_resolve":{}
}
}
.tern-project
..tern-project
with ~/.tern-config
content.tern
path since the project uses a different node version that the system. But I saw #26. So I added the config & even :echo g:tern_path
returns the right path.Session.vim
created by https://github.com/tpope/vim-obsession & started with blank session.No idea how can I debug this any further & how to fix this problem.
As I don't want to the doc info popup window when I choose one completion, I don't know python well neither. I tried to edit rplugin/python3/deoplete/sources/ternjs.p#type_doc
and make it return just empty string. It doesn't popup the function doc information. However, it became very slow, even didn't show the completion.
Would you give me any suggestions? Thank you in advance.
Hi,
First of all: Thanks for the work you put into this plugin! :)
I have a fresh setup of nvim and cannot get any suggestions from ternjs to show up with deoplete.
$ which tern
/Users/support/.nvm/versions/node/v8.6.0/bin/tern
...which points to the installation in my global node_modules, with the version: "_id": "[email protected]"
init.vim
call plug#begin()
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
Plug 'carlitux/deoplete-ternjs', { 'do': 'npm install -g tern' }
call plug#end()
" Activate deoplete
let g:deoplete#enable_at_startup = 1
" Start autocompletion right away
let g:deoplete#auto_complete_start_length = 1
" init variables
let g:deoplete#sources = {}
let g:deoplete#sources.javascript = ['buffer', 'ternjs']
I also made a directory where I put a sample js-file "test.js" and the following .tern-project
:
{
"ecmaVersion": 6,
"libs": [
"ecmascript",
"browser"
],
"loadEagerly": [
]
}
...which - as far as I understood the docs - should give me access to browser-globals like window
or document
.
Unfortunately all I get in my "test.js" are completions from words that are already in the buffer.
Is there anything I'm missing here, is this an issue with my deoplete-config or an issue with deoplete/ternjs itself?
If you need any more information, let me know and I'll gladly provide.
Hi, I'm trying to produce functionality in Neovim which is present in VSCode. Any properties defined on a React component's propTypes property is listed first in autocomplete, with an accompanying description if it's documented.
Here's a screenshot of what that looks like in vscode
Now, I've read and re-read the instructions for deoplete, ternjs, and deoplete-ternjs, but I can't seem to get anything similar to that.
I seem to just get suggestions from the current buffer and general javascript variables and functions.
.tern-project
{
"libs": [
"browser",
"react"
],
"plugins": {
"node": {}
}
}
.nvimrc
set colorcolumn=50,72,100
highlight ColorColumn ctermbg=0
set expandtab
set tabstop=2
set shiftwidth=2
filetype plugin on
call plug#begin('~/.local/share/nvim/plugged')
Plug 'scrooloose/nerdcommenter'
Plug 'scrooloose/nerdtree'
Plug 'prettier/vim-prettier', {
\ 'do': 'yarn install',
\ 'for': ['javascript', 'typescript', 'css', 'less', 'scss', 'json', 'graphql'] }
Plug 'jparise/vim-graphql'
Plug 'sheerun/vim-polyglot'
" Plug 'https://github.com/bigfish/vim-js-context-coloring'
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
Plug 'carlitux/deoplete-ternjs'
Plug 'w0rp/ale'
Plug 'mhartington/nvim-typescript'
Plug 'trevordmiller/nova-vim'
Plug 'vim-airline/vim-airline'
Plug 'easymotion/vim-easymotion'
Plug 'ervandew/supertab'
call plug#end()
" Prettier
let g:prettier#config#autoformat = 1
" NERDTree
autocmd vimenter * NERDTree
" Use deoplete.
let g:deoplete#enable_at_startup = 1
let g:deoplete#enable_debug = 1
let g:deoplete#enable_profile = 1
call deoplete#enable_logging('DEBUG', '/usr/local/etc/deoplete.log')
" Ctrl-Space for completions
inoremap <silent><expr> <C-Space> deoplete#mappings#manual_complete()
" deoplete-tern
let g:deoplete#sources#ternjs#tern_bin = '/usr/local/lib/node_modules/tern/bin/tern'
let g:deoplete#sources#ternjs#timeout = 1
let g:deoplete#sources#ternjs#types = 1
let g:deoplete#sources#ternjs#depths = 1
let g:deoplete#sources#ternjs#filter = 0
let g:deoplete#sources#ternjs#case_insensitive = 1
let g:deoplete#sources#ternjs#guess = 1
let g:deoplete#sources#ternjs#sort = 1
let g:deoplete#sources#ternjs#omit_object_prototype = 0
let g:deoplete#sources#ternjs#filtetypes = [ 'jsx', 'js', 'vue' ]
" Ale
let g:ale_fixers = { 'javascript': ['eslint'] }
" Airline
let g:airline_powerline_fonts = 1
" Tab Shortcuts
nnoremap tk :tabfirst<CR>
nnoremap tl :tabnext<CR>
nnoremap th :tabprev<CR>
nnoremap tj :tablast<CR>
nnoremap tn :tabnew<CR>
nnoremap tc :CtrlSpaceTabLabel<CR>
nnoremap td :tabclose<CR>
" Color
colorscheme nova
Any help would be greatly appreciated!
Seeing some weirdness where the tern
server doesn't seem to start as I get no entries in the autocomplete. Sometimes I can fix it by manually running tern
in another window and then when I restart nvim it seems to work. Strangely if I then kill the tern
I started manually it continues to work fine even after restarting nvim.
Is there someway I can see if the tern server fails to start from deopletes side? Perhaps somewhere I can add a debug? Would be great to be able to set a debug option and then see any messages in the :mess
command in nvim.
Cheers
I have the same setup on linux / windows and completion does not work for tern.
On linux it works with the exact same setup and same project.
How would I go about debugging this? I tried using :profile but I can't seem to find where there is an issue.
Node is added to my path, and tern is installed globally.
Hello,
so I've been banging my head around for like 5 hours today, and this is as far as I've got. Let's say I open up vim editor and type in this:
[1, 2, 3].fi
Vim should show a popup with autocomplete suggestions, but nothing happens. What I have to do to make it work is press tab, then backspace and then tern seems to start working. I don't have to do this "tab thing" anymore, I just need to do it once I start the vim editor. Does anybody have any ideas what might be wrong? It behaves the same on both: vim and neovim. Here's my .vimrc file: https://gist.github.com/arnsa/3ce831a5d7fd9f5c4e6135a8f61175f0
[deoplete] Traceback (most recent call last):
[deoplete] File "/Users/daniele/.config/nvim/plugged/deoplete.nvim/rplugin/python3/deoplete/source/omni.py", line 99, in gather_candidates
[deoplete] File "/usr/local/lib/python3.6/site-packages/neovim/api/nvim.py", line 131, in request
[deoplete] self.__omnifunc, 0, context['complete_str'])
[deoplete] res = self._session.request(name, *args, **kwargs)
[deoplete] File "/usr/local/lib/python3.6/site-packages/neovim/api/nvim.py", line 230, in call
[deoplete] File "/usr/local/lib/python3.6/site-packages/neovim/msgpack_rpc/session.py", line 98, in request
[deoplete] return self.request('nvim_call_function', name, args, **kwargs)
[deoplete] raise self.error_wrapper(err)
[deoplete] neovim.api.nvim.NvimError: b'Vim(let):E121: Undefined variable: b:compl_context'
[deoplete] neovim.api.nvim.NvimError: b'Vim(let):E121: Undefined variable: b:compl_context'
[deoplete] neovim.api.nvim.NvimError: b'Vim(let):E121: Undefined variable: b:compl_context'
[deoplete] Error occurred calling omnifunction: javascriptcomplete#CompleteJS. Use :messages for error details.
I've been trying for the past two days, but just can't seem to get this working correctly. I've been using a simple test program, shown below:
export class Person() {
returnMe() {
return this;
}
dontReturnMe() {
return undefined;
}
}
const p = new Person();
p.
With my cursor after the .
on the last line, if I invoke tern_for_vim
through the omnifunc
that it provides, I get prompted with both returnMe
and dontReturnMe
as functions. However, if I invoke Deoplete (I have it set to a keyboard shortcut rather than automatically completing as I type) from that same position, I get no options at all.
I've noticed an annoying delay when first inserting text using your plugin. I suppose it's because of the time it takes for the tern server to load. Is it possible to make this async? I don't mind having my completions kick-in a while later but having a delay when first entering text is rather bothering. Thanks
Hey,
I have an issue where Tern will stop working in neovim after a while and the only way to fix is to restart neovim which I assume forces the Tern server to restart as well. This only started in the last few days or so. Is there anyway for me to debug what might be going on here?
Thanks!
Using this source slows down deoplete massively for me. No idea why, moment I remove it, deoplete is blazing fast. Even if I'm not in a javascript file.
Running latest deoplete and deoplete-ternjs, I get this when autocompletion starts:
[deoplete] Traceback (most recent call last):
[deoplete] File "/Users/wavded/.config/nvim/plugged/deoplete.nvim/rplugin/python3/deoplete/deoplete.py", lin
e 64, in completion_begin
[deoplete] complete_position, candidates = self.gather_candidates(context)
[deoplete] File "/Users/wavded/.config/nvim/plugged/deoplete.nvim/rplugin/python3/deoplete/deoplete.py", lin
e 99, in gather_candidates
[deoplete] results = self.gather_results(context)
[deoplete] File "/Users/wavded/.config/nvim/plugged/deoplete.nvim/rplugin/python3/deoplete/deoplete.py", lin
e 174, in gather_results
[deoplete] context['candidates'] = source.gather_candidates(context)
[deoplete] File "/Users/wavded/.config/nvim/plugged/deoplete-ternjs/rplugin/python3/deoplete/sources/ternjs.
py", line 335, in gather_candidates
[deoplete] result = self.completation(pos)
[deoplete] File "/Users/wavded/.config/nvim/plugged/deoplete-ternjs/rplugin/python3/deoplete/sources/ternjs.
py", line 295, in completation
[deoplete] data = self.run_command(command, pos)
[deoplete] File "/Users/wavded/.config/nvim/plugged/deoplete-ternjs/rplugin/python3/deoplete/sources/ternjs.
py", line 206, in run_command
[deoplete] raise e
[deoplete] File "/Users/wavded/.config/nvim/plugged/deoplete-ternjs/rplugin/python3/deoplete/sources/ternjs.
py", line 200, in run_command
[deoplete] data = self.make_request(doc, silent)
[deoplete] File "/Users/wavded/.config/nvim/plugged/deoplete-ternjs/rplugin/python3/deoplete/sources/ternjs.
py", line 148, in make_request
[deoplete] req = opener.open("http://" + self.localhost + ":" + str(self.port) + "/", payload, self._tern_
timeout)
[deoplete] File "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/urll
ib/request.py", line 465, in open
[deoplete] response = self._open(req, data)
[deoplete] File "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/urll
ib/request.py", line 483, in _open
[deoplete] '_open', req)
[deoplete] File "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/urll
ib/request.py", line 443, in _call_chain
[deoplete] result = func(*args)
[deoplete] File "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/urll
ib/request.py", line 1268, in http_open
[deoplete] return self.do_open(http.client.HTTPConnection, req)
Tern is installed globally:
This is my tern config:
{
"libs": [ "browser", "ecma6", "ecma5" ],
"loadEagerly": [],
"dontLoad": ["node_modules"],
"plugins": {
"complete_strings": true,
"doc_comment": true,
"modules": true,
"node": true,
"node_require": true
}
}
Any ideas?
{
"libs": [
"browser"
],
}
tern report message:
tern
Bad JSON in /Users/michael/x/.tern-project: Unexpected token } in JSON at position 41
after removing , after ], completion work.
Just getting into building a new init.vim
and all is well. Would love to integrate this plugin into my neovim... but it seems to conflict with some syntax highlighting as well as italicizing.
syntax plugins being used:
call dein#add('othree/yajs')
call dein#add('pangloss/vim-javascript')
call dein#add('jelera/vim-javascript-syntax')
call dein#add('maxmellon/vim-jsx-pretty')
call dein#add('elzr/vim-json')
call dein#add('othree/javascript-libraries-syntax.vim')
more syntax config:
colorscheme one
syntax on
set background=dark
hi htmlArg gui=italic
hi Comment gui=italic
hi Type gui=italic
hi htmlArg cterm=italic
hi Comment cterm=italic
hi Type cterm=italic
When trying to autocomplete the content of a file open over the scp:// protocol, deoplete-ternjs will display errors and won't fill the autocompletion popup menu.
Here are the steps to reproduce the bug, provided that deoplete and deoplete-ternjs are loaded in your vimrc:
nvim scp://server//tmp/tmp.js
:set ft=javascript
a (go into insert mode)
let
Once you do that, the following errors will be shown:
[deoplete] Traceback (most recent call last):
[deoplete] File "/home/me/.vim/bundle/repos/github.com/Shougo/deoplete.nvim/rplugin/python3/deoplete/deoplete.py", line 100, in gather_results
[deoplete] ctx['candidates'] = source.gather_candidates(ctx)
[deoplete] File "/home/me/.vim/bundle/repos/github.com/carlitux/deoplete-ternjs/rplugin/python3/deoplete/sources/ternjs.py", line 351, in gather_candidates
[deoplete] result = self.completation(pos) or []
[deoplete] File "/home/me/.vim/bundle/repos/github.com/carlitux/deoplete-ternjs/rplugin/python3/deoplete/sources/ternjs.py", line 307, in completation
[deoplete] data = self.run_command(command, pos)
[deoplete] File "/home/me/.vim/bundle/repos/github.com/carlitux/deoplete-ternjs/rplugin/python3/deoplete/sources/ternjs.py", line 180, in run_command
[deoplete] self.start_server()
[deoplete] File "/home/me/.vim/bundle/repos/github.com/carlitux/deoplete-ternjs/rplugin/python3/deoplete/sources/ternjs.py", line 92, in start_server
[deoplete] portFile = os.path.join(self._project_directory, ".tern-port")
[deoplete] Traceback (most recent call last):
[deoplete] File "/usr/lib64/python3.4/posixpath.py", line 82, in join
[deoplete] File "/home/me/.vim/bundle/repos/github.com/Shougo/deoplete.nvim/rplugin/python3/deoplete/deoplete.py", line 100, in gather_results
[deoplete] path += b
[deoplete] ctx['candidates'] = source.gather_candidates(ctx)
[deoplete] TypeError: unsupported operand type(s) for +=: 'NoneType' and 'str'
[deoplete] File "/home/me/.vim/bundle/repos/github.com/carlitux/deoplete-ternjs/rplugin/python3/deoplete/sources/ternjs.py", line 351, in gather_candidates
[deoplete] Could not get completions from: ternjs. Use :messages for error details.
[deoplete] result = self.completation(pos) or []
[deoplete] File "/home/me/.vim/bundle/repos/github.com/carlitux/deoplete-ternjs/rplugin/python3/deoplete/sources/ternjs.py", line 307, in completation
[deoplete] data = self.run_command(command, pos)
[deoplete] File "/home/me/.vim/bundle/repos/github.com/carlitux/deoplete-ternjs/rplugin/python3/deoplete/sources/ternjs.py", line 198, in run_command
[deoplete] doc["files"].append(self.full_buffer())
[deoplete] File "/home/me/.vim/bundle/repos/github.com/carlitux/deoplete-ternjs/rplugin/python3/deoplete/sources/ternjs.py", line 236, in full_buffer
[deoplete] "name": self.relative_file(),
[deoplete] File "/home/me/.vim/bundle/repos/github.com/carlitux/deoplete-ternjs/rplugin/python3/deoplete/sources/ternjs.py", line 251, in relative_file
[deoplete] return filename[len(self._project_directory) + 1:]
[deoplete] TypeError: object of type 'NoneType' has no len()
[deoplete] Could not get completions from: ternjs. Use :messages for error details.
I believe this is a bug with deoplete-ternjs and not a deoplete one because other autocompletion plugins (such as deoplete-jedi) work over scp.
Thank you for this awesome plugin!
I have an issue using it in a babel/es7 project. Since async/await keywords have not been supported by tern yet, some code fragments will crash tern and stop the further completion, like:
app.use(async (ctx) => { // No tern completion after this line
return;
});
Deleting the async/await keywords before sending buffer to tern solves this problem. Is it ok to add a config like g:tern_remove_async_await
for this? I can create a PR for it.
I've has some issues getting this plugin to work. It worked initially when I set it up, then stopped working later. I just got it working again by opening up the .tern-project file (and not changing anything). My tern project file is very custom as it defines a requirejs config setup. This was confusing until I saw this in the docs:
If no .tern-project file is found in the current buffer's directory that is being edited or its ancestors, deoplete-ternjs will start the ternjs server in the current working directory:
Does this mean the .tern-project
file will have to be open in Vim for deoplete to work? Is that by design?
Example of how long it takes to appear on React.
(5-6 seconds) - https://cl.ly/oFFu
I've tried running my own tern server with --verbose
and I can see several request/response before the final response comes back with all the completions. The query sent to the server looks like:
"query": {
"type": "completions",
"types": false,
"depths": false,
"docs": false,
"filter": true,
"caseInsensitive": false,
"guess": true,
"sort": false,
"expandWordForward": true,
"omitObjectPrototype": false,
"includeKeywords": false,
"inLiteral": true,
"file": "#0",
"end": {
"line": 29,
"ch": 6
},
"lineCharPositions": true
}
My deoplete settings are:
if s:has_plugin('deoplete.nvim')
let g:deoplete#enable_at_startup = 1
let g:deoplete#auto_complete_start_length = 1
let g:deoplete#sources = {}
let g:deoplete#sources.python = ['ultisnips']
let g:deoplete#sources.javascript = ['buffer', 'tern']
endif
if s:has_plugin('deoplete-ternjs')
let g:tern_request_timeout = 1
let g:tern_show_signature_in_pum = '0'
let g:tern#command = ['tern']
let g:tern#arguments = ['--persistent']
let g:deoplete#sources#ternjs#timeout = 1
let g:deoplete#sources#ternjs#tern_bin = '/Users/simonsmith/.nvm/versions/node/v8.9.0/bin/tern'
endif
This also seems to block just normal buffer completions from appearing as well. If I disable this plugin then autocompletions from the same buffer appears instantly.
Any suggestions are welcomed :)
I'm using NVIM v0.2.0-6-g3979c6c on macOS with deoplete, deoplete-ternjs and tern_for_vim.
These are my options:
let g:tern#command = ["tern"]
let g:tern#arguments = ["--persistent", "--no-port-file"]
I would expect no more .tern-port files to appear, but they still do.
Hi, thanks for making this library. I have finally settled in a near-perfect JS environment. However when working all of a sudden stops giving suggestions:
When I restart neovim it works again.
My version is 0.1.4
I have a fairly simple config that you can see here:
http://pastebin.com/v10upH1j
I use a global tern-config in my home directory:
{
"libs": [
"browser"
],
"plugins": {
"node": {},
"requirejs": {
"baseURL": "./",
"paths": {}
}
}
}
I'm sorry for not being able to provide much useful information as I don't know how I can debug this. Any help would be appreciated.
I don't know if the error is for deoplete or deoplete-ternjs
[deoplete] Traceback (most recent call last):
[deoplete] Traceback (most recent call last):
[deoplete] File "/Users/daniele/.config/nvim/plugged/deoplete.nvim/rplugin/python3/deoplete/deoplete.py", line 100, in gather_results
[deoplete] File "/Users/daniele/.config/nvim/plugged/deoplete.nvim/rplugin/python3/deoplete/deoplete.py", line 100, in gather_results
[deoplete] ctx['candidates'] = source.gather_candidates(ctx)
[deoplete] ctx['candidates'] = source.gather_candidates(ctx)
[deoplete] File "/Users/daniele/.config/nvim/plugged/deoplete-ternjs/rplugin/python3/deoplete/sources/ternjs.py", line 351, in gather_candidates
[deoplete] File "/Users/daniele/.config/nvim/plugged/deoplete-ternjs/rplugin/python3/deoplete/sources/ternjs.py", line 351, in gather_candidates
[deoplete] result = self.completation(pos) or []
[deoplete] result = self.completation(pos) or []
[deoplete] File "/Users/daniele/.config/nvim/plugged/deoplete-ternjs/rplugin/python3/deoplete/sources/ternjs.py", line 307, in completation
[deoplete] File "/Users/daniele/.config/nvim/plugged/deoplete-ternjs/rplugin/python3/deoplete/sources/ternjs.py", line 307, in completation
[deoplete] data = self.run_command(command, pos)
[deoplete] data = self.run_command(command, pos)
[deoplete] File "/Users/daniele/.config/nvim/plugged/deoplete-ternjs/rplugin/python3/deoplete/sources/ternjs.py", line 192, in run_command
[deoplete] File "/Users/daniele/.config/nvim/plugged/deoplete-ternjs/rplugin/python3/deoplete/sources/ternjs.py", line 192, in run_command
[deoplete] f = self.buffer_fragment()
[deoplete] f = self.buffer_fragment()
[deoplete] File "/Users/daniele/.config/nvim/plugged/deoplete-ternjs/rplugin/python3/deoplete/sources/ternjs.py", line 274, in buffer_fragment
[deoplete] File "/Users/daniele/.config/nvim/plugged/deoplete-ternjs/rplugin/python3/deoplete/sources/ternjs.py", line 274, in buffer_fragment
[deoplete] "text": self.buffer_slice(buffer, start, end),
[deoplete] "text": self.buffer_slice(buffer, start, end),
[deoplete] File "/Users/daniele/.config/nvim/plugged/deoplete-ternjs/rplugin/python3/deoplete/sources/ternjs.py", line 242, in buffer_slice
[deoplete] File "/Users/daniele/.config/nvim/plugged/deoplete-ternjs/rplugin/python3/deoplete/sources/ternjs.py", line 242, in buffer_slice
[deoplete] text += buf[pos] + "\n"
[deoplete] text += buf[pos] + "\n"
[deoplete] File "/usr/local/lib/python3.5/site-packages/neovim/api/buffer.py", line 45, in __getitem__
[deoplete] File "/usr/local/lib/python3.5/site-packages/neovim/api/buffer.py", line 45, in __getitem__
[deoplete] return self.request('nvim_buf_get_lines', i, i + 1, True)[0]
[deoplete] return self.request('nvim_buf_get_lines', i, i + 1, True)[0]
[deoplete] File "/usr/local/lib/python3.5/site-packages/neovim/api/common.py", line 44, in request
[deoplete] File "/usr/local/lib/python3.5/site-packages/neovim/api/common.py", line 44, in request
[deoplete] return self._session.request(name, self, *args, **kwargs)
[deoplete] return self._session.request(name, self, *args, **kwargs)
[deoplete] File "/usr/local/lib/python3.5/site-packages/neovim/api/nvim.py", line 131, in request
[deoplete] File "/usr/local/lib/python3.5/site-packages/neovim/api/nvim.py", line 131, in request
[deoplete] res = self._session.request(name, *args, **kwargs)
[deoplete] res = self._session.request(name, *args, **kwargs)
[deoplete] File "/usr/local/lib/python3.5/site-packages/neovim/msgpack_rpc/session.py", line 98, in request
[deoplete] File "/usr/local/lib/python3.5/site-packages/neovim/msgpack_rpc/session.py", line 98, in request
[deoplete] raise self.error_wrapper(err)
[deoplete] raise self.error_wrapper(err)
[deoplete] neovim.api.nvim.NvimError: b'Index out of bounds'
[deoplete] neovim.api.nvim.NvimError: b'Index out of bounds'
[deoplete] Could not get completions from: ternjs. Use :messages for error details.
[deoplete] Could not get completions from: ternjs. Use :messages for error details.
Hello!
I've been using Deoplete with Deoplete-tern. There has been a consistent error message when I'm working on some projects. The projects are those that use the require() import instead of the new import statement. Is there any chance this is an issue related to this plugin?
[deoplete] Traceback (most recent call last):
[deoplete] File "/Users/daniel.olivares/.nvim/plugged/deoplete.nvim/rplugin/python3/deoplete/deoplete.py", line 47, in completion_begin
[deoplete] complete_position, candidates = self.gather_candidates(context)
[deoplete] File "/Users/daniel.olivares/.nvim/plugged/deoplete.nvim/rplugin/python3/deoplete/deoplete.py", line 81, in gather_candidates
[deoplete] results = self.gather_results(context)
[deoplete] File "/Users/daniel.olivares/.nvim/plugged/deoplete.nvim/rplugin/python3/deoplete/deoplete.py", line 132, in gather_results
[deoplete] context['candidates'] = source.gather_candidates(context)
[deoplete] File "/Users/daniel.olivares/.nvim/plugged/deoplete.nvim/rplugin/python3/deoplete/sources/tag.py", line 32, in gather_candidates
[deoplete] self.__make_cache(context)
[deoplete] File "/Users/daniel.olivares/.nvim/plugged/deoplete.nvim/rplugin/python3/deoplete/sources/tag.py", line 43, in __make_cache
[deoplete] for filename in self.__get_tagfiles():
[deoplete] File "/Users/daniel.olivares/.nvim/plugged/deoplete.nvim/rplugin/python3/deoplete/sources/tag.py", line 55, in __get_tagfiles
[deoplete] 'exists', '*neoinclude#include#get_tag_files') else []
[deoplete] File "/usr/local/lib/python3.5/site-packages/neovim/api/nvim.py", line 213, in call
[deoplete] return self.request('vim_call_function', name, args, **kwargs)
[deoplete] File "/usr/local/lib/python3.5/site-packages/neovim/api/nvim.py", line 129, in request
[deoplete] res = self._session.request(name, *args, **kwargs)
[deoplete] File "/usr/local/lib/python3.5/site-packages/neovim/msgpack_rpc/session.py", line 98, in request
[deoplete] raise self.error_wrapper(err)
[deoplete] neovim.api.nvim.NvimError: b'Vim(return):E121: Undefined variable: b:node_root'
[deoplete] An error has occurred. Please execute :messages command.
Hey there,
I wasn't sure if this is the problem but it's been a while now and every time tern stops (inside neovim) I go to project folder and see a .tern-port file created. I delete it and restart neovim and it's fine but the pesky little thing spawns itself quite often recently. Is this is a known issue? Is there some option to turn it off?
EDIT: To clarify, I only have a global .tern-config file, never local per project. Inside there is this:
{
"ecmaVersion": 6,
"libs": [
"browser",
"ecma5",
"ecma6"
],
"plugins": {
"node": {},
"commonjs": {}
}
}
Thanks!
javascript code:
var obj = {
name: 'aioiyuuko',
showName: function() {
console.log(this.name);
}
};
$1
$2
$3obj.name
the $1,$2 and $3 is the position of the cursor. i type obj.
at $1 i get the right result of autocomplete , but when i type obj.
at $2 i just got the Omni autocomplete result, the same issue is that i type console
or console.
at $3 position, just get the Omni autocomplete result.
mininit.vim
" vim-plug {
call plug#begin('~/dotfiles/nvim/plugged')
" deoplete and sources about {
Plug 'Shougo/deoplete.nvim'
Plug 'carlitux/deoplete-ternjs', { 'for': 'javascript' }
" }
call plug#end()
" }
" plugins {
" deoplete.nvim {
let g:deoplete#enable_at_startup = 1
let g:deoplete#max_list = 15
inoremap <silent> <CR> <C-r>=<SID>my_cr_function()<CR>
function! s:my_cr_function()
return (pumvisible() ? "\<C-y>" : "" ) . "\<CR>"
endfunction
inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
" }
" }
Is this expected behavior?
For a requireJS project, I have tern working correctly. However, it will only correctly identify the method with the associated docs once I have the method fully-typed out. For example, if there is an object called settings
and it has several methods called getVar1
and getVar2
and getLocale
, etc..
I will not get suggestions for any of those when I type settings.get
. Only when I type settings.getVar1
completely, then backspace to just have settings.get
do I start getting TernJS suggestions for all the other methods with their docs. Is this a setting that I can update?
I cannot seems to get deoplete and tern_for_vim to play nice:
When I open a javascript file and start to type deoplete starts giving errors about concatenating a noneType to a list.
[deoplete] Traceback (most recent call last):
[deoplete] Traceback (most recent call last):
[deoplete] Traceback (most recent call last):
[deoplete] File "/home/babbleshack/.local/share/nvim/plugged/deoplete.nvim/rplugin/python3/deoplete/deoplete.py", line 47, in completion_begin
[deoplete] File "/home/babbleshack/.local/share/nvim/plugged/deoplete.nvim/rplugin/python3/deoplete/deoplete.py", line 47, in completion_begin
[deoplete] File "/home/babbleshack/.local/share/nvim/plugged/deoplete.nvim/rplugin/python3/deoplete/deoplete.py", line 47, in completion_begin
[deoplete] self.gather_results(context), context['input'])
[deoplete] self.gather_results(context), context['input'])
[deoplete] self.gather_results(context), context['input'])
[deoplete] File "/home/babbleshack/.local/share/nvim/plugged/deoplete.nvim/rplugin/python3/deoplete/deoplete.py", line 162, in merge_results
[deoplete] File "/home/babbleshack/.local/share/nvim/plugged/deoplete.nvim/rplugin/python3/deoplete/deoplete.py", line 162, in merge_results
[deoplete] File "/home/babbleshack/.local/share/nvim/plugged/deoplete.nvim/rplugin/python3/deoplete/deoplete.py", line 162, in merge_results
[deoplete] source.gather_candidates(result['context']))
[deoplete] source.gather_candidates(result['context']))
[deoplete] source.gather_candidates(result['context']))
[deoplete] TypeError: unsupported operand type(s) for +=: 'NoneType' and 'list'
[deoplete] TypeError: unsupported operand type(s) for +=: 'NoneType' and 'list'
[deoplete] TypeError: unsupported operand type(s) for +=: 'NoneType' and 'list'
[deoplete] Error while gathering completions. Use :messages for error details.
[deoplete] Error while gathering completions. Use :messages for error details.
[deoplete] Error while gathering completions. Use :messages for error details.
[deoplete] Traceback (most recent call last):
[deoplete] File "/home/babbleshack/.local/share/nvim/plugged/deoplete.nvim/rplugin/python3/deoplete/deoplete.py", line 47, in completion_begin
[deoplete] self.gather_results(context), context['input'])
[deoplete] File "/home/babbleshack/.local/share/nvim/plugged/deoplete.nvim/rplugin/python3/deoplete/deoplete.py", line 162, in merge_results
[deoplete] source.gather_candidates(result['context']))
[deoplete] TypeError: unsupported operand type(s) for +=: 'NoneType' and 'list'
[deoplete] Error while gathering completions. Use :messages for error details.
My tern/deoplete config
"######################
""DEOPLETE
"#####################
let g:deoplete#enable_at_startup = 1
let g:deoplete#tag#cache_limit_size = 5000000
"####################
"DEOPLETE TERJS
"####################
let g:deoplete#sources#ternjs#filetypes = [
\ 'jsx',
\ 'javascript.jsx',
\ 'vue',
\ 'javascript'
\ ]
let g:deoplete#sources#ternjs#types = 1
let g:deoplete#sources#ternjs#docs = 1
let g:deoplete#sources#ternjs#tern_bin = '/home/babbleshack/.nvm/versions/node/v6.11.3/bin/tern'
" tern
if exists('g:plugs["tern_for_vim"]')
let g:tern#command = ["tern"]
let g:tern#arguments = ["--persistent"]
let g:deoplete#sources#ternjs#timeout = 3
let g:tern_show_argument_hints = 'on_hold'
let g:tern_show_signature_in_pum = 1
"autocmd FileType javascript setlocal omnifunc=tern#Complete
endif
I have also tried setting my vim python vars
let g:python_host_prog = '/usr/bin/python2'
let g:python3_host_prog = '/usr/bin/python'
about config like this:
{
"libs": [
"browser",
"jquery",
"ecma5",
"ecma6"
],
"plugins": {
"node": {}
}
}
i can't find an document of this plugin
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.