VSCode Type Hint toggle display - visual-studio-code

How can I toggle on and off the display of Type hints in VS Code? For example, I've got the code .remoteOf(ClassServiceClient.class) and what I see is .remoteOf(CLAZZ:ClassServiceClient.class) but I can't actually select or seem to interact with the CLAZZ word.
How do I toggle this on and off? It seems useful in certain situations, but it just makes me think I typoed something.
I'm sure this has been asked before, but I haven't been able to come up with a word that seems to describe this feature.

This feature is called Inlay Hints and can be found under the Editor section.
After this, I've gone from displaying clazz:#Log4J2 to #Log4J2, and have enabled the option to display this hint by holding down a set of keys, ctrl + alt by default on Windows.

Related

How do I get imports to show up when I press ctrl+dot in javascript in vscode?

When writing JSX (or any typescript code really) if you have an available import that's not yet imported, you get a squiggly line under it and can press ctrl+dot on it and then automatically import the code as a "refactoring."
How can I set this up in Javascript? I've seen a screenshot of someone else's VSC where it is available underneath "more options" and so I'm pretty sure it's possible, but when I press ctrl+dot I get nothing.
Note: I'm aware I can press ctrl+space. However, I don't want to do this, for two reasons. (1) alt+space is pretty bad UX because if you press it in the middle of a word it continues to autocomplete even if you already had the full name there and so you are left with an incorrect tag (e.g. if your cursor was after the d in Keyboard for a component called KeyboardRow you are left with KeyboardRowRow) and (2) I want to rebind quick fix to alt+enter to match pycharm; and I want the same hotkey & UX in both Typescript and Javascript.
I haven't worked too much with JS, mainly with TS, but I have two extensions installed in my vscode that helped me a lot while coding in vanilla JS.
Path intellisense and Auto import
You can try if My Code Actions can be used to construct a Quick Fix for these types of PROBLEMS/squiggles

How can I make SublimeText version 4's autocomplete behave like version 3?

I recently, too-trustingly, upgraded my Sublime Text 3 to Version 4 (Build 4107). Now auto complete behaves completely differently. It now has a pop-up from which I must select a choice - before I would just hit tab and it would choose the best option for me (I could then tab again to try for a better answer).
A concrete example: before, when I typed a word with a typo, for example "questino", I could, with my cursor directly after the o, hit tab and it would correct it to "question" automatically. Now it doesn't do that - now it would pop up a list of any longer words, such as "questions" and "questioned", and then I would have to arrow to one of them and hit enter. It wouldn't even give me "question" as an option - I would have to backspace over the n and then hit tab in order to get a popup that included that word, because not only is the popup annoying, with it requiring multiple additional keystrokes, but autocorrect no longer corrects to a word of the same length as my currently misspelled word, only to longer ones.
There are a lot of options in Preferences, including: auto_complete, auto_complete_size_limit, auto_complete_delay, auto_complete_selector, auto_complete_triggers, auto_complete_commit_on_tab, auto_complete_with_fields, auto_complete_cycle, auto_complete_use_index, auto_complete_use_history, auto_complete_preserve_order, auto_complete_trailing_symbols, and more.
Does anyone know the precise set of preferences to make it behave exactly like it used to? Or maybe there is a package that fixes it? Or maybe my next step will be reverting to the previous version.
Thanks.
The closest you can get right now appears to be:
"auto_complete": false,
"tab_completion": true,
"mini_auto_complete": true,
This is still different from how ST3 works. Tab will fill in only a single value, pressing tab again will not toggle between options, but it won't have the distracting popup.
Background context on the forum. Hopefully this answer will be quickly invalidated by an update or plugin.

How do I select all text in vistual studio code?

In visual studio code (1.29.1) ctrl+a doesn't do anything for me. I checked keyboard shortcuts and it's mapped to a few select all actions (editor.action.selectAll, etc.) but when I'm in a file and press it nothing happens. How do I select all text in the current file in visual studio code?
Thanks for the comments, it make me realize it must be an environmental issue. Turns out if you have any mapping starting with a key combination that will lock that mapping to the key combo and you can't use it for anything else.
To make save all ctrl+shift+s I had to re-map save as and I mapped it to ctrl+a+s, so everytime I hit ctrl+a it just waiting for second key. In the status bar at the bottom of my editor it said something like "Ctrl+a detected, waiting for second keystroke", which means Ctrl+a won't work on its own. I re-mapped Save As to some unused key combo and it fixed select all.
This question was luckily answered on another thread
I'll post the OG answer here, nonetheless.
Most new comers to VS-Code could resolve this issue with the 2nd method provided by the OG answer:
Goto File > Preferences > Keyboard Shortcuts
in the search bar type this Select All
There's should a couple of results, you'll obviously want the "Select All" result
right click on his line and click on Change When Expression
a textbox would be highlight for you to fill in text. type editorFocus
press enter and done!
The OG answer provides image if you need to confirm that you're doing it right.
side-note: This issue bugged for more than 3 years and is the main reason my I used VS-Community over VS-Code.
So it's nice to finally be able to work normally in this very robust customizable IDE text-editor.

Eclipse content assist auto appends type for variable

I just started to use Juno for a couple of days, the content assist mechanism seems different from what it behaves before.
For example, if I try to declare a variable
Boolean isVisible
The content assist of Juno will give you a drop-down list with the variable name
isVisibleBoolean
as hint.
And the very annoying thing is that no matter what I typed in(; or SPACE), the "isVisibleBoolean" will be selected.
Does anybody know how can I disable the auto-variable-type-appending thing?
Much appreciated.
I'm using Mac OS X 10.8.1 currently, haven't tested it yet in windows.
Based on the discussion for Eclipse Bug 412992, check your Content Assist Auto Activation settings:
Window->Preferences->Java->Editor->Content Assist
If, for example, characters a-z are listed as "Auto activation triggers for Java", you can remove them and the type name will not be auto-appended to a new variable name when you hit ' ' or ';'. It's up to you to determine the best configuration/tradeoffs for your style based on the available options.
It seems that it is not possible.
See answers to Eclipse Bug 378588: https://bugs.eclipse.org/bugs/show_bug.cgi?id=378588
This is still a problem in Eclipse 2018-12 and it only seems to occur if you changed the Auto activation triggers for Java setting to e.g. ._abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ, which'll make the Content Assist (almost) always pop up, even without pressing Ctrl+Space (Windows).
There's a new setting that was added in Eclipse 2018-12 and makes it a bit less annoying (mentioned in the comments below the bug report):
In Window - Preferences - Java - Editor - Content Assist tick the Disable insertion triggers except 'Enter' box.
With this setting enabled, Content Assist is still going to trigger (depending on the other settings) but you have to press Enter to accept a suggestion.
Not a perfect solution:
Window->Preference->Java->Editor->Content Assist->Auto activation Triggers for Java: .ABCDEFGHIJKLMNOPQRSTUVWXYZ
In this way, only classes and types will be popped up for proposals.
Just a suggestion, the choice is up to you.
What you see there is name completion for object types. And this may often make sense, e.g. pressing Ctrl-Space after List book will complete that to List bookList. For primitive types this is not done, so int count will not get any completion when pressing Ctrl-Space. This would be a (not really good) solution to your problem by declaring the variable as primitve boolean.
What I really recommend as solution is to change your style of writing variable declarations. For your example, write isVisible = false instead, have the editor complain about the missing type declaration, hit Ctrl-1 (from wherever your cursor might be placed), Enter.

Variable use highlighting in Intellij IDEA

One of the features I really like about Netbeans is that when you click on a variable, method, field etc. Netbeans shows you all the usages of this entity in the right hand bar as little bars of colour. Is there a way to get this behaviour in IntelliJ IDEA and if so, how do I turn it on? I haven't found anything in the settings or Google but I might be missing something!
file>settings or ctrl+alt+s (for windows) select editor from the list on the left and check Highlight usages of element at caret in the Highlight on Caret Movement section
Apart from enabling the "automatic highlight usages" setting described above, you can also invoke "highlight usages" manually, using the shortcut Ctrl+Shift+F7.
The benefits of using the "manual" highlight usages are:
You can highlight usages of multiple variables/methods/etc at the same time
You can remove highlighting for an individual element selectively, by invoking Ctrl+Shift+F7 again on that element
some users find it less distracting than "automatic highlight usage" - this is subjective or course
Above answers are correct but still to get the exact behavior like in Netbeans try to use Identyfier Highlighter plugin for Intellij Idea (available in default plugin list under window settings).
This is really strange as Idea features mentioned in previous answers would do the job if merged into the one configurable feature.