Closed StefanICT closed 9 years ago
This sounds a bit like marijnh/tern#516, but once again, I can not reproduce it -- I do see (fn)
after the name when I complete a global function (I had to add a second function starting with what
, because my vim immediately completes when there is only a single match).
Could you show me a picture or something of the result you get? Also do you have extra stuff in the vimrc that could be the cause that mine completion is not working? I just reinstalled tern and YoucompleteMe but no luck. I love this plugin and I need it ;) Or show me how I can debug it?
My .vimrc
is simply this:
execute pathogen#infect()
syntax on
filetype plugin indent on
I just moved to a new machine and installed vim specifically to try to reproduce this issue. So the only plugin that I have installed is tern_for_vim. Does disabling other plugins make a difference?
I only got YouCompleteMe and without it does't work either. I also moved to new machine. My vimrc isn't much more then that:
set nocompatible
execute pathogen#infect()
syntax on
filetype plugin indent on
"Habit breaking, habit making
nnoremap <Up> :echoe "use k" <CR>
nnoremap <Down> :echoe "use j" <CR>
nnoremap <Left> :echoe "use h" <CR>
nnoremap <Right> :echoe "use l" <CR>
set rnu
set nu
set ai
"Backspace not working for some reason this fixes it
set backspace=indent,eol,start
colo candycode
Strange. Which Tern version are you using? (See the top of node_modules/tern/package.json
)
"name": "tern",
"license": "MIT",
"version": "0.10.0",
"author": {
"name": "Marijn Haverbeke",
"email": "marijnh@gmail.com"
},
Here's what completion on a simple file looks like, using Tern 0.10.0 and vim 7.4:
So the setup of the situation is:
main.js -code .tern-project
Right?
vim --version
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Apr 7 2015 21:44:25)
MacOS X (unix) version
Included patches: 1-658
Compiled by stefan@Stefans-iMac.local
Normal version without GUI. Features included (+) or not (-):
+acl -farsi -mouse_netterm +syntax
-arabic +file_in_path -mouse_sgr +tag_binary
+autocmd +find_in_path -mouse_sysmouse +tag_old_static
-balloon_eval +float -mouse_urxvt -tag_any_white
-browse +folding +mouse_xterm -tcl
+builtin_terms -footer +multi_byte +terminfo
+byte_offset +fork() +multi_lang +termresponse
+cindent -gettext -mzscheme +textobjects
-clientserver -hangul_input +netbeans_intg +title
+clipboard +iconv +path_extra -toolbar
+cmdline_compl +insert_expand -perl +user_commands
+cmdline_hist +jumplist +persistent_undo +vertsplit
+cmdline_info -keymap +postscript +virtualedit
+comments -langmap +printer +visual
-conceal +libcall -profile +visualextra
+cryptv +linebreak +python +viminfo
-cscope +lispindent -python3 +vreplace
+cursorbind +listcmds +quickfix +wildignore
+cursorshape +localmap +reltime +wildmenu
+dialog_con -lua -rightleft +windows
+diff +menu +ruby +writebackup
+digraphs +mksession +scrollbind -X11
-dnd +modify_fname +signs -xfontset
-ebcdic +mouse +smartindent -xim
-emacs_tags -mouseshape -sniff -xsmp
+eval -mouse_dec +startuptime -xterm_clipboard
+ex_extra -mouse_gpm +statusline -xterm_save
+extra_search -mouse_jsbterm -sun_workshop -xpm
I didn't create a .tern-project
, just a foo.js
in my home dir, but the effect should be the same.
You could see what you get when you start your tern server manually from the command line with the --verbose
flag (kill existing servers first). Do the completions really have "?"
as the type? If not, something is going wrong on the vim side. Next step would be to try and dig down into the the var type = val.getType()
line in findCompletions
in tern/lib/tern.js
, and figure out why it isn't returning a type -- but this library is unfortunately not very easy to debug without a lot of background knowledge.
I appreciate the help. So i am digging right now. I will keep you posted, could be tomorrow though.
Couple things already.
EDIT:
Got the server problem working ;)
As a novice I would say vim is not asking for completion without the dot?
EDIT again: Just tried this on my work macbook above was done on a iMac at home. Both gave me the same 'wrong' result
@StefanICT
I only got YouCompleteMe and without it does't work either.
This means that you've tried to complete 'what' manually with C-x C-o
and it does not work? Strange, because C-x C-o
works for me.
YCM and neocomplete do not complete global names without dot,
I have created a dictionary for neocomplete with document
, window
, prompt
, function
and stuff like that, which works fine for me.
@barwinco w00t w000t...!!!!
I just tried disabling YCM and in the docs I read the C-space activates the completion and then it works! I guess vim is just in the way or something? I guess I need to find a way to let YCM handle the completion or something!
On the right track!!!
EDIT: So I enabled YCM again and vim still shows some kinds of hints but when I do C-space>it shows me the expecting results!
So I will keep you guys posted on my future trail and errors ;) Really appreciate the help!
I think I found the solution!
YouCompleteMe gives two types of completion. I want the semantics and stopped the other. YCM got this option to set triggers:
let g:ycm_semantic_triggers = {
\ 'c' : ['->', '.'],
\ 'objc' : ['->', '.'],
\ 'ocaml' : ['.', '#'],
\ 'cpp,objcpp' : ['->', '.', '::'],
\ 'perl' : ['->'],
\ 'php' : ['->', '::'],
\ 'cs,java,javascript,d,python,perl6,scala,vb,elixir,go' : ['.'],
\ 'vim' : ['re![_a-zA-Z]+[_\w]*\.'],
\ 'ruby' : ['.', '::'],
\ 'lua' : ['.', ':'],
\ 'erlang' : [':'],
\ }
I have to add a python regex to match any 3 letters, then it is fixed and this can be closed now I guess.
@StefanICT Hi, what regex did you add to make javascript auto trigger to work? I have the similar issue as you.
@StefanICT Why it doesn't show the write function for me?
My .tern-project: { "libs": [ "browser", "underscore", "jquery" ],
"plugins": {
"node": {},
"requirejs": {
"baseURL": "./",
"paths": {}
}
}
}
@talkw-liu That's a different issue, fixed by https://github.com/ternjs/tern/commit/d43faf3a95ebc035697d78c89ca1e4080d85d6e4
I added two images of my problem. The first shows that Vim doesn't show to docs for whatever function, but when I prepend "this." it does? Why does this happen, am I missing some .tern-project setting?
My .tern-project