problems with code formatting on save in vscode - visual-studio-code

I have vscode installed and also the prettier extension. In settings I select the option format on save. However, when saving the formatting of the code does not happen, I have to activate the format manually. how can I solve that ?

Press Ctrl+shift+p and type Preferences: Open User Settings (JSON). In that json file add the following line and save. This should enable so vscode formats the code each time you save.
{
"editor.formatOnSave": true
}

Update, i just find the solution if anyone is having the same problem i have to add the following lines to user setting json
"editor.defaultFormatter": "esbenp.prettier-vscode",
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}

Related

Disable Help On Terminal

Visual Studio Code 1.68
Hi everyone
How to disable Help Tags?
For example in print function:
see
Thank you very much already
if I'm not wrong, in your picture you are using the editor, not the terminal.
To disable this, go to settings (F1 > "Open Settings (JSON)) and disable this option:
"editor.quickSuggestions": true,
Or if you want to disable it for a specific language:
"[markdown]": {
"editor.quickSuggestions": false
}

Expand emmet abbreviations without pressing TAB in vs code

This is my vs code's settings.josn shows me regarding emmet.
"emmet.includeLanguages": {
"javascript": "javascriptreact"
},
"emmet.showExpandedAbbreviation": "always",
"emmet.triggerExpansionOnTab": true,
I can use emmet abbreviations after pressing TAB key or clicking Edit -> "emmet : expand abbreviation". But I want to know if there is a way to do it automatically when vs code is getting started. If anyone knows that kind of way please let us know.
In VSCode go to
"settings → Extensions → Emmet → Edit in settings.json" and add this in settings.json file
"emmet.includeLanguages": {
"javascript": "javascriptreact",
"typescript": "typescriptreact",
"html":"html"
},

Can't disable suggestions in Visual Studio code

I've been trying to disable suggestions in VSC by changing the following in settings.json, but it hasnt works for me. What am I doing wrong?
// OPTIONAL WORD WRAPPING
// Controls if lines should wrap. The lines will wrap at min(editor.wrappingColumn, viewportWidthInColumns).
"editor.wordWrap": "off",
// Controls the indentation of wrapped lines. Can be one of 'none', 'same' or 'indent'.
"editor.wrappingIndent": "none",
// TURN OFF AUTOCOMPLETION
// Controls if quick suggestions should show up or not while typing
"editor.quickSuggestions": false,
// Controls the delay in ms after which quick suggestions will show up
"editor.quickSuggestionsDelay": 90,
// Enables parameter hints
"editor.parameterHints": false,
// Controls if the editor should automatically close brackets after opening them
"editor.autoClosingBrackets": false,
// Controls if the editor should automatically format the line after typing
"editor.formatOnType": false,
// Controls if suggestions should automatically show up when typing trigger characters
"editor.suggestOnTriggerCharacters": false,
// Controls if suggestions should be accepted 'Enter' - in addition to 'Tab'. Helps to avoid ambiguity between inserting new lines or accepting suggestions.
"editor.acceptSuggestionOnEnter": "off"
}```
I just copy pasted your settings into my settings.json file and hit save. It worked for me, no more intellisense. Did you edit the file with VS Code and then hit "save" ? If it didn't work, then maybe try reinstalling vs code and try again. My bet is that you didn't save. Also, I opened the file by first going into settings and then clicking on one of the selections that said "edit in settings.json." Another thing that I had to do was after I hit save on the settings.json I also had to go back into settings and manually uncheck all of these options:
search for "suggestions"
Try adding this line to settings.json. Not a permanent fix, but can act as a temporary one.
The line:
"editor.suggestOnTriggerCharacters": false

Disable automatic suggestions popping up in VSCode

Background
VSCode shows suggestions whenever I move the cursor into a function signature. I'm finding this very disruptive, as I use Vim keybindings and it interrupts my ability to move around a file quickly.
I'm looking for a way to configure VSCode to only show suggestions when I press the hotkeys, which my keybindings.json defines as CMD + .
What I've tried so far
I've added these lines to my settings.json but they did not solve my issue:
"editor.quickSuggestions": {
"other": false,
"comments": false,
"strings": false,
},
Am I missing something?

VSCode: Change text editor for an extension. E.g. open .txt with json editor

I am new to VSCode and want to know if it is possible to set an editor as default editor for a file extension.
Temporarily I am able to open the .txt with json editor by selecting the JSON from the bottom right corner of the vscode as shown in the screen shot
Is it possible to set it for default?
Finally, I found a way to do it by appending settings.json
Open the file by going to Preferences>>User Settings
Just add the given below code in the file
{
"files.associations": {
"*.txt": "json"
}
}