osoco / sublimetext-grails

Grails support for Sublime Text
75 stars 21 forks source link

multiple consecutive ${ in a string on a GSP causes ST2 to hang #11

Closed jonnybot0 closed 11 years ago

jonnybot0 commented 11 years ago

So, I have a gsp with 15 lines and a few fields like this: <g:hiddenField name="someName${i+1}" class="someClass anotherClass${i+1}" value="${entry.key}"/>

i+1 represents the iteration in a g:each loop.

If I try to type a ${ in front of the ${i+1} string (because I want to add another variable), ST2 hangs indefinitely and consumes 99% CPU.

I just got the latest Grails plugin today, though this might exist in previous verions.

gcrick commented 11 years ago

That doesn't sound good! I can't seem to reproduce the problem though, so I need to ask some questions. Does it happen if you copy that line of code to a new file? It is possible that it only happens in certain contexts. What operating system are you on? What color scheme are you using? Do you have any other plugins installed? Does it happen every time, or only occasionally? Thanks!

On Fri, Oct 25, 2013 at 9:59 PM, jonnybot0 notifications@github.com wrote:

So, I have a gsp with 15 lines and a few fields like this: <g:hiddenField name="someName${i+1}" class="someClass anotherClass${i+1}" value="${entry.key}"/>

i+1 represents the iteration in a g:each loop.

If I try to type a ${ in front of the ${i+1} string (because I want to add another variable), ST2 hangs indefinitely and consumes 99% CPU.

I just got the latest Grails plugin today, though this might exist in previous verions.

— Reply to this email directly or view it on GitHubhttps://github.com/osoco/sublimetext-grails/issues/11 .

JohnMurley commented 11 years ago

I was able to reproduce it by removing the space between the two variables in the following:

<div ${var1} ${var2} />

It seems that a workaround for adding a new variable is to put the space in before adding the variable. Removing it later won't work, so it needs to stay. Attempting to open a file missing the space also produces the problem. A patch that got downloaded today appears to be the culprit, as I have a coworker without the patch and theirs still works.

John Murley

jonnybot0 commented 11 years ago

John is correct that entering space (or just about any characters beforehand) helps.

On Monday, October 28, 2013, JohnMurley wrote:

Ok, one more time with the code sample:

<div ${var1} ${var2} />

John

— Reply to this email directly or view it on GitHubhttps://github.com/osoco/sublimetext-grails/issues/11#issuecomment-27261491 .

gcrick commented 11 years ago

I'm sorry, but I'm still unable to reproduce this. Are you talking about a patch to Sublime Text? I am using Sublime Text build 3047 (as far as I can tell, the latest available) from the Ubuntu 64-bit deb installer, and the latest version of the Grails plugin which is 1.0.2. As I understand the problem, simply placing this code in a GSP file should cause the issue:

<div ${var1}${var2} /> 

Correct? Is there any more information you can give me? Thanks!

jonnybot0 commented 11 years ago

Copy and pasting that code in will be fine, actually. The issue happens if you already have tag like this:

Then, move your cursor just before the dollar sign and type another dollar sign and open bracer: ST will hang on the dollar sign. I'll get you my build numbers when I return to my workstation (presently on mobile). Jonny On Sunday, November 3, 2013, gcrick wrote: > I'm sorry, but I'm still unable to reproduce this. Are you talking about a > patch to Sublime Text? I am using Sublime Text build 3047 (as far as I can > tell, the latest available) from the Ubuntu 64-bit deb installer, and the > latest version of the Grails plugin which is 1.0.2. As I understand the > problem, simply placing this code in a GSP file should cause the issue: > >
> > Correct? Is there any more information you can give me? Thanks! > > — > Reply to this email directly or view it on GitHubhttps://github.com/osoco/sublimetext-grails/issues/11#issuecomment-27641911 > .
jonnybot0 commented 11 years ago

Okay, so I'm using Sublime Text Build 2221 with the Grails 1.0.2 package. It could be that the issue doesn't exist in the 3.x builds of Sublime Text, which it looks like you're using. So, this bug may be peculiar to Sublime Text 2.

On Mon, Nov 4, 2013 at 8:37 PM, Jonny jonteh1337@gmail.com wrote:

Copy and pasting that code in will be fine, actually. The issue happens if you already have tag like this:

Then, move your cursor just before the dollar sign and type another dollar sign and open bracer: ST will hang on the dollar sign. I'll get you my build numbers when I return to my workstation (presently on mobile). Jonny On Sunday, November 3, 2013, gcrick wrote: > I'm sorry, but I'm still unable to reproduce this. Are you talking about > a patch to Sublime Text? I am using Sublime Text build 3047 (as far as I > can tell, the latest available) from the Ubuntu 64-bit deb installer, and > the latest version of the Grails plugin which is 1.0.2. As I understand the > problem, simply placing this code in a GSP file should cause the issue: > >
> > Correct? Is there any more information you can give me? Thanks! > > — > Reply to this email directly or view it on GitHubhttps://github.com/osoco/sublimetext-grails/issues/11#issuecomment-27641911 > .
gcrick commented 11 years ago

Ok, thanks, I was able to reproduce the problem with build 2221. Since it doesn't happen in ST 3, I suspect there is some sort of bug in the regular expression engine of ST 2. For me, it isn't actually the ${ that causes ST to hang, it is the } (which may be inserted automatically after typing the opening brace). For example, it hangs with just }${var1} as well. I just released an update to the plugin that should prevent the problem (1.0.3), please let me know if you still have trouble after updating.