drewda / cucumber-sublime-bundle

Sublime bundle for Cucumber
65 stars 26 forks source link

Auto-complete causes Sublime to hang if cursor is not in step #26

Closed mrliptontea closed 9 years ago

mrliptontea commented 9 years ago

When I bring up auto-complete manually in any other line than the one defining a step, for example if I try to auto-complete a word in the feature name or feature description, Sublime Text hangs. I've tried to wait for few minutes to look if it ever finishes whatever it's doing, but it never does.

I'm not sure why is this happening, I've added print('foo') at the beginning of on_query_completions, opened the console but it was never reached.

I'm using Sublime Text 3, build 3083, Windows x64.

mrliptontea commented 9 years ago

The while loop's condition is incorrect.

First of all, there should be and, not or because it should break if any of this is true. The break word at line 130 is not necessary. Secondly, sel.b never reaches -1. So this will turn to infinite loop always if a current line does not contain the keywords given|when|then, which is bad for i18n support.

drewda commented 9 years ago

@mrliptontea thanks for reporting this error. Could you open a pull request with your proposed fix?

mrliptontea commented 9 years ago

I need to look into this, as I don't understand all the parts of this code. To fix all the issues I've noticed here it might require a rewrite of quite a bit.

danielkza commented 9 years ago

I'm still seeing this, makes the plugin completely unusable. Any chance to merge that PR?

maciejmyslinski commented 9 years ago

It happends me too. OSX.

drewda commented 9 years ago

A belated "thank you" for your fix, @mrliptontea.