Skip to content

Mongoose causes doc_comment.js to crash tern. #253

@thomasmichaelwallace

Description

@thomasmichaelwallace

After typing require('mongoose') any request to tern results in the following error:

/home/michael/.vim/bundle/tern_for_vim/node_modules/tern/plugin/doc_comment.js:234
          if (args) args[name[1]].isOptional = parsed.isOptional;
                                             ^
TypeError: Cannot set property 'isOptional' of undefined
    at jsdocInterpretComments (/home/michael/.vim/bundle/tern_for_vim/node_modules/tern/plugin/doc_comment.js:234:46)
    at interpretComments (/home/michael/.vim/bundle/tern_for_vim/node_modules/tern/plugin/doc_comment.js:72:5)
    at walk.simple.FunctionDeclaration (/home/michael/.vim/bundle/tern_for_vim/node_modules/tern/plugin/doc_comment.js:49:11)
    at c (/home/michael/.vim/bundle/tern_for_vim/node_modules/tern/node_modules/acorn/util/walk.js:30:18)
    at Object.skipThrough (/home/michael/.vim/bundle/tern_for_vim/node_modules/tern/node_modules/acorn/util/walk.js:146:39)
    at c (/home/michael/.vim/bundle/tern_for_vim/node_modules/tern/node_modules/acorn/util/walk.js:29:17)
    at Object.base.Program.base.BlockStatement (/home/michael/.vim/bundle/tern_for_vim/node_modules/tern/node_modules/acorn/util/walk.js:154:7)
    at c (/home/michael/.vim/bundle/tern_for_vim/node_modules/tern/node_modules/acorn/util/walk.js:29:17)
    at Object.exports.simple (/home/michael/.vim/bundle/tern_for_vim/node_modules/tern/node_modules/acorn/util/walk.js:32:5)
    at postInfer (/home/michael/.vim/bundle/tern_for_vim/node_modules/tern/plugin/doc_comment.js:41:10)

As I don't have a clue how to go about debugging (either) application the following workaround is sufficing for me:

if (args && args[name[1]]) args[name[1]].isOptional = parsed.isOptional;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions