harikt / php-hyperclick

PHP hyperclick package for atom text editor, open your php files on the go
MIT License
19 stars 6 forks source link

Uncaught TypeError: Cannot read property '1' of null -> Atom v1.13.3 x64 Dedian #13

Open OliverTweett opened 7 years ago

OliverTweett commented 7 years ago

[Enter steps to reproduce:]

  1. ...
  2. ...

Atom: 1.14.3 x64 Electron: 1.3.13 OS: Ubuntu 16.04.2 Thrown From: php-hyperclick package 1.2.1

Stack Trace

Uncaught TypeError: Cannot read property '1' of null

At /home/olivier/.atom/packages/php-hyperclick/lib/php-hyperclick-package-view.coffee:42

TypeError: Cannot read property '1' of null
    at Object.callback (/packages/php-hyperclick/lib/php-hyperclick-package-view.coffee:42:13)
    at HyperclickForTextEditor._confirmSuggestion (/packages/hyperclick/lib/HyperclickForTextEditor.js:124:20)
    at HyperclickForTextEditor._onMouseDown (/packages/hyperclick/lib/HyperclickForTextEditor.js:198:14)

Commands

Non-Core Packages

atom-autocomplete-php 0.22.0 
autocomplete-php 0.3.7 
hyperclick 0.0.40 
linter 1.11.23 
minimap 4.26.8 
php-hyperclick 1.2.1 
php-integrator-autocomplete-plus 1.2.0 
php-integrator-base 2.1.10 
php-integrator-linter 1.3.0 
php-integrator-navigation 1.1.2 
php-integrator-tooltips 1.1.5 
project-manager 3.3.3 
Remote-FTP 0.10.5 
harikt commented 7 years ago

Thank you for reporting.

I will look into it.

OliverTweett commented 7 years ago

Maybe I have to install the previous version of Atom?

harikt commented 7 years ago

I am using 1.13.0 . I will download the latest one and try.

Sorry for the delay.

OliverTweett commented 7 years ago

No problem, OK thanks

harikt commented 7 years ago

I have downloaded the latest version. No errors reported. May be you can deactivate packages that are not used by php-hyperclick and see what cause the issue.

harikt commented 7 years ago

@OliverTweett can you show me what code caused the issue, so I can replicate the same ?

OliverTweett commented 7 years ago

Ok, I'll check. I make you a feedback thank you

jackwilsdon commented 7 years ago

I'm experiencing the same issue. Disabled all of my packages except hyperclick and php-hyperclick.

You can find the files I used for testing here. I simply put them into a folder and added the folder as a project folder before CTRL clicking TestClass in other.php.

Atom version 1.17.0

Package list (including disabled)

atom-css-comb@3.1.0
atom-handlebars@1.3.0
atom-live-server@2.1.2
auto-detect-indentation@1.3.0
busy-signal@1.4.1
hey-pane@1.0.0
hyperclick@0.0.40
intentions@1.1.2
js-hyperclick@1.11.0
less-than-slash@0.16.0
linter@2.1.4
linter-csslint@1.3.4
linter-php@1.3.2
linter-sass-lint@1.7.4
linter-ui-default@1.6.0
php-hyperclick@1.2.1
sync-settings@0.8.1
toggler@0.3.0
vim-mode-plus@0.92.1
vim-mode-plus-ex-mode@0.9.0
vim-mode-plus-keymaps-for-surround@0.2.1
jackwilsdon commented 7 years ago

Turns out this is due to PHP not being installed on the system or not in Atom's path.

varunsridharan commented 7 years ago

Hi, All

I am facing the same issue. can you please help on fixing this ?

