vim-nodejs-complete icon indicating copy to clipboard operation
vim-nodejs-complete copied to clipboard

Does not find modules in directory "node_modules"

Open ahayman opened this issue 12 years ago • 2 comments

When I open a file in vim, vim-nodejs-complete doesn't provide any auto-completion for modules located in my 'node_modules' directory. It does provide auto-completion for all base modules. If I type in the command ":unlet b:npm_module_names", the response is: "No Such Variable: b:npm_module_names". Is there some way to get it to autocomplete my modules stored in the 'node_modules' directory?

ahayman avatar Jul 16 '13 20:07 ahayman

for now, it can only complete file names in node_modules directory, and only complete require statement.

it's buggy. i will promote it later.

thanks for using it, contributing is welcomed :)

myhere avatar Jul 17 '13 09:07 myhere

Yes, while I was waiting, I looked through your VIM script and realized that you're pulling from a precompiled completion dictionary. I don't have much experience with VIM Script, but I will fork your project and see what I can do to include autocompletion for modules in the node_modules directory.

I have one Recommendation:
In the nodejscomplete.vim script, you have the following settings on line 17:

let s:nodejs_complete_config = { \ 'js_compl_fn': 'javascriptcomplete#CompleteJS', \ 'max_node_compl_len': 15 }

Setting "the max_node_compl_len" to "15" truncates all autocomplete options to the first 15 found. Even if I continue to type (filtering the results) only the first 15 are filtered. By changing the value to "0" (unlimited), I was able to gain access to all of the completion results instead of only the first 15. This is what I changed it to:

let s:nodejs_complete_config = { \ 'js_compl_fn': 'javascriptcomplete#CompleteJS', \ 'max_node_compl_len': 0 }

Disclaimer: I'm using the "youCompleteMe" auto-completer plugin so that completion results come up automatically as I type. Your script is only called once to bring up the completion results, and then as I continue to type those results are filtered. I don't know if that's standard VIM behavior or specific to the "youCompleteMe" plugin.

ahayman avatar Jul 17 '13 12:07 ahayman