-
-
Notifications
You must be signed in to change notification settings - Fork 35.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Editor: Integrate tern-threejs in script editor #6654
Conversation
Epic! Many thanks! 😊 |
Editor: Integrate tern-threejs in script editor
@mrdoob what would |
hmm... it seems like |
@zz85 @mrdoob I think you should create your issue at https://github.com/tylerwbell/tern-threejs In my case, I follow this project and I could help you if I know how to fix teh issue and if I find time. |
@angelozerr thanks for suggesting but I do not think it's an issue with tern-threejs project, because auto-completing this in the script editor has a different use case, since it's code is being evaluated at run time and bind to the object (in app.js) var functions = ( new Function( 'player, scene, keydown, keyup, mousedown, mouseup, mousemove, touchstart, touchend, touchmove, update', script.source + '\nreturn { keydown: keydown, keyup: keyup, mousedown: mousedown, mouseup: mouseup, mousemove: mousemove, touchstart: touchstart, touchend: touchend, touchmove: touchmove, update: update };' ).bind( object ) )( this, scene ); so I would say it's rather specific here to how three.js script can request ternjs to analyze with a different scope.. |
I don't have enough brain cycles to be able to wrap my mind around all of ternjs internals right now, but I'm guessing it might be possible to invoke a 'speculative this' in ternjs inference (related issue) I would be tempted to just use an easier implementation (like using get-hint and javascript-hint to add simple tokens for autocomplete) but if ternjs can be integrated it would give more contextual and accurate autocoplete. |
I guess prepending |
IMHO, I think the best mean to manage this case is to do like node.js tern plugin by creating a scope for each script. See https://github.com/marijnh/tern/blob/master/plugin/node.js#L31 When scope is created you could register this and update function by injecting the well event instance. So you will benefit with event compeltion too. @zz85 perhaps you could integrate tern-lint to validate with semantic mean (and not syntax) the script. See https://github.com/angelozerr/tern-lint |
@angelozerr that's a cool project! I should try it out sometime. @mrdoob nope. that would be pretty invalid javascript. if you would really want this to happen, I think I can ask about this in https://groups.google.com/forum/?fromgroups#!forum/tern-dev |
Is there any way to automate this tern-threejs stuff? I suspect is pretty outdated at the moment, and we keep fixing it by hand... |
Some notes:
ping @mrdoob @tylerwbell