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 217730 - Show more than one line for the new start brace tooltip
Summary: Show more than one line for the new start brace tooltip
Alias: None
Product: editor
Classification: Unclassified
Component: Code folding (show other bugs)
Version: 7.3
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Svata Dedic
: 225019 (view as bug list)
Depends on:
Reported: 2012-09-03 09:42 UTC by lhochet
Modified: 2013-05-09 02:36 UTC (History)
4 users (show)

See Also:
Exception Reporter:

Proposed API change (3.74 KB, patch)
2013-04-29 13:25 UTC, Svata Dedic
Details | Diff
Revised patch (9.39 KB, patch)
2013-04-29 14:14 UTC, Svata Dedic
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description lhochet 2012-09-03 09:42:47 UTC
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.
Comment 1 Svata Dedic 2012-09-03 09:44:54 UTC
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 :)
Comment 2 lhochet 2012-09-03 10:20:35 UTC
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.
Comment 3 Svata Dedic 2012-09-03 14:21:17 UTC
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.
Comment 4 lhochet 2012-09-03 14:41:10 UTC
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.
Comment 5 Svata Dedic 2012-12-11 10:18:46 UTC
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.
Comment 6 Svata Dedic 2013-01-21 14:49:40 UTC
*** Bug 225019 has been marked as a duplicate of this bug. ***
Comment 7 Svata Dedic 2013-04-29 13:25:45 UTC
Created attachment 133931 [details]
Proposed API change
Comment 8 Svata Dedic 2013-04-29 13:29:18 UTC
Please review the attached API change; see javadoc for BraceContext class for explanation and example.
Comment 9 Ralph Ruijs 2013-04-29 14:11:07 UTC
R01: BraceContext is missing
Comment 10 Svata Dedic 2013-04-29 14:14:25 UTC
Created attachment 133934 [details]
Revised patch

R01: Forgot to hg add the file ... sorry for the inconvenience.
Comment 11 Svata Dedic 2013-05-06 14:26:49 UTC
Comment 12 Svata Dedic 2013-05-06 14:27:15 UTC
Implemented in
Comment 13 Quality Engineering 2013-05-09 02:36:11 UTC
Integrated into 'main-golden', will be available in build *201305082300* on (upload may still be in progress)
User: Svata Dedic <>
Log: #217730: Implemented API extension to give context for the matched brace