Skip to content

Instantly share code, notes, and snippets.

@teshanshanuka
Last active September 10, 2024 17:52
Show Gist options
  • Save teshanshanuka/88aaeffd5bde83be01980ee9f24c7872 to your computer and use it in GitHub Desktop.
Save teshanshanuka/88aaeffd5bde83be01980ee9f24c7872 to your computer and use it in GitHub Desktop.

VSCode Configs

Configs

  1. Change font

    (Powerline font to suport my $PS1 with a git character: see .zshrc, and need apt install fonts-powerline/ powerline-fonts-git for arch)

     "terminal.integrated.fontFamily": "FiraCode Nerd Font Mono"
    
  2. Add rulers

     "editor.rulers": [
         120
     ]
    
  3. Autosave

    "files.autoSave": "afterDelay",
    "files.autoSaveDelay": 5000,
    
  4. Exclude watch/ files/ search

    Specify the exclude patterns in "files.watcherExclude"/ "files.exclude"/ "search.exclude"

    "files.watcherExclude": {
        "**/.git/objects/**": true,
        "**/.git/subtree-cache/**": true,
        "**/node_modules/**": true,
        "**/lib/**": true,
        "**/.yarn/**": true,
        "**/tmp/**": true,
        "**/.git": true,
        "**/.svn": true,
        "**/.hg": true,
        "**/CVS": true,
        "**/.DS_Store": true,
        "**/node_modules": true,
        "**/lib": true,
        "**/.yarn": true,
        "**/build": true,
        "**/dist/**": true,
        "**/log/**": true,
        "**/logs/**": true,
        "**/.fdk/**": true,
        "**/venv/**": true,
        "**/*.pyc": true
    }
    
  5. Formatters

     // pip install black
     "python.formatting.provider": "black",
     "python.formatting.blackArgs": ["--line-length", "120"],
    
     // With prettier extension
     "prettier.printWidth": 120,
     "[javascript]": {
         "editor.defaultFormatter": "esbenp.prettier-vscode",
         "editor.formatOnSave": true
     },
    
     // Get config/values available -> $ clang-format -style=google -dump-config
     "C_Cpp.clang_format_fallbackStyle": "{ BasedOnStyle: Google, IndentWidth: 4, ColumnLimit: 120 }",
     "[cpp]": {
         "editor.defaultFormatter": "ms-vscode.cpptools"
     }
    
  6. Misc

    "extensions.ignoreRecommendations": true, // less popups
    "editor.minimap.autohide": true,
    "editor.tabCompletion": "on",
    "editor.unicodeHighlight.nonBasicASCII": false,
    "editor.minimap.renderCharacters": false, // better performance
    

C++

  1. Show string variables in debug

    In debug console, -exec -enable-pretty-printing

    or add "setupCommands": [ { "text": "-enable-pretty-printing" } ] to launch.json

    This says it is already set by default now but was not in v1.66.2

TS/JS

  1. Setting prettier as default formatter for js/ts
    "[javascript]": {
         "editor.defaultFormatter": "esbenp.prettier-vscode",
     },
     "[typescript]": {
         "editor.defaultFormatter": "esbenp.prettier-vscode"
     },
     "[typescriptreact]": {
         "editor.defaultFormatter": "esbenp.prettier-vscode"
     },
    
  2. Prettier configuration to make code look better
     "prettier.printWidth": 120,
     "prettier.singleQuote": true,
     "prettier.tabWidth": 2,
     "prettier.useTabs": false,
     "prettier.semi": true,
     "prettier.trailingComma": "es5",
     "prettier.arrowParens": "avoid",
     "prettier.endOfLine": "auto",
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment