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 224413 - Warning on Current Line 'Global variable is not defined' doesn't work
Summary: Warning on Current Line 'Global variable is not defined' doesn't work
Status: VERIFIED FIXED
Alias: None
Product: javascript
Classification: Unclassified
Component: Editor (show other bugs)
Version: 7.3
Hardware: PC Linux
: P2 normal (vote)
Assignee: Petr Pisl
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-01-03 10:16 UTC by Petr Pisl
Modified: 2013-01-18 07:18 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 Petr Pisl 2013-01-03 10:16:11 UTC
This issue influence probably all csl editor (I have tried PHP and Javascript). If user switch the severity of a hint to Warning on Current Line, the warning is not displayed.
Comment 1 Svata Dedic 2013-01-03 13:43:37 UTC
Negative; I've configured e.g. Unused Variables and Unitialized Variables as Warning on Current Line, and I am still able to see them in the left sidebar (assignment from an uninitialized, undeclared variable).

Please provide more detailed info.
Comment 2 Vladimir Riha 2013-01-08 11:23:18 UTC
I can reproduce it as well in PHP.

- have following source:
<?php 

$test = 1;
$test = 1;
?>

- in IDE settings for hint, change Immutable Variables PHP hint to "Warning on current line" and confirm
- back in editor, place cursor to either one of the line with $test

=> no hint, the same goes for Uninitialized Variables hint


Product Version: NetBeans IDE Dev (Build web-main-9657-on-20130108)
Java: 1.7.0_10; Java HotSpot(TM) Client VM 23.6-b04
Runtime: Java(TM) SE Runtime Environment 1.7.0_10-b18
System: Linux version 3.2.0-35-generic-pae running on i386; UTF-8; en_US (nb)
Comment 3 Svata Dedic 2013-01-09 13:03:50 UTC
Ehm ... well, PHP calls HintsManager.getHints(onLine = false, ruleContext). This means it will receive all enabled hints EXCEPT warning on current line. The PHP Hints provider never calls HintsManager.getHints(onLine = true, ruleContext) - in fact getHints() is never called with onLine parameter se to true at all. 

So EL, JS, HTML should suffer from the same problem.

Passing in true as onLine parameter will cause ONLY the warning-on-current-line to be returned.

The motivation of the API design is (probably - no comments or javadocs present) to save computation time, so WOL hints must be probably processed specially, so they are only executed on the caret current line text.
Comment 4 Svata Dedic 2013-01-09 13:13:55 UTC
Sorry I've returned the defect to the wrong product. The relevant bug in PHP is a P3 - issue #143677.
Comment 5 Petr Pisl 2013-01-15 14:55:41 UTC
This issue was originally motivated due to the fact that the hint "The global variable is not defined" has by default the severity "Warning on Current line". So this hint stop the work with the default value. I have change a little the infrastructure of hints in JS Editor and now it allows implement hints that are able to work with caret offset, which is required when a hint has the mentioned severity. I have also changed hint "The global variable is not defined" that is able to work in all cases. So now the hint should work.

The change is here: http://hg.netbeans.org/web-main/rev/fb91b59a4577
Comment 6 Quality Engineering 2013-01-16 02:43:37 UTC
Integrated into 'main-golden', will be available in build *201301160001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/fb91b59a4577
User: Petr Pisl <ppisl@netbeans.org>
Log: #224413 - Warning on Current Line doesn't work
Comment 7 Petr Hejl 2013-01-16 09:42:23 UTC
The fix seems to be fine.
Comment 8 Vladimir Riha 2013-01-16 10:03:20 UTC
verified in trunk

Product Version: NetBeans IDE Dev (Build 201301160001)
Java: 1.7.0_10; Java HotSpot(TM) Client VM 23.6-b04
Runtime: Java(TM) SE Runtime Environment 1.7.0_10-b18
System: Linux version 3.2.0-35-generic-pae running on i386; UTF-8; en_US (nb)
Comment 9 Petr Pisl 2013-01-16 10:34:52 UTC
The fix integrated into release73 branch:
http://hg.netbeans.org/releases/rev/c14370ebd980
Comment 10 Quality Engineering 2013-01-17 00:01:02 UTC
Integrated into 'releases', will be available in build *201301162100* or newer. Wait for official and publicly available build.
Changeset: http://hg.netbeans.org/releases/rev/c14370ebd980
User: Petr Pisl <ppisl@netbeans.org>
Log: #224413 - Warning on Current Line doesn't work
(transplanted from fb91b59a457792f17579516aa54839fba805aeb8)
Comment 11 Vladimir Riha 2013-01-18 07:18:03 UTC
verified in RC1

Product Version: NetBeans IDE 7.3 RC1 (Build 201301172100)
Java: 1.7.0_10; Java HotSpot(TM) Client VM 23.6-b04
Runtime: Java(TM) SE Runtime Environment 1.7.0_10-b18
System: Linux version 3.2.0-35-generic-pae running on i386; UTF-8; en_US (nb)