Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Usages: Add means to disable code preview #8112

Open
pgifford opened this issue Jan 4, 2025 · 12 comments
Open

Usages: Add means to disable code preview #8112

pgifford opened this issue Jan 4, 2025 · 12 comments
Labels
Contribution welcome An issue or feature not currently being worked on, but a contribution would be welcomed! kind:feature A feature request needs:triage Requires attention from one of the committers UI User Interface

Comments

@pgifford
Copy link

pgifford commented Jan 4, 2025

Description

Add means to disable or hide code preview in Usages results.

Use case/motivation

I code on a monitor in portrait orientation.

Motivation for request

  1. The code preview in Usages takes up over 2/3 of the window width covers about 50% of the horizontal extent of the results tree
  2. The Usages code preview cannot be resized so it is not visible. When the divider is dragged as far as possible to the right, line numbers are still visible.
    • The Search Results code preview can be completely hidden by dragging the divider all the way to the right.
  3. Usages code preview does not respect user preferences. Each invocation returns the divider to the default position which means I have to drag it back to the right to be able to read the results without having to scroll.
    • Once hidden (i.e. divider moved fully right) the Search Results code preview remains hidden even when NetBeans is closed and reopened.

NetBeans has been my daily driver for over 20 years and I have rarely wished for a code preview in usages (or search results). It should be an optional element and not forced upon everyone, especially when the implementation is in such a rough state.

Related issues

No response

Are you willing to submit a pull request?

No

@pgifford pgifford added kind:feature A feature request needs:triage Requires attention from one of the committers labels Jan 4, 2025
@pgifford pgifford changed the title Add means to disable code preview Usages: Add means to disable code preview Jan 4, 2025
@mbien mbien added the UI User Interface label Jan 5, 2025
@mbien
Copy link
Member

mbien commented Jan 5, 2025

point 3 was an oversight and should be fixed in master #8105, #8089

The preview toggle was intentionally left out and will be only added if it is also added to all windows which with similar functionality to keep things consistent. #7694 (comment) has a screenshot with some of the windows

@mbien mbien added the Contribution welcome An issue or feature not currently being worked on, but a contribution would be welcomed! label Jan 5, 2025
@pgifford
Copy link
Author

pgifford commented Jan 5, 2025

The preview toggle was intentionally left out and will be only added if it is also added to all windows which with similar functionality to keep things consistent.

Things are already inconsistent in the screenshot (depending on the window line numbers are in the results, the preview, and both) so what’s one more? 😁

You added the “Contribution welcome” label…what did you have in mind?

@mbien
Copy link
Member

mbien commented Jan 5, 2025

Things are already inconsistent in the screenshot (depending on the window line numbers are in the results, the preview, and both)

The search preview does not only have line numbers it also does not use the semantic layer in the preview panel since this would require a dependency from search API to the netbeans editor modules. Even if this is determined to be ok, it would have to be verified that this doesn't cause other problems, e.g cluster activations caused by browsing through search results - so it might not be worth it.

@matthiasblaesing
Copy link
Contributor

For the record: I agree, that a toggle that makes it possible to switch previews off would be good. I also agree, that the consistency argument is moot, as the problem (forced preview) was added as a feature, so switching to the previous situation is IMHO a no-brainer (else the feature is an issue and should be reverted).

I think we should not blow up the consistency argument. It is good if the use-cases converge, but if it is not possible and just realises the orginally thought about switching option, I don't see a problem.

Now it only needs someone to implement.

@mbien
Copy link
Member

mbien commented Jan 5, 2025

Now it only needs someone to implement.

it already was implemented (for search) and dropped after discussion that such feature should be added to all semantically similar views. The duplicated code situation isn't great, adding a toggle after looking through all splitpanels-with-preview would certainly lead to more maintainable code, more UX consistency and overall less work than implementing it one by one over multiple releases in n different ways.

edit: at the very least it should be added for search and refactoring/inspection views in one go since users already expect search and usage to work and look the same

@neilcsmith-net
Copy link
Member

The search preview does not only have line numbers it also does not use the semantic layer in the preview panel since this would require a dependency from search API to the netbeans editor modules.

That is of course the reason I've been getting frustrated that the search view doesn't support ctrl+click recently despite it never doing so! 😄

Direct dependency into the editor modules is of course not feasible. Enhancing the search SPI to allow custom result preview and/or seeing if this can be implemented via openide.text might be. I agree that cluster activations via the search window might be a problem to consider, although perhaps no more of an issue than flicking through the options dialog.

Incidentally, the kit lookup in the other views should possibly be via openide.text too? https://bits.netbeans.org/23/javadoc/org-openide-text/org/openide/text/CloneableEditorSupport.html#getEditorKit-java.lang.String-

@mbien
Copy link
Member

mbien commented Jan 5, 2025

Incidentally, the kit lookup in the other views should possibly be via openide.text too? https://bits.netbeans.org/23/javadoc/org-openide-text/org/openide/text/CloneableEditorSupport.html#getEditorKit-java.lang.String-

The other previews do something like this ((BaseTextUI) editorPane.getUI()).getExtComponent() to get the extended editor component (hidden behind utility methods). The editor kit does change fine but I don't think that a plain old JEditorPane can morph into the typical NB editor.

@neilcsmith-net
Copy link
Member

neilcsmith-net commented Jan 5, 2025

Sure, I'm aware of that - that's the second step. The point was that unless an existing utility via openide.text will already achieve that for us (when available) then either an enhancement to the API there to do that and/or an SPI displayer that can handle it would be good.

@dschniedertuens-tc
Copy link

I would like to support the need for that toggle. I also have no use for a code preview in this very narrow section for usages and search results.
But what makes the new preview in the Usages window really frustrating is that it seems to interfere with the function of the Previous Occurence and Next Occurence buttons and their corresponding shortcuts. These currently no longer have any effect on the editor window but only on the preview window.
This destroys my otherwise constantly used workflow of jumping directly to the next match in the editor.

@matthiasblaesing
Copy link
Contributor

@dschniedertuens-tc I did a quick test and it works for me (buttons in editor + F3/Shift+F3 keys). If the main editor has a the focus, jumping happens there, if the preview has it, jumping happens there. So this needs some more information/explanation.

@dschniedertuens-tc
Copy link

@matthiasblaesing Thanks for looking into it.
Did you try that with the Usages result? I'm wondering this because F3 is only responsible for the normal search in my case. Reproduced on this screenshot:

Image

Focus was in the main editor on line 80. When pressing CTRL + Period (or clicking on the arrow down button) the expected result would have been jumping to line 84 in the main editor but the cursor is still in line 80 and line 84 was only highlighted in the Usages result and preview.
This behaviour affects only "Usages". The very similar "Search Results" works as expected. Could it make a difference that I am editing PHP code?

Btw. I didn't intend to hijack this feature request issue with a possible bug report. My hope was to get back the old behavior with the toggle 🙂

@matthiasblaesing
Copy link
Contributor

matthiasblaesing commented Jan 18, 2025

@pgifford thank you for the explanation and I see the problem now (and can reproduce it in Java Code)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Contribution welcome An issue or feature not currently being worked on, but a contribution would be welcomed! kind:feature A feature request needs:triage Requires attention from one of the committers UI User Interface
Projects
None yet
Development

No branches or pull requests

5 participants