PHPstorm autocomplete misbehaving with jQuery calls with a colon in the selector

When I type the following:

$(".cls


the ending quote is already filled in, closing the quote will skip over the one that's already there, but when I type this:

$(".cls:eq(0)


and then close the qoute PHPStorm will add two quotes, so I end up with this:

$(".cls:eq(0)""")


which is not correct... Does anybody know how to solve this? Recently switched from 6 to 7.1.2. Of course skipping the quote with the cursor would solve this, but it is a distraction from programming if you have to think about skipping a quote with a cursor in case I'm making a jQuery call with a colon in the selector (cause that seems to cause it)..

19 comments

Hello!

can't recreate. Does the error occur when editing .js file, or when editing javascripot embedded in HTML/PHP? Can you record a screencast that shows up the issue?

0

I just replicated the problem. Create a 'new file' called "test.html", enter

<script>

the </script> will be automatically added by PHPStorm. Now press 'enter' and type:

$(".cls:eq(0)"

PHPStorm will auto-complete this as: $(".cls:eq(0)""") (it adds two quotes on the end of the one you typed)

Hope this helps!

0

The same problem occurs when typing this:

     $("test>blabla"

you end up with

     $("test>blabla"""

0

... and found another one...

type this: $("#list tbody"
and you end up with this: $("#list tbody"""

No replies at all huh? Does JetBrains look at their forum?

0

I have already replied to you in the support ticket and here, asking you for a screencast and settings, as I can't recreate the problem using your steps. And haven't hear anything back from you yet.

0

...to which my reply was a way to replicate, you never replied to that...

but thanks for getting back to me. I don't have screencast software set up here... sorry... Is there an easy way to save my settings to be able to share that with you?

0

Thanks! recreated. But I'm not sure what you'd expect here. The closing quote is already there - what's the reason for typing its once more? Do you expect existing quote to be deleted when you type another one? Note that you can turn 'Insert pair quote' (Settings/Editor/Smart keys) off to avoid auto-creating the closing '"'

0

I would expect to see IDE behaving the same as in plain JavaScript or PHP -- to have 2nd quote "eaten"/ignored, just like IDE behaves in this kind of situation (press double quote in cursor position):


var jjj = "meow[CURSOR]";
var mmm = document.getElementById("mmm[CURSOR]");

0

One of the reasons I skipped from my 'old' IDE to PHPStorm was exactly this feature (amongst other things of course). It's a great feature, and does a good job of keeping track of opening and closing quotes when creating more complex strings.

I want it to behave consisten... Check the video (getting the hang of that now)



Attachment(s):
jetbrains.mp4
0

Another auto-complete problem with quotes... See attached...

When you're writing a URL like this:

<a href=

the IDE will automatically add two quotes and puts the cursor in the middle. Once the URL is typed in and you type the ending quote the quote put in by the IDE gets eaten... perfect!!

but in scripting you sometimes need to put a URL in a string... So then you type

var str="<a href=

PHPStorm then turns that into

var str="<a href="[CURSOR]"" which wouldn't work 'cause of the unescaped double quotes.

Better would be to either escape the quotes:

     var str="<a href=\"[CURSOR]\""

... or make single quotes:

    var str="<a href='[CURSOR]'"



Attachment(s):
jetbrains.mp4
0

It works just in the same way in 'embedded' javascript. When the 'extra' quote is typed as a part of currently entered word, it's 'eaten'. But as soon as you enter a whitespace, enter a new word and then hit '"', 2 quotes are added

See attached screencast



Attachment(s):
screencast.mp4
0

I'm unable to watch it on my work PC (Windows 7 x64 SP1) with default Windows Media Player -- no video for some reason (P.S. no extra codecs installed)

But I have tried this code .. and it worked OK in v8 EAP (134.1456)

var messageOne = document.createElement("p p hh. dddd");
var zzz = "meow meow";

0

Works for document.createElement, but not for JQuery - in first case the entered string is just a string, in the second case CSS is auto-injected

See http://youtrack.jetbrains.com/issue/WEB-8309 and related tickets

0

Ah, good, that one's tracked. The first one reported here, is there a bug issue created for that as well?

Installing PHPStorm 8 now, see if that doesn't have the same problem..

0

Just installed PHPStorm 8 EAP, the problem reported here seems to have been fixed in that version! Good job!

0

Please sign in to leave a comment.