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.
System: Product Version: NetBeans IDE Dev (Build 200808120201) Java: 1.5.0_13; Java HotSpot(TM) Client VM 1.5.0_13-119 System: Mac OS X version 10.5.4 running on i386; MacRoman; en_US (nb) Problem: In the Editor, Hints panel for PHP, the "Show As warning on current line" does nothing. Sometimes changing the Show as to error or warning and accepting so the hint is shown in the editor, then changing the option back to Show as warning on current line will show the hint at the current line.
Steps: 1. Create new PHP application 2. In the NetBeans options set Hints for PHP to include Unknown Function under experimental 3. For the Show as leave as Warning 4. In index.php add a non-existent function call foo(); warning is shown 5. Go back to the Hints options and change to Show as Warning on Current Line and press OK 6. No warning for for foo();
reproducible, probably a P2. The problem is located in the GSF (or possibly editor) infrastructure, reassigning
This is a PHP bug - your HintsProvider's "computeSuggestions" method isn't implemented (it's an empty stub - ditto for computeSelectionHints, though that isn't a problem since users cannot convert hints to selection hints like they can for suggestions, so you only run into this once you try to implement a selection hint (like extract method / introduce variable / etc.) computeSuggestions() is the method that is supposed to compute caret-sensitive hints. (Yeah, the name could be better... this is the same as it is for Java. I think the idea is that caret-sensitive hints are typically for "errors" that are really suggestions, e.g. when you in Ruby place your caret on something like "if !x", it offers ("suggests") to convert it to "unless x". computeHints() on the other hand are for errors that really are errors no matter where the caret is.) There are a lot of warning-on-current-line suggestions in Ruby, so you can test these there to see how it works.
Assigning back to Tomasz.
I don't see how this bug is related to "suggestions". I think it is about the GSF UI for setting priority for individual hints ("show as: error/warning/warning on current line"). If it is not possible to set up ordinary hints (as opposed to suggestions) to show as "warning on current line" this option should not be available. Or am I getting something wrong? I am reassigning back to GSF. PS. Possibly this is not a P2 after all
> Or am I getting something wrong? Yes - you must implement computeSuggestions(), it isn't optional. A suggestion is simply a hint which is only enabled for the current line. Therefore, changing a "hint" to "warning on current line" is actually making it a suggestion. (This is also why the option works fine for Ruby and JavaScript and not PHP: they implement computeSuggestions.) Typically, you just look at the caret position, compute the AST path from the root down to this caret position, and then run all the rules that have nodetypes matching this path. (This also explains why "Warning On Current Line" isn't just something that's handled by GSF. It -could- run ALL rules on the entire buffer, and then just simply quietly filter out any hints that aren't on the current line. But that could be very expensive. The advantage of suggestions is that they are actually only run when the caret intersects an AST node for a rule corresponding to a suggestion.) We could optionally let a hints provider say whether it refuses to implement suggestions, and therefore the UI could refuse to let you change a hint into a suggestion (which is what changing from Error/Warning to Warning On Current Line does) - but that isn't there today, and I'm not sure it's a good idea. There are times when you think a hint is "too noisy" but you're willing to see it when you are touching code that is affected by the rule. P.S. Yes, the whole UI concepts around warnings/suggestions are a bit fuzzy and could need some clearing up. But I believe we're doing roughly the same thing as the Java module here.
reassigning to default owner
batch reassigning
Still reproducible in 7.1.
Still valid in 7.3dev. Hints infrastructure should be rewritten a bit to allow computeSuggestions() method to handle manager.getHints(true, ...) (common hints which should be visible only on current line) properly.
Fixed in web-main #8304e2548596