The expression used for 'includeexpr' (which is triggerd by [+I or insertion completion, as specified by default in 'complete') fails if b:node_root is undefined.
The b:node_root variable is created by the node#initialize(), which is called from s:detect() when it detects that the file is part of Node.js project.
A possible solution is to avoid change anything (as the 'includeexpr' option) if a file isn't detected as node file. Maybe it is also possible to improve the detection by searching the buffer for some node specific keywords (such as require) and setting the b:node_root to the env variable $NODE_PATH instead of leaving it undefined.
In any case, I didn't understood the need for all the autocmds in the end of the plugin/node.vim, and while debugging the E121 error I noticed that s:detect() is called for every buffer opened, including the help files, which causes unnecessary overhead. I've implemented a simpler solution, but it is possible it missed some corner case.
I intended to run the automated tests, but I'm not familiar with ruby. Did you have the chance to write the post explaining the tests which is mentioned in #4?
The expression used for
'includeexpr'
(which is triggerd by [+I or insertion completion, as specified by default in 'complete') fails ifb:node_root
is undefined.The
b:node_root
variable is created by thenode#initialize()
, which is called from s:detect() when it detects that the file is part of Node.js project.A possible solution is to avoid change anything (as the
'includeexpr'
option) if a file isn't detected as node file. Maybe it is also possible to improve the detection by searching the buffer for some node specific keywords (such asrequire
) and setting the b:node_root to the env variable$NODE_PATH
instead of leaving it undefined.In any case, I didn't understood the need for all the autocmds in the end of the
plugin/node.vim
, and while debugging the E121 error I noticed thats:detect()
is called for every buffer opened, including the help files, which causes unnecessary overhead. I've implemented a simpler solution, but it is possible it missed some corner case.I intended to run the automated tests, but I'm not familiar with ruby. Did you have the chance to write the post explaining the tests which is mentioned in #4?