Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extract for loop as method throws: Uncaught TypeError: Cannot read property 'some' of undefined #458

Open
iwasherefirst2 opened this issue Nov 26, 2018 · 1 comment
Labels

Comments

@iwasherefirst2
Copy link

iwasherefirst2 commented Nov 26, 2018

Hi,

I installed the plugin and everything works fine. I also can extract methods.
Except when I try to select a for loop like this:

  for ($i=0; $i < 20; $i++) {
      $this->roll(0);
    }

If I click alt+m and enter a name for the extracted method and hit extract, atom scrolls to the bottom but no new method is inserted. Now for each click in the document the following error message is thrown:

Uncaught TypeError: Cannot read property 'some' of undefined

grafik

/usr/share/atom/resources/app/static/<embedded>:11
Hide Stack Trace
TypeError: Cannot read property 'some' of undefined
    at SnippetExpansion.t.exports.SnippetExpansion.cursorMoved (/usr/share/atom/resources/app/static/<embedded>:11:948501)
    at /usr/share/atom/resources/app/static/<embedded>:11:947907
    at Function.simpleDispatch (/usr/share/atom/resources/app/static/<embedded>:11:1186173)
    at Emitter.emit (/usr/share/atom/resources/app/static/<embedded>:11:1187614)
    at Selection.markerDidChange (/usr/share/atom/resources/app/static/<embedded>:11:543689)
    at Selection.marker.onDidChange.e (/usr/share/atom/resources/app/static/<embedded>:11:528938)
    at Function.simpleDispatch (/usr/share/atom/resources/app/static/<embedded>:11:1186173)
    at Emitter.emit (/usr/share/atom/resources/app/static/<embedded>:11:1187614)
    at DisplayMarker.t.exports.DisplayMarker.notifyObservers (/usr/share/atom/resources/app/static/<embedded>:14:3181496)
    at /usr/share/atom/resources/app/static/<embedded>:14:3176998
    at Function.simpleDispatch (/usr/share/atom/resources/app/static/<embedded>:11:1186173)
    at Emitter.emit (/usr/share/atom/resources/app/static/<embedded>:11:1187614)
    at Marker.t.exports.Marker.emitChangeEvent (/usr/share/atom/resources/app/static/<embedded>:14:67803)
    at Marker.t.exports.Marker.update (/usr/share/atom/resources/app/static/<embedded>:14:66857)
    at Marker.t.exports.Marker.setHeadPosition (/usr/share/atom/resources/app/static/<embedded>:14:63016)
    at DisplayMarker.t.exports.DisplayMarker.setHeadBufferPosition (/usr/share/atom/resources/app/static/<embedded>:14:3178851)
    at DisplayMarker.t.exports.DisplayMarker.setHeadScreenPosition (/usr/share/atom/resources/app/static/<embedded>:14:3179083)
    at changePosition (/usr/share/atom/resources/app/static/<embedded>:11:519079)
    at Cursor.changePosition (/usr/share/atom/resources/app/static/<embedded>:11:527504)
    at Cursor.setScreenPosition (/usr/share/atom/resources/app/static/<embedded>:11:519045)
    at moveCursors.n (/usr/share/atom/resources/app/static/<embedded>:11:30282)
    at Array.forEach (<anonymous>)
    at transact (/usr/share/atom/resources/app/static/<embedded>:11:33144)
    at TextBuffer.transact (/usr/share/atom/resources/app/static/<embedded>:11:489188)
    at TextEditor.transact (/usr/share/atom/resources/app/static/<embedded>:11:24215)
    at TextEditor.moveCursors (/usr/share/atom/resources/app/static/<embedded>:11:33112)
    at TextEditor.setCursorScreenPosition (/usr/share/atom/resources/app/static/<embedded>:11:30265)
    at TextEditorComponent.didMouseDownOnContent (/usr/share/atom/resources/app/static/<embedded>:11:95495)

This is what I tried so far:

  • Tried it on Atom 1.31.2
  • Tried it on latest release Atom 1.32.2
  • Deinstalled the plugin and reinstalled it
  • Restarted my PC and Atom
  • Created a new projekt and initialized a new Serenate projekt
  • Tried it in different files

Every time I could reproduce the issue. I am using Ubuntu 18.04.

Also I noticed, that whenever I extract a method, the method is inserted at the bottom of the file below the class. So I actually always need to copy and paste the method from outsite to inside of my class. Is this intended?

@Gert-dev
Copy link
Owner

Definitely not intentional, though the refactoring code is somewhat outdated since it has been pending to be replaced with server-side refactoring functionality for a while and I must admit I don't use the method extraction functionality that often, hence the minor bugs that are creeping up.

Marking as bug, since this should be fixed at some point - either by fixing it in the current implementation or providing the new, server-side implementation that doesn't have this bug.

@Gert-dev Gert-dev added the bug label Dec 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants