hex13 / atom-lupa

Atom extension which displays outline for JavaScript files
MIT License
41 stars 4 forks source link

Uncaught Error: Lupa: couldn't find config file for .../source/client/redu... #14

Closed dax70 closed 8 years ago

dax70 commented 8 years ago

[Enter steps to reproduce below:]

  1. ...
  2. ...

Atom Version: 1.7.3 System: Mac OS X 10.11.4 Thrown From: atom-lupa package, v0.5.14

Stack Trace

Uncaught Error: Lupa: couldn't find config file for /Users/eddyrecio/code/rw30/source/client/reducers

At /Users/eddyrecio/.atom/packages/atom-lupa/node_modules/react/lib/ReactErrorUtils.js:52

Error: Lupa: couldn't find config file for /Users/eddyrecio/code/rw30/source/client/reducers
    at Object.analysis.indexProject (/Users/eddyrecio/.atom/packages/atom-lupa/node_modules/lupa/src/analysis.js:212:30)
    at /Users/eddyrecio/.atom/packages/atom-lupa/index.js:46:22
    at /Users/eddyrecio/.atom/packages/atom-lupa/lib/middleware/domMiddleware.js:22:9
    at Object.dispatch (/Users/eddyrecio/.atom/packages/atom-lupa/node_modules/redux-thunk/lib/index.js:14:16)
    at _react2.default.createElement._react2.default.createElement.onClick (/Users/eddyrecio/.atom/packages/atom-lupa/lib/components/Lupa.js:251:34)
    at Object.invokeGuardedCallback (/Users/eddyrecio/.atom/packages/atom-lupa/node_modules/react/lib/ReactErrorUtils.js:26:12)
    at executeDispatch (/Users/eddyrecio/.atom/packages/atom-lupa/node_modules/react/lib/EventPluginUtils.js:87:21)
    at Object.executeDispatchesInOrder (/Users/eddyrecio/.atom/packages/atom-lupa/node_modules/react/lib/EventPluginUtils.js:110:5)
    at executeDispatchesAndRelease (/Users/eddyrecio/.atom/packages/atom-lupa/node_modules/react/lib/EventPluginHub.js:42:22)
    at executeDispatchesAndReleaseTopLevel (/Users/eddyrecio/.atom/packages/atom-lupa/node_modules/react/lib/EventPluginHub.js:53:10)
    at Array.forEach (native)
    at forEachAccumulated (/Users/eddyrecio/.atom/packages/atom-lupa/node_modules/react/lib/forEachAccumulated.js:24:9)
    at Object.EventPluginHub.processEventQueue (/Users/eddyrecio/.atom/packages/atom-lupa/node_modules/react/lib/EventPluginHub.js:215:7)
    at runEventQueueInBatch (/Users/eddyrecio/.atom/packages/atom-lupa/node_modules/react/lib/ReactEventEmitterMixin.js:18:18)
    at Object.ReactEventEmitterMixin.handleTopLevel [as _handleTopLevel] (/Users/eddyrecio/.atom/packages/atom-lupa/node_modules/react/lib/ReactEventEmitterMixin.js:29:5)
    at handleTopLevelImpl (/Users/eddyrecio/.atom/packages/atom-lupa/node_modules/react/lib/ReactEventListener.js:73:24)
    at ReactDefaultBatchingStrategyTransaction.Mixin.perform (/Users/eddyrecio/.atom/packages/atom-lupa/node_modules/react/lib/Transaction.js:136:20)
    at Object.ReactDefaultBatchingStrategy.batchedUpdates (/Users/eddyrecio/.atom/packages/atom-lupa/node_modules/react/lib/ReactDefaultBatchingStrategy.js:63:19)
    at Object.batchedUpdates (/Users/eddyrecio/.atom/packages/atom-lupa/node_modules/react/lib/ReactUpdates.js:97:20)
    at ReactEventListener.dispatchEvent (/Users/eddyrecio/.atom/packages/atom-lupa/node_modules/react/lib/ReactEventListener.js:150:20)

Commands

     -2:48.2.0 core:confirm (atom-text-editor.editor.mini.is-focused)
     -1:10.7.0 atom-lupa:toggle (atom-text-editor.editor.is-focused)

Config

{
  "core": {
    "disabledPackages": [
      "nuclide-language-hack",
      "nuclide-hack",
      "nuclide-hg-repository"
    ],
    "themes": [
      "atom-material-ui",
      "base16-tomorrow-dark-theme"
    ]
  }
}

Installed Packages

# User
Remote-FTP, v0.8.3
atom-lupa, v0.5.14
atom-material-ui, v1.2.11
color-picker, v2.1.1
file-icons, v1.7.11
language-babel, v2.20.10
linter, v1.11.4
merge-conflicts, v1.4.2
react, v0.15.0

# Dev
No dev packages
hex13 commented 8 years ago

I suppose you pressed the big red button?

The Hitchhiker's Guide to the Lupa defines Big Red Button as "Index Project" button. I also says that in order to index all files in the project you're gonna need to create lupaProject.json file in root directory of your project, e.g.

{
    "filePattern": "src/**/*.js",
    "autolabels": []
}

https://atom.io/packages/atom-lupa

Although there is some corner case which I haven't handled yet. Before indexing you have to open some file you have in project (e.g. foo.js or bar.js or any file you have) because indexer takes file path from active file and then perform recursive directory search based on path from active file.

This basically means that you're for example in a Atom settings tab and you activate lupa, there will be error: image

And this is a corner case I really need to fix.

But I assume from your message error, that you just haven't created lupaProject.json (unless you've created such file - this would be indeed a bug).

Maybe I'm gonna do some sort of automatic creation of lupaProject.json with default values in case that such file is not found. That would be less confusing.

TL;DR

  1. lupaProject.json have to exist in root directory of your project
  2. before I fix that you need open some project file before you click index project button. This is temporary inconvenience :/
dax70 commented 8 years ago

Thanks, this works. I am still exploring Lupa, great work so far.

A few suggestions, perhaps I'll find time to help with one up if you think they are worthwhile.

hex13 commented 8 years ago

@anri-asaturov fixed this corner case which caused bug when user was in settings #15

Also, make the button create the lupaProj file if it does not exist. I've added auto-creation of lupaProject.json file.

It now creates automatically lupaProject.json if such file doesn't exist. It looks for the .git directory to define what is the root of the project (because user can open file in some deep nested subdirectory e.g. /Users/foo/work/my-project/src/components/animated/Carousel.js and there is a need to figure out somehow what is the root without asking user directly.

Later I'm gonna add detection of other "root indicators" like package.json, .eslintrc or node_modules directory.

Although some projects can have subpackages, where there is a main root with package.json etc. and there are some subpackages with separate package.json files etc.