Auto format , auto new line with Visual Studio Code (on Mac) - visual-studio-code

I'm using Flutter with Visual Studio Code (on Mac)
I feel uncomfortable with new lines auto added on save
I want to add new lines by myself, like below
I tried with formatOnSave, but it looks like I got wrong setting to config
"editor.formatOnSave": false

I'm using Prettier as VS-Code default formatter: https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode
And then just configure the maximum line width on the plugin settings:

Related

VS Code Terminal Font Changed after installing firacode extension. Why?

My Visual Studio Code terminal font has changed for mysterious reasons yesterday from the default font into courier. I checked the settings.json file but nothing changed. Why did this happen?
It happened when I added the firacode fnt into my vscode using the marketplace.
I tried to edit the settings.json file but no result ... it still the ugly font till now

"Prettier - Code formatter" is not working in Visual Studio code

I have Visual Code Studio(1.41.1) Editor and I need Auto Formatter
I have installed this code format: Prettier - Code formatter Successfully installed but not working,
I also tried to use the command ext install esbenp.prettier-vscode
that too was successful installation but is not working.
I checked that the composer is installed properly and the environment variable path is given correctly in my system, Also, I added it to the settings.json file by looking in the document: "phpformatter.composer": true but not success in auto-formatting my code
Visual Studio Code and System Restart also tried but did not succeed
Why can't I Auto Formatter in my Visual Studio code use this "Prettier - Code Formatter"? No errors are received, but the auto formatter is not working
try this, it worked for me
File -> Preferences -> Settings (for Windows)
Code -> Preferences -> Settings (for Mac)
Search for "Default Formatter". In the dropdown, prettier will show as esbenp.prettier-vscode.
Maybe the prettier extension is not working for javascript file. Open your settings.json for vs code and paste
{ "editor.defaultFormatter": "esbenp.prettier-vscode", "[javascript]": { "editor.defaultFormatter": "esbenp.prettier-vscode" } }
This might work for you
You may have local .vscode directory in the root of your project with settings that prevent formatting. Try to edit or remove .vscode local configurations if you have. After close and reopen VS Code.
as #harkesh kumar said : press Ctrl+shift+p and type format document then select prettier format, it may work for you
Make sure you have a file in the root folder with this name .prettierrc.js
inside you should have something like:
module.exports = {
bracketSpacing: false,
jsxBracketSameLine: true,
singleQuote: true,
trailingComma: 'all',
arrowParens: 'avoid',
};
If you don't have and don't want a prettier config file for some reason, you can uncheck the option "Prettier: Require Config"
In settings.json it's "prettier.requireConfig": true
In the UI it looks like this:
For me it was failing silently because I was using await inside of a function that wasn't marked with async. That raises another question - why would it fail silently here. Regardless, once I fixed that error then prettier began working again.
I finally found the issue. I was trying to format code on a remote server.
In the extension page for Prettier, it says:
This extension is disabled in this workspace because it is defined to run in the Remote Extension Host
Then I clicked on the button "install on remote host ..." and it worked

Remove Parameter Hints Box in Visual Studio Code

Someone know's how to remove this box:
"help" box
It's better showed here
Open the menu, chose the command File > Preferences > Settings to open or create a settings.json file where you can modify the behaviour of Visual Studio Code.
In this file, add the following line at an appropriate place:
"editor.parameterHints": false,
In newer version of Visual Studio Code you have to use this instead:
"editor.parameterHints.enabled": false,
Reference:
Intellisense in Visual Studio Code
Visual Studio Code User and Workspace Settings
I went to File->Preferences->Settings and a tab opened with Commonly Used at the top. Did Ctrl-F to search parameter, then uncheck the box which is saved automatically it will say. Done.
For me it didn't work but someone on github mention that once you start typing, if the parameter hints show up, just press **ctrl + space** and it won't show up again. It was simple and easy!

Visual Studio Code Theming - change editor error indicator

Does the Visual Studio Code Theme Colour Reference have an entry for the red underscore used by the editor to signify, for example, a syntax error?
Yes, this was added in VSCode 1.13 (which is currently the vscode insider build). Try setting editorError.foreground
Here's a preview of some the other error/warning theming options coming in 1.13: https://github.com/Microsoft/vscode-docs/blob/vnext/release-notes/v1_13.md#theming

How to turn off formatter for a single file in VSCode?

I am using VSCode with editor.formatOnSave set to true. I want to turn off the formatter for a single file alone. Is there a way to do this?
I am using VSCode version 1.11.2 on Mac.