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.
It would help if the new 'start brace tooltip' that appears when the cursor is on a closing brace } would show not just the line where the opening brace is, but also the surrounding lines, this especially if the brace is the sole character of the line.
Do you have some ideas on how the "suitable" context (# of preceding / following lines) should be determined ? What is the use-case which you encountered and the one-line tooltip didn't fit (I assume you missed some important info in the tooltip, and filed the ENH request because of that :)
Here is a sample: void foo() { if (sometest()) { // enough code to have the tooltip showed }| } With the current implementation a single line with { is shown, with a line before and after I would see "if (sometest())" which would tell me which block the } is closing. How many lines to show, I'd say the first non empty before and the first non empty after would usually be enough for me.
Is the context 'after' the brace important ? For your example, I was thinking of a language-dependent plugin to the feature, so Java could display all the code starting from the `if' statement (not implemented yet). This also solves complex if/while conditions, which are usually split into multiple lines.
I feel it would help to also have the context after but can't think of a strong case. May be in the case void foo() { if (sometest()) { while (someothertest()) { // some code } // more code }| } would it help me to understand that the end of the while is above where I am, however that doesn't seem as important as knowing what the current brace refers to. A language-dependent pluglin also makes sense for me. For Java it would be good indeed to display from the 'if' in case of a multiline 'if', albeight with the risk of having a tall tooltip.
Initially, I'd suggest to add SPI implementations for Java, Javascript and PHP. HTML and XML should survive with their brace matchers, which locate the entire tag.
*** Bug 225019 has been marked as a duplicate of this bug. ***
Created attachment 133931 [details] Proposed API change
Please review the attached API change; see javadoc for BraceContext class for explanation and example.
R01: BraceContext is missing
Created attachment 133934 [details] Revised patch R01: Forgot to hg add the file ... sorry for the inconvenience.
http://hg.netbeans.org/jet-main/rev/d52704f07ebc
Implemented in http://hg.netbeans.org/jet-main/rev/d52704f07ebc
Integrated into 'main-golden', will be available in build *201305082300* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-golden/rev/d52704f07ebc User: Svata Dedic <sdedic@netbeans.org> Log: #217730: Implemented API extension to give context for the matched brace