-
Notifications
You must be signed in to change notification settings - Fork 58
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
feat: add "Copy Value" context menu item to LanguageServers view #1185
Conversation
Should we not add the possibility to copy with the keyboard as well to make it behave as other menu items? |
The view has full row selection. So when you press CTRL+C we don't know which value the user wants. |
org.eclipse.lsp4e/src/org/eclipse/lsp4e/ui/LanguageServersView.java
Outdated
Show resolved
Hide resolved
I understand, if it will copy only one Cell, what about renaming the message as suggested? |
0ab8646
to
97c2875
Compare
@rubenporras I changed the implementation. You can now select a cell value and also use CTRL+C to copy the value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for taking up my comment on Ctrl-C.
copyValueMenuItem.setText("Copy Cell Value"); //$NON-NLS-1$ | ||
copyValueMenuItem.addListener(SWT.Selection, event -> copyCurrentCellToClipboard()); | ||
table.addListener(SWT.MouseDown, event -> { | ||
if (event.button == 3 /* Right-click? */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
very surprising that there is no better way to find if it is a right-click that hardcoding the number 3, but I could not find anything better in SWT; the documentation only says the button can be 1, 2, 3.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I was surprised by this as well. Ideally, I would use SWT.MenuDetect as the listener event, which would make this check unnecessary. However, for some reason, SWT.MenuDetect becomes unreliable when SWT.FULL_SELECTION is enabled on the table. Then it only triggers intermittently after several right mouse clicks.
This PR adds a context menu item to the Language Servers view to copy the selected cell as text to the clipboard. This is esp. handy for troubleshooting to copy the effective command line or PID of an LS.