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 248031 - Option to disable "Remove Surrounding Tag" and "Surrond With Tag" hints
Summary: Option to disable "Remove Surrounding Tag" and "Surrond With Tag" hints
Status: NEW
Alias: None
Product: web
Classification: Unclassified
Component: HTML Editor (show other bugs)
Version: 8.0
Hardware: PC Windows 7
: P4 normal (vote)
Assignee: Milutin Kristofic
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-10-20 00:48 UTC by dhinged
Modified: 2017-10-12 05:42 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Hint validation says valid label is invalid. (15.26 KB, image/png)
2014-10-20 00:48 UTC, dhinged
Details

Note You need to log in before you can comment on or make changes to this bug.
Description dhinged 2014-10-20 00:48:33 UTC
Created attachment 149988 [details]
Hint validation says valid label is invalid.

I have a label tag above a select tag that is showing the light bulb to the left of it on the line number bar, and when I hover over the light bulb, a pop-up says "Remove Surrounding Tag". If I click it or hit Alt+Enter, it shows an option "Remove Surrounding Tag", and if I click it, it totally strips the tag and just leaves the inner content.

Example:

<label for="ci_form_URL">Website</label>
<input id="ci_form_URL" maxlength="80" name="URL" size="20" type="text" />

<label for="ci_form_industry">Industry</label>
<select id="ci_form_industry" name="industry">
	<option value="1">one</option>
	<option value="2">two</option>
	<option value="3">three</option>
</select>

The first label for Website does not have the light bulb; the second label does. I can't explain this and it's irritating having apparently invalid hints where the solution breaks something, and also the pop-up shows just when I hover over the code, which I can't disable (I would be OK with the pop-up only appearing when I hover over the light bulb).
Comment 1 Vladimir Riha 2014-10-20 07:50:22 UTC
There is nothing invalid about the hint, it just offers to remove surrounding (parent) tag. It does not say anything about validity of your HTML code. If you want to "safely" remove start and end tags, this hint helps you.

But there is no way to disable it, which could be I guess.
Comment 2 dhinged 2014-10-21 03:29:27 UTC
What do you mean there's nothing invalid about the hint? There's no reason why it should even be there! Why is it there? Why is only on that label and not the one before it? Why is it telling me the code is invalid or offering to strip the tag? It's completely pointless at best.
Comment 3 Vladimir Riha 2014-10-21 05:45:45 UTC
(In reply to dhinged from comment #2)
> Why is only on that label and not the one before it?

With your snippet code, I see the hint in both cases. If you see it in only one case, please attach the file and describe exactly what you are doing (where did you place cursor, if you select piece of code etc.)

> Why is it telling me the code is invalid or offering
> to strip the tag? 

But it is not telling you that your code is invalid. It says nothing about validation. It is just hint to quickly remove surroundings tags. Imagine that you have e.g. following

<div>
   // cursor here
   ...many lines...
   <div>test</div>
</div>

and that the parent div is not entirely visible in NetBeans editor because it is too "long" (too many lines in editor so you don't see start and end tag at the same time). Instead of careful scrolling and deleting first opening and then closing tag, you can just place cursor inside the parent div (e.g. 2nd line in the snippet above) and use the hint to remove the parent div.

I agree there should be a way to disable it, just like with other hints, but it says nothing about validation. Have a look at java, it has a lot of "similar" hints like to revert if condition and so on.
Comment 4 dhinged 2014-10-22 10:55:23 UTC
I bring up the file again and the "hint" I specified are gone now, so it seems to have just glitched the last time it was open.

Whether it's validation or not, the option to disable this HTML hint is in Tools > Options > Editor > Hints > HTML Validator, so whether it's actually validation or not was not clear since the hint checkbox is in a section labeled "Validator". 

Since I don't know all the rules of HTML, it's impossible for me to tell whether a hint is just a NetBeans hint (as determined by the developers) or a bit of invalid HTML. I definitely can tell you that the hint was not useful, and in the way. I do try to look for invalid code (colored lines on the right, so it's confusing to have arbitrary "hints" and actual "invalid HTML warnings" look indistinguishable. I'm not even sure which options to uncheck on the "HTML Validator" checklist that are just NetBeans hints and actual HTML validation.

The point is, I got a hint suggesting to remove HTML that was supposed to be there, was not invalid, and had no reason to be removed. That's the first problem; the second is that the hint message pops up over the code above where I'm hovering, obscuring things I might want to look at so I have to be careful where I put my mouse. When I'm dealing with dozens or hundreds of different elements or attributes, it's easier sometimes for me to follow it with my mouse and not have code above obscured.
Comment 5 nbsocko 2017-10-12 05:42:49 UTC
I agree that disabling this hint should most definitely be an option.  It shows up so often that it becomes almost obligatory to ignore it.  Empty surrounding div tags are extremely common, and often necessary if not highly useful for many reasons in good web design.  This causes the light bulb to appear on nearly every line of my HTML/PHP documents, forcing me ignore the hint icon altogether when a useful hint could be hidden behind this absolutely useless one.