ternjs / tern

A JavaScript code analyzer for deep, cross-editor language support
https://ternjs.net/
MIT License
4.25k stars 378 forks source link

tern fail to load condense generated file for cocos-js game engine? #589

Open alexzzp opened 9 years ago

alexzzp commented 9 years ago

Hi forks, I am a game developer woking in the cocos-js (https://github.com/cocos2d/cocos2d-js), I try to use vim along with tern for the project. I followed the tern document (http://ternjs.net/) and able to generate a condense file for the engine

find cocos2d | grep \.js$ | xargs condense > def-cocos2d.json 

But when I try to load the def file by tern, it just throw an exception:

        else throw new Error("Invalid !type spec: " + tp);
                   ^
Error: Invalid !type spec: number
    at passOne (/$TERN_DIR/tern_for_vim/node_modules/tern/lib/def.js:363:20)
    at doLoadEnvironment (/$TERN_DIR/tern_for_vim/node_modules/tern/lib/def.js:443:74)
    at Object.exports.load (/$TERN_DIR/tern_for_vim/node_modules/tern/lib/def.js:463:7)
    at /$TERN_DIR/tern_for_vim/node_modules/tern/lib/infer.js:753:13
    at Object.exports.withContext (/$TERN_DIR/tern_for_vim/node_modules/tern/lib/infer.js:767:18)
    at new exports.Context (/$TERN_DIR/tern_for_vim/node_modules/tern/lib/infer.js:736:13)
    at Object.signal.mixin.reset (/$TERN_DIR/tern_for_vim/node_modules/tern/lib/tern.js:129:17)
    at Object.exports.Server (/$TERN_DIR/tern_for_vim/node_modules/tern/lib/tern.js:111:10)
    at startServer (/$TERN_DIR/tern_for_vim/node_modules/tern/bin/tern:144:16)
    at Object.<anonymous> (/$TERN_DIR/tern_for_vim/node_modules/tern/bin/tern:139:14)
marijnh commented 9 years ago

I had to fix another bug (6f67b12) before I could get the json file I generated from cocos2d to work, but after I fixed that, it loaded fine. This is what I got: https://gist.github.com/marijnh/50860043e32ac83bedab