본문 바로가기

webdesign/VisualStudio

VS setting / extension

관련글 : Extensions-in-Visual-Studio-Code-prettier


 

https://code.visualstudio.com/docs/getstarted/settings

 

Visual Studio Code User and Workspace Settings

How to modify Visual Studio Code User and Workspace Settings.

code.visualstudio.com

VS Code provides two different scopes for settings:

  • User Settings - Settings that apply globally to any instance of VS Code you open.
  • Workspace Settings - Settings stored inside your workspace and only apply when the workspace is opened.

1. Workspace Settings

A VS Code "workspace" is usually just your project root folder.

Workspace settings as well as debugging and task configurations are stored at the root in a .vscode folder.

You can learn more in the What is a VS Code "workspace"? article.

Workspace settings override user settings. Workspace settings are specific to a project and can be shared across developers on a project.

 

2. User Settings

2-1.  Settings editor / Settings file(settings.json) locations :

By default VS Code shows the Settings editor as belows :

  • On macOS - Code > Preferences > Settings

but you can still edit the underlying settings.json file by using the Open Settings (JSON) command or by changing your default settings editor with the workbench.settings.editor setting.

Depending on your platform, the user settings file is located here:

  • macOS $HOME/Library/Application Support/Code/User/settings.json

2-2. Language-specific editor settings :

1. cmd + shift + p

2. select "preferences: configure language specific settings"

3. select the language you wanna customize

4. then 'settings.json' file opens with your cusor located in the language entry

To customize your editor by language, run the global command Preferences: Configure Language Specific Settings (command ID: workbench.action.configureLanguageBasedSettings) from the Command Palette (⇧⌘P) which opens the language picker. Select the language you want, which then opens your user settings.json with the language entry where you can add applicable settings.

 

3. Save without formatting / Disable auto formatting

how do you not auto format code in VS on save : 

run 'save without formatting' from the command palette (cmd+shift+p)

 

---------------------------------------------------------

https://prettier.io/docs/en/ignore.html

Use .prettierignore to ignore (i.e. not reformat) certain files and folders completely.

Use “prettier-ignore” comments to ignore parts of files.

 

---------------------------------------------------------

https://bleepcoder.com/prettier-vscode/357256628/prettierignore-ignore-everything-except-specific-folder

# Ignore everything:

/*

# Except myapp folder:

!/myapp

 

 

https://www.codegrepper.com/code-examples/whatever/.prettierignore+file

prettier don't format line : 

// prettier-ignore JS
{/* prettier-ignore */} JSX
<!-- prettier-ignore --> HTML / Markdown
/* prettier-ignore */ CSS

 

To disable prettier for some specific part of a file : 
Read-> https://prettier.io/docs/en/ignore.html#ignoring-files

 

---------------------------------------------------------

https://prettier.io/docs/en/configuration.html

 

 

https://newbedev.com/javascript-vscode-prettier-scss-on-save-not-working-code-example

open visual studio code ->

go to view ->

open command palette ->

search for "format document with" ->

set prettier to default

 


Enable/Disable Format On Save

https://linuxpip.org/vscode-format-on-save/