Autocomplete only for tab and enter - autocomplete

How could I disable autocompleting for this situation:
Pressing ( after Rate autocomplets with DeviceRotationRate as displayed:
I only want to use tab or/and enter for autocompleting, so I will know what to expect.

The setting that turned this behavior off for me was:
"editor.acceptSuggestionOnCommitCharacter": false
You can find it in preferences - configuration - suggestions

To accept tab but not accept enter, use:
"editor.acceptSuggestionOnEnter": "off",
as explained here.
Useful since you use enter in python to change line.
You can write that settings on >Preferences: Open User Settings (JSON) (using CTRL + SHIFT + P and fill >Preferences: Open User Settings (JSON))

Related

I am trying to overwrite the default settings with my own user settings, but where in Visual Studio Code 1.73.1?

I am trying to complete a Stackskills class that requires me to go to "Settings" on the bottom left, then add the personal settings to overwrite the default settings on the right. My issue is that with Visual Studio Code 1.73.1, that option is no longer there.
The specific code I am trying to implement is this:
{
"editor.renderWhitespace": "all",
"files.autoSave": "afterDelay"
}
So where do I place this piece of code if not in the original place in Visual Studio Code?
I scrolled down all the parts of the Settings and I expected to find a place to write my personal settings to overwrite the default settings. Sadly, I could not find it.
There are multiple ways to access the VS Code settings.
To access the settings graphical UI, you can:
Click the gear icon at the bottom left of the page, and then click the "Settings" menu item in the menu that pops up.
Use the default keybinding to open the settings menu. On Windows and Linux, that is ctrl+,
Open the command palette (the default keybinding for this on Windows and linux is ctrl+p) and then use the Preferences: Open Settings (UI) command or the Preferences: Open User Settings command.
To access the user settings.json file in a regular text editor tab, open the command palette and use the Preference: Open User Settings (JSON) command.
To access the read-only settings.json file that shows what settings are set by default in a regular text editor tab, open the command palette and use the Preference: Open Default Settings (JSON) command.
If a setting is not explicitly already set in the user settings.json file, then that setting takes on whatever value is indicated by the documentation to be the default value.
I'd say that typing ctrl + shift + p and typing afterwards:
User settings
and selecting command Prefeences: Open User Settings (JSON) will bring you there.
I'd highly recommend relaying on ctrl + shift + p as your main tool, not on buttons/menus layouts, as it changes quite often.
The best part of ctrl + shift + p is that you don't actually need to exactly remember command name. Just more or less, what you trying to achieve, as all of those prompts will in the end, after bit of scrolling brings you where you want:
user settings
settings JSON
preferences JSON
preferences user
preferences user JSON
...and so on...
basically, ctrl + shift + p is your small STack Overflow in VS Code, that tries hard to understand your intentions :)

VSCode | New Window select language

By mistake I pressed on "don't show this again". How can I make vscode show that option again?
There is a setting that enables/disables that message:
Workbench > Editor > Untitled: Hint
By selecting "Don't show again" you disabled that setting (setting it to hidden).
To get the message back, reenable it - set it to text.
Press ctrl + shift + P
Type Change Language Mode press enter
You will get menu with all the languages.
Additionally you can save the file with correct extension to get all the language support installed in your VS code.
Hope this helped
I follow above answer I solved for me

How do I turn off text formatting on save in visual studio code?

I don't know why my code is auto formatted on save and for some reason changing the layout. I figured out this was due to auto format on save. How do I turn auto save off in Visual Studio Code?
For Windows:
Here are the some basics steps to be followed to turn off auto complete.
Step:1 - Press Ctrl + Shift + P to open Command Palette. Then screen like below image appears.
Step:2 - Type Save without formatting and click the matching option available. It either commands on click or redirects you to next interface.
If it works on click then it's fine and if your are redirected to next screen just uncheck auto format option under onsave. For me it worked on cick to the shown command.
For Mac:
Cmd+K S
This was introduced in back in 2018, the keybinding (on MacOS) is:
Cmd+K S
For keybindings for your own system, search for the command saveWithoutFormatting in the Command Palette
Default: Ctrl + k + Ctrl + Shift + s on 🪟 Windows.
For others having the same problem and if Save without format is inconvenient to do every time and if you want permanent settings for saving without format here are the steps:
Edit the settings.json file. You can do that with the command "Open Settings (JSON)"
press Command + Shift + P (to open the command palette)
and start typing the command "Open Settings (JSON)" and select from the suggestions.
The setting is named formatOnSave and you should set it to false, to disable it. It can be present multiple times for different types of things.
"editor.formatOnSave": false
It is best to search for "OnSave", because there might also be other settings that are doing formatting on Save, for example:
"editor.codeActionsOnSave"
In mac you can save without formatting with the following shortcut, (No need to touch the config):
If you don't want to open the command palette every-time, you can change the Ctrl/Cmd + S shortcut to make the action "Save without Formatting"
and remove the shortcut for "Save".

Tab autocomplete in Visual Studio Code doesn't work

I am trying to enable tab auto-completion with pressing "Tab" button but it doesn't work for me and it always works as Tab character when it is supposed to work as autocomplete. Which setting or shortcut should I enable or disable to have this feature?
With pressing "Tab", I will get this;
PS: Pressing "Enter" works fine and accepts the suggestion and I can disable it by setting the following setting to off.
Try changing tab completion setting to On:
Editor › tab Completion
"editor.tabCompletion": "on"
Also for HTML/Javascript you could make emmet setting to true
"emmet.triggerExpansionOnTab": true
there may be keyboard shortcut conflicts in vs code. you should check keyboard shortcuts for tab, especially keyboard shortcuts come from extensions. if there is, you should remove it. then it will work.
Open Visual Study Code Setting.
Enable Tab Completion
For HTML doing both the steps listed by Vinoth on Sep 08, 2019 worked for me:
"editor.tabCompletion": "on"
"emmet.triggerExpansionOnTab": true
Control + P -> Terminal:Focus Terminal TabsView ->Click ().
Or Ctrl + shift + \
Open Visual Study Code Setting.
Go to edit in settings.json.
Add the below code:-
"emmet.includeLanguages": {"javascript": "javascriptreact"},
Now have a fun 😄
In my situation, I was working in a remote environment and my user settings weren't being applied to it (obviously).
This may be helpful to anyone who stumbles upon this question but the accepted answer doesn't work.
Just select your environment and then change the settings there.

How to open 'Go to definition' in other split tab for same file in VS Code?

I'm considerably new to Visual Studio Code and I am struggling a bit with an easy functionality. Imagine the case when I am reviewing some code in a file a.py and I select 'Go to definition' on a function x of the same file. Is there any possible configuration or shortcut that opens the definition on a split on the editor?
I have tried having already the same file split in the editor an it still opens the definition in the same file what is uncomfortable when you have to trace some code because you need to scroll up and down whenever you want to see another function of the same file.
An extension that allows to do the trick will also be well received. Thanks.
There are 2 ways to achieve this.
Either:
Left-click function name that you want to open.
Ctrl + t
Ctrl + enter
Or:
Change setting Editor > Goto Location: Multiple to be gotoAndPeek or goto
Ctrl + Alt + [click on function name]
Both methods will open the definition in the split to the right (or create a new split if this is the right-most split).
You like?
The shortcut is Ctrl+K, F12 but this can be changed in the shortcuts (search for shortcut editor.action.revealDefinitionAside)
More details here https://github.com/microsoft/vscode/issues/112136
For me setting workbench.editor.revealIfOpen to true like described here worked.
Controls whether an editor is revealed in any of the visible groups if opened. If disabled, an editor will prefer to open in the currently active editor group. If enabled, an already opened editor will be revealed instead of opened again in the currently active editor group. Note that there are some cases where this setting is ignored, e.g. when forcing an editor to open in a specific group or to the side of the currently active group.
[option + command + left click] or [option + command + F12] opens definition in split tab.
You have two different ways to do that task:
First one is, with the cursor on the word that you want to go to definition, press Alt+F12.
It opens a new tab like this one:
Second one is edit the settings and add this line:
"workbench.editor.enablePreview": false
It disables all the previews for code files so always that you want to go to definition, they will be open in a new tab, as you can see here: