Eclipse - multiline comment with asterisks doesn't work - eclipse

I'm not able to use ani shortcuts for using comments with asterisk. Every key combination doesn't work. I tried with CTRL+/, CTRL+SHIFT+/, CTRL+C; all of these have the same output, i.e. a simple comment with // on every line. Other shortcuts like CTRL+\, CTRL+SHIFT+\ or CTRL+SHIFT+F doesn't work at all.
So, how can I have this shortcut?
These are the Comments options

Open Window>Preferences>General>Keys>type "add block comment" in the search box, you should see:
the type "remove block comment"
These settings are by default, but if the shortcut is not working on your machine, you must be missing these bindings, To create them, you need to mark the command "Add Block Comment", then click inside the "Binding" field and press CTRL+SHIFT+/, then press Apply. The same is for uncommenting.

I have a similar problem to the one you have: the / shortcut seems to trigger a folding operation (at least in the Java editor) that does not appear in the keys preferences table.
Modifying the key in the keys preferences table seems to work fine: setting the binding to Shift+Ctrl+Q for the "Add Block Comment" command sets the expected block comment.
The reason is clear to me: the Shift+Ctrl+/ binding is very difficult to reproduce in a Linux environment because Eclipse makes a clear difference Numpad_Divide and the '/'. The Normal '/' strike is being modified by the shift key (French keyboard).

Related

Netbeans surround selection with quotes

I want to surround the selected text with quotes or parentheses when I hit the corresponding button, not to overwrite it, which is the behavior I have observed. From what I have read so far, this is how the program usually behaves, but definitely not my case. I could not find the equivalent setting under Tools > Options. I have found the macros to surround a single word, but I want the whole selection, as would be expected in other text editors and IDEs.
Version: Apache NetBeans IDE 12.2
For example - the selection:
a string consisting of multiple words
Press Shift + 2 (where " is on my keyboard layout):
"a string consisting of multiple words"
OK....
You were right when you said that you could not find anything close this shortcut. I looked through the entire list and there was none. The only thing close to it was to surround a single word in quotes. So, that means that you will have to create one shortcut to surround text selection in quotes and another with parentheses. They will be very similar, but will require two different hotkeys.
For example, I created a shortcut to surround text selection in quotes. To do so, you have to go to Tools -> Options -> Editor and click New button
In the "New Macro Dialog" enter a name (i.e. "quote-selection") and click "OK". Then, type in copy-to-clipboard "\"" paste-from-clipboard "\"" in the "Macro Code" text area. Lastly, click "Set Shortcut..." button and type in the exact sequence of key presses you want to use for your shortcut. Don't worry if you enter a shortcut already in use. It will warn you if you do. I chose to use CNTL+ALT+3 because that's not in use. When you are satisfied, just click "OK" to record your shortcut. If you make a mistake in the key presses, simply click "Clear".
Then, repeat the process for surrounding with parentheses with the macro code copy-to-clipboard "(" paste-from-clipboard ")". When you are done, click "Apply" and "OK".
I used Netbeans version 12.3, so I expect everything shown here should be very similar (if not identical) to 12.2.

How to trigger documentation popup in vscode

How to trigger a popup with documentation for identifier under the cursor?
Normally it appears when hovering the identifier using the mouse pointer:
I would like to achieve this effect using a command or keyboard shortcut.
The only related commands I found are: trigger completion (which doesn't show the function doc) and trigger parameters hint (which only works when the cursor is inside function call - parameters list).
This is the editor.action.showHover command. It is bound to cmdk cmdi by default.
Note: Shortcut works by holding down the cmd [ctrl in windows], then while holding press k then i
You can change the keyboard shortcut with a keybinding such as:
{
"key": "cmd+k ctrl+space",
"command": "editor.action.showHover",
"when": "editorTextFocus"
}
The default shortcut for Trigger Parameter Hints is Ctrl+Shift+Space
You also have, with VSCode 1.40 (Oct. 2019):
Definition Preview Hover from the keyboard
There is a new command Show Definition Preview Hover for better accessibility of the definition preview hover widget, which can be triggered by hovering a symbol with the mouse and pressing a modifier key dependent on the platform and configuration.
Previously, only the command Show Hover was provided, which is equivalent to hovering the mouse cursor over a symbol.
Now, with Show Definition Preview Hover, the detailed hover information can be shown via the keyboard.
To make this more graphic, check these steps:
In Visual Studio 2019 for Mac, I couldn't find anything about "hover" in the Key Bindings setting. The relevant command seems to be called "Show quick info" and is bound by default to Cmd + F1.
I know this question is about VSCode but I could only find this question when trying to search for an answer. Therefore I would also like to leave the information here in case somebody finds it useful.
There are multiple ways to trigger the documentation popup:
First: Using shortcut ctrl + space
Second: Using vscode extension:
Here is the documentation:
Each answer here demonstrates a different function. Below is a consolidation of every type of helpful popup, the context in which they come up and all the ways I know to trigger them.
These assume default settings.
Function: Display documentation
Shortcut: Ctrlk Ctrli
Scope: Works over named elements - variable and function names (does nothing over literals).
Can display function documentation:
or variable or even property information:
This is the same pop-up you get when you hover over the element briefly.
Function: Display parameter hints.
Shortcut: CtrlShiftSpace
Scope: Works inside a function call.
The cursor must be inside the parenthesis that contain the passed arguments. Does nothing outside that scope.
Can also be triggered by typing a comma, as if passing another argument.
Up/Down arrows can be used to cycle through overloaded definitions (instead of moving the cursor up and down the document).
Function: Display the code completion menu
Shortcut: CtrlSpace
Scope: Anywhere. Will adapt to the context. In strings will display words only. In code will offer symbol hints - function names, variable names within the current scope, known properties, etc.
Is case insensitive.
Matches all contained characters - they do not have to be consecutive (see image above).
Tab or Enter accepts the currently selected suggestion.
Symbol hints can be triggered by just typing letters. Inside strings you must use the keyboard shortcut.

Eclipse: Can You Hit A KeyBinding To Find The Command It Is Bound To?

I'm new to Eclipse. Is it possible in Eclipse to hit a keybinding and find the name of the command it is bound too?
For example, pressing Ctrl+Shift+R and have something like "open-dialog" come up in a list telling me that Ctrl+Shift+R is bound to the command "open-dialog".
Unfortunately, Eclipse doesn't make this easy. (Related note: IntelliJ IDEA does.) There are a few things that might help you out, though:
In the Eclipse settings for key bindings, you could do "Export to CSV". Then you can search that document for key combinations.
Also in the Eclipse settings for key bindings, you can sort the "Binding" column. The list is unwieldy to scroll through, but the ordering of multi-key combinations seems to be well defined so you could eventually find the key combination you're looking for.
If you want to look up a common command without going into the settings, you can assign a keyboard shortcut to "Show Key Assist". You can't sort the list by key combination, but it's at least a relatively short list to look through.
Windows > Preferences > General > Keys
You can TYPE ( not press ) the name of the keys, it will sort the list by the name of the keys
Going by the original wording,
pressing Ctrl+Shift+R and
have something like "open-dialog" come up
it sounds like the Show key binding when command is invoked -> Through keyboard option in the Keys preference page would at least partially do what you're looking for:
This will bring up a toast-like overlay each time you press a key combination that's associated with a command. It will show the command name and a more detailed command explanation, if available.
However, the overlay will only display for a few seconds and then disappear, i.e. an onlooker might miss it if they are distracted by other activities on the screen. I don't think that there is a way to display this information "in a list", i.e. in a more permanent fashion, but I think that this would be a great feature to help developers learn new keyboard shortcuts in a pair programming environment.

Eclipse jump to next/previous marked occurrence

As was asked previously, Eclipse has the nice "mark occurences" feature, which shows all occurences of the selected variable or method.
But I don't know any shortcut for jumping to the next/previous occurence in the editor.
The shortcut ctrl+k is not working, it solely works in conjunction with "incremental find" (ctrl+j).
I'm using Eclipse Indigo. Is there any shortcut or other solution?
Edit:
The answers and comments in the question linked above are now pretty exhaustive, I think.
It seems there is no all-in-one solution (at least for Java code editing):
I cant get Ctrl + (period) to work, at least in Java code where it finds the next problem. Even rebinding this to a different shortcut does not work.
Ctrl + K does text-based search only. If you want to find all occurrences of the variable i, it finds any letter i within any identifier and comment.
Renaming mode using Alt+Shift+R and then navigating through the occurrences using Tab and Shift+Tab comes close, but only works for identifiers you can actually rename for that source file. It does not work for library code (esp. JDK) for which no editable source is available.
Try Ctrl + , and Ctrl + .
Before that make sure you have checked Occurences in the small navigation dropdown:
You can change the key from Window -> Preferences -> keys:
It works for me.
You can find if your key bindings have changed by looking under Window -> Preferences -> General -> Keys and look for the command Find Next. You will see the binding in the column Binding and can also check if it's conflicting with something else in the list titled Conflicts: at bottom right corner of the dialog.

How to highlight the selection in Emacs keybinding of Eclipse?

I have searched the Web for this, but with no luck. Any idea?
Thanks.
Try using the Emacs+ plugin available here:
http://www.mulgasoft.com/emacsplus
It provides a HUGE range of functionality - including the selection highlighting that you're looking for - that really helps the move from Emacs. I've only been using it for a couple of days, but it appears stable and integrates very well with the editor.
As described here, you can set emacs key binding to work in component editor in Eclipse
Go to Preferences -> General -> Keys.
Change Scheme to Emacs if you haven't done so already, so you can easily
spot the emacs key bindings.
Sort by Category and look at the "Text Editing" categories
Find the commands that you care about, e.g. Next Column, Previous Column
Select that command and click "Copy Command"
Set the binding to the key by pressing the keys, e.g. press Control-f to
generate "^F".
Change "When:" to "Editing Components".
Repeat for all the key bindings you care about.
So if, in emacs, selection is done by setting the mark (Control-Space) at the start of the region, then moving the point to to the end of the region, you could associate the appropriate shortcut to:
Text Editing > Select Text Start
Text Editing > Select Text End