AsaAyers / js-hyperclick

A hyperclick provider that lets you jump to where variables are defined.
MIT License
127 stars 42 forks source link

Uncaught TypeError: Cannot read property '0' of undefined #84

Closed chrisvoo closed 7 years ago

chrisvoo commented 7 years ago

[Enter steps to reproduce:]

  1. Just clicked on a variable named config with Command + click. This variable is defined as:
var config = require(`../config/config.${process.env.NODE_ENV}`);
config.secrets.useCredits // here throws error

Atom: 1.20.0 x64 Electron: 1.6.9 OS: Mac OS X 10.13 Thrown From: js-hyperclick package 1.11.0

Stack Trace

Uncaught TypeError: Cannot read property '0' of undefined

At /Users/ccastelli/.atom/packages/js-hyperclick/lib/core/resolve-module.js:92

TypeError: Cannot read property '0' of undefined
    at resolveModule (/packages/js-hyperclick/lib/core/resolve-module.js:92:30)
    at followSuggestionPath (/packages/js-hyperclick/lib/js-hyperclick.js:85:22)
    at Object.callback (/packages/js-hyperclick/lib/js-hyperclick.js:142:11)
    at t.default._confirmSuggestion (/packages/hyperclick/index.js:1:158042)
    at t.default._onMouseDown (/packages/hyperclick/index.js:1:159072)

Commands

  9x -2:15.5.0 core:backspace (input.hidden-input)
     -2:13 core:confirm (input.hidden-input)
  2x -1:33 core:backspace (input.hidden-input)
     -1:27 snippets:next-tab-stop (input.hidden-input)
     -1:27 snippets:expand (input.hidden-input)
     -1:27 editor:indent (input.hidden-input)
     -1:24.5.0 core:backspace (input.hidden-input)
     -1:22.2.0 snippets:next-tab-stop (input.hidden-input)
     -1:22.2.0 snippets:expand (input.hidden-input)
     -1:22.2.0 editor:indent (input.hidden-input)
  2x -1:21 core:backspace (input.hidden-input)
     -1:07.7.0 core:move-right (input.hidden-input)
     -1:07.3.0 core:backspace (input.hidden-input)
     -1:03.3.0 core:save (input.hidden-input)
     -0:52.1.0 core:copy (input.hidden-input)
     -0:21.3.0 intentions:highlight (input.hidden-input)

Non-Core Packages

atom-beautify 0.30.5 
autocomplete-python 1.10.2 
busy-signal 1.4.3 
git-plus 7.9.3 
hyperclick 0.1.5 
intentions 1.1.5 
js-hyperclick 1.11.0 
language-javascript-jsx 0.3.7 
language-pug 0.0.21 
linter 2.2.0 
linter-csslint 2.0.0 
linter-jshint 3.1.5 
linter-json-lint 0.1.2 
linter-markdown 5.2.0 
linter-pug 1.3.1 
linter-pug-lint 0.2.0 
linter-pylama 0.9.4 
linter-ui-default 1.6.8 
node-debugger 1.10.1 
node-resolver2 2.0.2 
Pymakr 1.1.1 
python-indent 1.1.0 
python-tools 0.6.9 
AsaAyers commented 7 years ago

Thanks for the report. I will fix the error, but js-hyperclick isn't going to be able to go open the config file because it's a dynamic import. It should be able to jump from config.secrets.useCredits up however many lines it is to land you on var config