JoshCheek / atom-seeing-is-believing

Seeing is Believing integration for the Atom text editor.
Do What The F*ck You Want To Public License
62 stars 4 forks source link

Uncaught TypeError: Cannot read property 'add-to-env' of undefined #21

Closed rcyep87 closed 8 years ago

rcyep87 commented 8 years ago

[Enter steps to reproduce below:]

  1. ...
  2. ...

Atom Version: 1.2.3 System: Mac OS X 10.11.1 Thrown From: seeing-is-believing package, v1.7.0

Stack Trace

Uncaught TypeError: Cannot read property 'add-to-env' of undefined

At /Users/ryep/.atom/packages/seeing-is-believing/lib/seeing-is-believing.coffee:89

TypeError: Cannot read property 'add-to-env' of undefined
    at Object.module.exports.SeeingIsBelieving.getVars (/Users/ryep/.atom/packages/seeing-is-believing/lib/seeing-is-believing.coffee:89:5)
    at Object.module.exports.SeeingIsBelieving.removeAnnotations (/Users/ryep/.atom/packages/seeing-is-believing/lib/seeing-is-believing.coffee:149:15)
    at atom-workspace.subscriptions.add.atom.commands.add.seeing-is-believing:remove-annotations (/Users/ryep/.atom/packages/seeing-is-believing/lib/seeing-is-believing.coffee:30:58)
    at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (/Applications/Atom.app/Contents/Resources/app.asar/src/command-registry.js:260:29)
    at /Applications/Atom.app/Contents/Resources/app.asar/src/command-registry.js:3:61
    at KeymapManager.module.exports.KeymapManager.dispatchCommandEvent (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/atom-keymap/lib/keymap-manager.js:533:16)
    at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/atom-keymap/lib/keymap-manager.js:356:22)
    at WindowEventHandler.module.exports.WindowEventHandler.handleDocumentKeydown (/Applications/Atom.app/Contents/Resources/app.asar/src/window-event-handler.js:99:36)
    at HTMLDocument.<anonymous> (/Applications/Atom.app/Contents/Resources/app.asar/src/window-event-handler.js:3:61)

Commands

     -1:27.2.0 seeing-is-believing:remove-annotations (atom-text-editor.editor.is-focused)
     -1:24.2.0 seeing-is-believing:annotate-document (atom-text-editor.editor.is-focused)
     -1:07.5.0 terminal-plus:paste (textarea.)
     -0:58.6.0 seeing-is-believing:annotate-document (atom-text-editor.editor.is-focused)
     -0:00.7.0 seeing-is-believing:remove-annotations (atom-text-editor.editor.is-focused)

Config

{
  "core": {
    "themes": [
      "one-dark-ui",
      "atom-dark-syntax"
    ]
  }
}

Installed Packages

# User
linter, v1.11.2
linter-jshint, v1.2.1
react, v0.12.10
seeing-is-believing, v1.7.0
terminal-plus, v0.14.3
travis-ci-status, v0.18.0

# Dev
No dev packages
JoshCheek commented 8 years ago

Has it ever worked for you? Ie did you update to 1.2.3 and then this occurred, or did you install it for the first time and this occurred?

Your config file is curious in that it is JSON, but I've only ever seen CSON config files (~/.atom/config.json), also the key structure does not match mine, which looks approximately like this (edited to reduce noise from irrelevant config options).

"*":
  core:
    themes: [
      "atom-dark-ui"
      "atom-dark-syntax"
    ]
  "seeing-is-believing":
    "ruby-command": "/Users/josh/code/dotfiles/bin/sib_ruby"
    "add-to-env":
      SHELL: "/bin/bash"

I just updated from 1.2.1 to 1.2.3, and my config file was still cson with this same structure, and SiB still worked. Anyway, I'd assume that if you add the "*" key and the "seeing-is-believing" key that it will work. Ideally we wouldn't have to edit these config files (it's fraught with peril), but I've spent about a week trying to deal with options in Atom, and ultimately decided to set it down for a year or so and try again when I have time / hear it's improved. So, for now, probably check the filenames and ensure the structures match. (You should be able to omit the add-to-env key, but you'll need the "seeing-is-believing" key. My code probably doesn't add it b/c it used to be created by default by Atom itself.

rcyep87 commented 8 years ago

Wow Josh! Thanks for the quick response. I was trying to install it for the first time using the Atom package installer. I was able to get it to work for Sublime but not Atom.

JoshCheek commented 8 years ago

I'm going to guess that the difference is that you ran Atom from something like Spotlight, but sublime from something like the shell. This would cause Sublime to inherit the environment variables that allow it to find your Ruby.

rcyep87 commented 8 years ago

I am going to go ahead and close this. I believe this is user error and not anything wrong with the code. Sorry for the trouble.

danwise91 commented 8 years ago

Hi Josh I am currently getting a similar issue

1. ...
2. ...

**Atom Version**: 1.3.1
**System**: Mac OS X 10.11.1
**Thrown From**: [seeing-is-believing](https://github.com/JoshCheek/atom-seeing-is-believing) package, v1.7.0

### Stack Trace

Uncaught TypeError: Cannot read property 'add-to-env' of undefined

At /Users/danielwise/.atom/packages/seeing-is-believing/lib/seeing-is-believing.coffee:89

TypeError: Cannot read property 'add-to-env' of undefined at Object.module.exports.SeeingIsBelieving.getVars (/Users/danielwise/.atom/packages/seeing-is-believing/lib/seeing-is-believing.coffee:89:5) at Object.module.exports.SeeingIsBelieving.annotateDocument (/Users/danielwise/.atom/packages/seeing-is-believing/lib/seeing-is-believing.coffee:139:17) at atom-workspace.subscriptions.add.atom.commands.add.seeing-is-believing:annotate-document (/Users/danielwise/.atom/packages/seeing-is-believing/lib/seeing-is-believing.coffee:28:58) at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (/Applications/Atom.app/Contents/Resources/app.asar/src/command-registry.js:260:29) at /Applications/Atom.app/Contents/Resources/app.asar/src/command-registry.js:3:61 at KeymapManager.module.exports.KeymapManager.dispatchCommandEvent (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/atom-keymap/lib/keymap-manager.js:536:16) at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/atom-keymap/lib/keymap-manager.js:359:22) at WindowEventHandler.module.exports.WindowEventHandler.handleDocumentKeydown (/Applications/Atom.app/Contents/Resources/app.asar/src/window-event-handler.js:97:36) at HTMLDocument. (/Applications/Atom.app/Contents/Resources/app.asar/src/window-event-handler.js:3:61)


### Commands
 -5:30.6.0 seeing-is-believing:annotate-magic-comments (atom-text-editor.editor.is-focused)
 -3:51.3.0 window:install-shell-commands (atom-text-editor.editor.is-focused)
 -0:00.7.0 seeing-is-believing:annotate-document (atom-text-editor.editor.is-focused)

### Config

``` json
{
  "core": {}
}

Installed Packages

# User
seeing-is-believing, v1.7.0

# Dev
No dev packages

hope theres so help you can give me