Skip to content
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

Tern no longer finds node_modules #9

Closed
joshuafcole opened this issue Apr 3, 2014 · 13 comments
Closed

Tern no longer finds node_modules #9

joshuafcole opened this issue Apr 3, 2014 · 13 comments

Comments

@joshuafcole
Copy link

Hey there. Finally got some time to experiment with this again at work. The good news is that it no longer hangs on the large node client/server stack that was previously causing it trouble. It throws up its hands and gives up on AMD, but that's par for the course even with humans sometimes. 📦

Unfortunately, it no longer seems capable of finding definitions within the node_modules directory, which is 80% of it's use case for me. When I want documentation on a function or need to jump to its definition, it's almost never in the same app as I'm currently in (as we try to avoid giant monolithic apps). While I agree it shouldn't eagerly parse each module, it would be nice if it could recognize that I asked for information on a node module and parse it then.

Cheers,
Josh

@mortalapeman
Copy link
Owner

Did you add the following to your workspace configuration?

{:+ {:tern.config [(:lt.plugins.tern/libs :ecma5)
                   (:lt.plugins.tern/plugin :node true)]}
 :- {:tern.config [:lt.plugins.tern/libs]}}

The plugin no longer includes all the tern plugins by default. You are now required to configure the plugin to your current JS environment. A browser environment is the default.

Including all the plugins by default was causing tern to do wonky things, so I'm trying to move more to something like the .tern-project file for now. In the future I'd like to try and guess at your environment and configure it for you, but I haven't had time to work on it lately.

@joshuafcole
Copy link
Author

Haven't actually done any per-workspace configuration yet. I found the appropriate ltcache/workspace/.clj file. should I add that into the :ws-behaviors string? Or as an object?

@joshuafcole
Copy link
Author

As an object broke the behavior and as a string doesn't seem to have the intended effect.

@joshuafcole
Copy link
Author

Adding them to my user.behaviors seems to work, but breaks the tern plugin when first attempting to doc or goto anything (presumably as it initializes):

TypeError: Cannot set property 'isOptional' of undefined at jsdocInterpretComments (/Users/jcole/Library/Application Support/LightTable/plugins/TernJS/node_modules/tern/plugin/doc_comment.js:234:46) at interpretComments (/Users/jcole/Library/Application Support/LightTable/plugins/TernJS/node_modules/tern/plugin/doc_comment.js:72:5) at walk.simple.FunctionDeclaration (/Users/jcole/Library/Application Support/LightTable/plugins/TernJS/node_modules/tern/plugin/doc_comment.js:49:11) at c (/Users/jcole/Library/Application Support/LightTable/plugins/TernJS/node_modules/tern/node_modules/acorn/util/walk.js:30:18) at Object.skipThrough (/Users/jcole/Library/Application Support/LightTable/plugins/TernJS/node_modules/tern/node_modules/acorn/util/walk.js:146:39) at c (/Users/jcole/Library/Application Support/LightTable/plugins/TernJS/node_modules/tern/node_modules/acorn/util/walk.js:29:17) at Object.base.Program.base.BlockStatement (/Users/jcole/Library/Application Support/LightTable/plugins/TernJS/node_modules/tern/node_modules/acorn/util/walk.js:154:7) at c (/Users/jcole/Library/Application Support/LightTable/plugins/TernJS/node_modules/tern/node_modules/acorn/util/walk.js:29:17) at Object.exports.simple (/Users/jcole/Library/Application Support/LightTable/plugins/TernJS/node_modules/tern/node_modules/acorn/util/walk.js:32:5) at postInfer (/Users/jcole/Library/Application Support/LightTable/plugins/TernJS/node_modules/tern/plugin/doc_comment.js:41:10) at runPasses (/Users/jcole/Library/Application Support/LightTable/plugins/TernJS/node_modules/tern/lib/infer.js:1107:58)
[442] _BEH__error
bootstrap.js [6196] c
bootstrap.js [6236] a
bootstrap.js [20533] lt.object.raise_STAR

bootstrap.js [20566] a
bootstrap.js [20570] b
[416] anonymous
events.js [98] EventEmitter.emit
child_process.js [318] handleMessage
child_process.js [345] channel.onread

@mortalapeman
Copy link
Owner

You can get to your workspace behaviors by typing Settings: Workspace behaviors to setup workspace local configuration for the plugin.

Hmmm, I'll have to check into this when I get home tonight. I'm pretty sure JavaScript docs were working before I published the plugin. If you are feeling adventurous, you can turn on logging and throw in a few log statements to ensure that the :doc_comments plugin is correctly loaded.

