Open phyllisstein opened 6 years ago
Don't think this was made for monorepo in mind. I reckon the codebase could use a bit of refactoring to make it easier to implement this. Do you have a solution in mind?
You're right, most of its functionality doesn't work in the kind of environment I'm describing. But throwing this error rather than gracefully handling it happens to crash the autocomplete module badly enough that no other packages' completions are returned either.
Given how bad the failure case is, and given that making this project work more broadly for monorepos isn't on the table right now, I think just catching the error would be sufficient.
Happy for you to put in a PR 👍
On Thu., 21 Dec. 2017, 8:42 pm Daniel P. Shannon, notifications@github.com wrote:
You're right, most of its functionality doesn't work in the kind of environment I'm describing. But throwing this error rather than gracefully handling it happens to crash the autocomplete module badly enough that no other packages' completions are returned either.
Given how bad the failure case is, and given that making this project work more broadly for monorepos isn't on the table right now, I think just gracefully handling the error would be sufficient.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/nkt/atom-autocomplete-modules/issues/89#issuecomment-353341453, or mute the thread https://github.com/notifications/unsubscribe-auth/AKXAhsB7MD4CCrizzNkzInLB4l_kGTm7ks5tClI2gaJpZM4RH5He .
Just flagging that this turns out to be a little too direct a lookup technique:
https://github.com/nkt/atom-autocomplete-modules/blob/2961f55ee42e0d2d84ab70c34f20562de04a2a48/src/utils/export-module-completion.js#L51-L52
It was crashing for me in a monorepo, where the folder structure looks something like this:
If I was working in
wendy
and importing something fromreact
, the package would crash trying to read a nonexistent./node_modules/react/package.json
instead of./packages/wendy/node_modules/react/package.json
:Kind of an edge case, but might be worth at least wrapping in a
try...catch
block to keep it from crashing other autocompletion modules.