`[Enter steps to reproduce:]

  1. ...
  2. ...

Atom: 1.18.0 x64 Electron: 1.3.15 OS: Microsoft Windows 10 Home Single Language Thrown From: php-hyperclick package 1.2.1

Stack Trace

Uncaught TypeError: Cannot read property '1' of null

At C:\Users\varun\.atom\packages\php-hyperclick\lib\php-hyperclick-package-view.coffee:42

TypeError: Cannot read property '1' of null
    at Object.callback (/packages/php-hyperclick/lib/php-hyperclick-package-view.coffee:42:13)
    at _confirmSuggestion (/packages/hyperclick/index.js:1:158772)
    at _onMouseDown (/packages/hyperclick/index.js:1:159802)

Commands

     -4:28.1.0 core:backspace (input.hidden-input)
     -3:33.7.0 docblockr:parse-tab (input.hidden-input)
     -3:33.7.0 snippets:next-tab-stop (input.hidden-input)
     -3:33.7.0 snippets:expand (input.hidden-input)
     -3:33.7.0 editor:indent (input.hidden-input)
     -3:30.6.0 docblockr:parse-enter (input.hidden-input)
     -3:29.1.0 intentions:highlight (input.hidden-input)
     -3:28.2.0 core:undo (input.hidden-input)
     -3:27.4.0 intentions:highlight (input.hidden-input)
     -3:27.3.0 core:undo (input.hidden-input)
     -3:26.8.0 intentions:highlight (input.hidden-input)
     -3:26.7.0 core:undo (input.hidden-input)
     -3:06.1.0 intentions:highlight (input.hidden-input)
     -2:20.2.0 core:backspace (div.package-detail.panels-item)
  5x -2:09.8.0 intentions:highlight (input.hidden-input)
     -0:57.9.0 core:backspace (input.hidden-input)

Non-Core Packages

atom-beautify 0.30.3 
atom-bracket-highlight 0.3.2 
autoclose-html 0.23.0 
autocomplete-php 0.3.7 
busy-signal 1.4.3 
color-picker 2.2.5 
docblockr 0.10.5 
file-icons 2.1.8 
highlight-line 0.12.0 
highlight-selected 0.13.1 
hyperclick 0.1.2 
hyperclick-php 0.2.1 
intentions 1.1.2 
linter 2.2.0 
linter-php 1.3.2 
linter-ui-default 1.6.2 
php-hyperclick 1.2.1 

`

harikt commented 7 years ago

Hi,

Can anyone do a

console.log output

Just before the line 42 .

https://github.com/harikt/php-hyperclick/blob/299c3bc4b614d0a9412502a96d02556ccc19d4eb/lib/php-hyperclick-package-view.coffee#L42

( You can edit the source location on your computer manually and test this )

I guess the output doesn't have the value as expected.

In that case we may need to wrap around a if statement.

Thank you

varunsridharan commented 7 years ago

@harikt Here you go. i have no idea what got in result so i am posting it as a image.

screen1 screen2

harikt commented 7 years ago

Hey @technofreaky ,

Basically you want to do only console.log output I am wrong here. Thank you for the picture.

But I see the output from the console seems to be null.

As I mentioned I can add a check whether the output is null before trying to convert to string . If you can send a PR I can also merge the same.

UPDATE :

Some code that may fix this issue. Not tested, so you may want to test more on this and modify somethings.

presult = child_process.spawnSync('php', args)
if presult.output 
    openFilePath = presult.output[1].toString('ascii')
varunsridharan commented 7 years ago

hi thanks for your reply but i am not good @ JS :(

harikt commented 7 years ago

No issues. I will fix this my self when I get some time.

Can you provide some information, how we can replicate this ? Like you opened the editor with x contents. Clicking on the line y over the word z breaks.

Wished if the contents are real. So easy to reproduce.

Thank you.

varunsridharan commented 7 years ago

sure i just installed this addon and opened one of my php project which is build in CodeIgniter

and i tried to click 1 of my extended class like

MyClass extends BClass

i pressed ctrl + left mouse btn on BClass word and then i got that error.

harikt commented 7 years ago

Does it have a vendor/autoload.php file ?

varunsridharan commented 7 years ago

No it dose not.

harikt commented 7 years ago

ok. ie the main problem.

This project relies on composer and its autoloader.

Either you need to create one and map as I mentioned in https://github.com/harikt/php-hyperclick#making-composer-an-optional-dependency .

Or if you have composer installed and mapped the autoloading in composer.json , you can do a

composer dumpautoload
varunsridharan commented 7 years ago

ho ok

i am sorry about that :( thanks for the info

harikt commented 7 years ago

@technofreaky no problem. Even though composer is not there, as I mentioned on the docs, if you can create a file vendor/autoload.php which can understand where the class is located this will open the file.