@joshuafcole
Copy link
Author

Ah, thanks for the info. I may find some time to take a look this evening,
but I should probably get back to work. Too much yak-shaving in one day
makes schedules uncomfortably tight. :)

On Thu, Apr 3, 2014 at 12:27 PM, Eric Pritchett notifications@github.comwrote:

You can get to your workspace behaviors by typing Settings: Workspace
behaviors to setup workspace local configuration for the plugin.

Hmmm, I'll have to check into this when I get home tonight. I'm pretty
sure JavaScript docs were working before I published the plugin. If you are
feeling adventurous, you can turn on logginghttps://github.com/mortalapeman/LT-TernJS/blob/master/node/ternserver.js#L9and throw in a few log statements to ensure that the
:doc_comments plugin is correctly loaded.

Reply to this email directly or view it on GitHubhttps://github.com//issues/9#issuecomment-39494243
.

Screw the environment. Please print this email immediately. And then burn
it.

@mortalapeman
Copy link
Owner

Haha true that. I really appreciate the feedback btw. I had planned to dog food myself with the plugin, but then I got put on the backend team writing C# so I haven't really been able to put this project through it's paces like I want to.

@mortalapeman
Copy link
Owner

It looks a lot like this Tern issue has been fixed on the tip of development. I am currently using the latest Tern node package, but I should probably look into living on the edge and including the project as a git submodule. The 0.5.0 package was release like 5 months ago and there are several other fixes I'd like included as well.

@joshuafcole
Copy link
Author

That makes the most sense to me. I'll be keeping an eye out for updates. :)

On Sat, Apr 12, 2014 at 4:55 PM, Eric Pritchett notifications@github.comwrote:

It looks a lot like this Tern issuehttps://github.com/marijnh/tern/issues/253has been fixed on the tip of development. I am currently using the latest
Tern node package, but I should probably look into living on the edge and
including the project as a git submodule. The 0.5.0 package was release
like 5 months ago and there are several other fixes I'd like included as
well.

Reply to this email directly or view it on GitHubhttps://github.com//issues/9#issuecomment-40294928
.

Screw the environment. Please print this email immediately. And then burn
it.

mortalapeman added a commit that referenced this issue Apr 15, 2014
mortalapeman added a commit that referenced this issue Apr 15, 2014
@mortalapeman
Copy link
Owner

Interesting, I apparently merged that subtree commit twice somehow. Anyway, try it out now. I've update Tern to the version used by the Adobe Brackets team.

@joshuafcole
Copy link
Author

It's working a lot better now! It works as expected on projects which are entirely CommonJS.

It still dies on the mixed CommonJS / AMD project (backend in node, frontend in requireJS) regardless of whether I'm querying node things or AMD things. It doesn't block user input, freeze LT, or try incessantly to reconnect, so it's not a huge problem (at least I can use it on the pure node projects).

The stack trace doesn't look too helpful, but here it is. in the mixed project:

cljserror: channel closed at ChildProcess.target.send (child_process.js:402:26) at eval (/Users/jcole/Library/Application%20Support/LightTable/plugins/TernJS/ternjs_compiled.js:402:16) at eval (/Users/jcole/Library/Application%20Support/LightTable/plugins/TernJS/ternjs_compiled.js:260:506) at eval (/Users/jcole/Library/Application%20Support/LightTable/plugins/TernJS/ternjs_compiled.js:199:14) at eval (/Users/jcole/Library/Application%20Support/LightTable/plugins/TernJS/ternjs_compiled.js:84:18) at eval (/Users/jcole/Library/Application%20Support/LightTable/plugins/TernJS/ternjs_compiled.js:84:18) at eval (/Users/jcole/Library/Application%20Support/LightTable/plugins/TernJS/ternjs_compiled.js:84:18) at eval (/Users/jcole/Library/Application%20Support/LightTable/plugins/TernJS/ternjs_compiled.js:84:18) at eval (/Users/jcole/Library/Application%20Support/LightTable/plugins/TernJS/ternjs_compiled.js:100:18) at Object.eval as oncomplete

@mortalapeman
Copy link
Owner

Looks like something is crashing the node process. I'll make a new issue for it and see if I can hunt down the problem.

@joshuafcole
Copy link
Author

Sounds great, if there's anything I can do to help let me know. I should
have time to dive in a bit this weekend.
On Apr 15, 2014 8:12 AM, "Eric Pritchett" notifications@github.com wrote:

Looks like something is crashing the node process. I'll make a new issue
for it and see if I can hunt down the problem.


Reply to this email directly or view it on GitHubhttps://github.com//issues/9#issuecomment-40493628
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants