Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Does not find modules in directory "node_modules" #10

Open
ahayman opened this issue Jul 16, 2013 · 2 comments
Open

Does not find modules in directory "node_modules" #10

ahayman opened this issue Jul 16, 2013 · 2 comments
Labels
Milestone

Comments

@ahayman
Copy link

ahayman commented Jul 16, 2013

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?

@myhere
Copy link
Owner

myhere commented Jul 17, 2013

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 :)

@ahayman
Copy link
Author

ahayman commented Jul 17, 2013

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.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants