This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 200276 - JQuery Dollar Sign ($) Code Completion for IDs and Classes not Working in PHP files
Summary: JQuery Dollar Sign ($) Code Completion for IDs and Classes not Working in PHP...
Status: VERIFIED FIXED
Alias: None
Product: javascript
Classification: Unclassified
Component: Editor (show other bugs)
Version: 7.0
Hardware: PC Windows 7 x64
: P2 normal (vote)
Assignee: Petr Pisl
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-07-21 03:51 UTC by influencebydesign
Modified: 2011-09-23 08:43 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description influencebydesign 2011-07-21 03:51:45 UTC
In PHP files the dollar sign code completion doesn't offer suggestions of IDs and Classes as it does in HTML files. 


So the following code ( "|" = current position ) would offer no suggestions if it was in a php file, but would in an html file.

-----
<div id="box">

</div>

<script type="text/javascript">

$(|).hide();

</script>
-----

This is a major hindrance to my workflow. Thanks for any help you can provide.
Comment 1 Marian Mirilovic 2011-07-22 07:06:59 UTC
Petr, could somebody evaluate this issue ASAP ? Thanks in advance.
Comment 2 Marek Fukala 2011-07-22 15:19:07 UTC
I suppose the correct code sample is:

$("|").hide();

... the caret it inside a string literal.

In this case the jquery completion works fine in html files, but anywhere else it doesn't.

Just from a quick glimpse to the code I found:

JsCodeCompletion:881:
...
    private void addElementIds(final List<CompletionProposal> proposals, final CompletionRequest request, final String prefix) {
        Source source = request.info.getSnapshot().getSource();
        if (source.getMimeType().equals(JsUtils.HTML_MIME_TYPE)) {
...

which clearly says it won't work anywhere else then in text/html mimetype files. The same condition is used for classes and tag names. It is there from the year 2008.

Even if this is quite nasty bug it is not P1 at all => downgrading. I'll fix it i 7.1 repository a bit later.
Comment 3 influencebydesign 2011-07-22 16:56:52 UTC
Thanks!

So what does that translate to in terms of seeing a useable fix?
Comment 4 Petr Pisl 2011-09-15 15:37:17 UTC
Fixed in web-main
http://hg.netbeans.org/web-main/rev/9680be90d6c4

Reporter could you please test it in the next daily build. Thanks.
Comment 5 Quality Engineering 2011-09-17 14:16:59 UTC
Integrated into 'main-golden'
Changeset: http://hg.netbeans.org/main-golden/rev/9680be90d6c4
User: Petr Pisl <ppisl@netbeans.org>
Log: #200276 - JQuery Dollar Sign ($) Code Completion for IDs and Classes not Working in PHP files
Comment 6 Vladimir Riha 2011-09-23 08:43:35 UTC
Verified, it works the same way in php and html files, but I found #202539 (autocompletion is performed instead of simple completion).

Product Version: NetBeans IDE 7.1 Beta (Build 201109222201)
Java: 1.7.0; Java HotSpot(TM) Client VM 21.0-b17
System: Linux version 2.6.38-11-generic running on i386; UTF-8; en_US (nb)