Skip to content

Instantly share code, notes, and snippets.

@ninmonkey
Last active May 19, 2023 02:04
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ninmonkey/b2bbbe4c9ea6d90b6601b61ddb509b3e to your computer and use it in GitHub Desktop.
Save ninmonkey/b2bbbe4c9ea6d90b6601b61ddb509b3e to your computer and use it in GitHub Desktop.
LargeFilesConfig for Vscode .settings.json

Here's some settings that may help with performance

Properties to try first

  • Note: Autocomplete usually inserts templates for new settings with ctrl+space

  • Most of the time it'll complete valid keys if you type " then ctrl+space

  • "files.exclude": {}

  • "files.watcherExclude": {}

  • "search.exclude": {}

  // Controls whether to use `.gitignore` and `.ignore` files when searching for files.
  "search.useIgnoreFiles": true,
  "search.useGlobalIgnoreFiles": true,  

Delay loading extension loading until you open a ps1 file

// Do not show the Powershell Integrated Console banner on launch
// Starts PowerShell extension features automatically when a PowerShell file opens.
// If false, to start the extension, use the 'PowerShell: Restart Current Session'
// command. IntelliSense, code navigation, integrated console, code formatting, and other features are not enabled until the extension starts.
"powershell.startAutomatically": false,
// Shows the integrated console when the PowerShell extension is initialized.
"powershell.integratedConsole.showOnStartup": true,
"powershell.integratedConsole.suppressStartupBanner": false,
"powershell.promptToUpdatePackageManagement": false,
"powershell.promptToUpdatePowerShell": false,
"pester.autoDebugOnSave": true,

Dynamic rules

"files.exclude": {
    // Configure glob patterns for excluding files and folders. For example, the File Explorer decides which files and folders to show or hide based on this setting. Refer to the `#search.exclude#` setting to define search-specific excludes. Refer to the `#explorer.excludeGitIgnore#` setting for ignoring files based on your` .gitignore.  `
    "**/*.js": {        
        "when": "$(basename).min.js",
        "exclude": false,
    }, }
    
State Desc
if you have main.js and index.html both files are visible
main.js and main.min.js then min is hidden
if you have .min.js without a .main.js min.js is visible

Watchers

"files.watcherExclude": {
    // Configure paths or glob patterns to exclude from file watching. Paths or basic glob patterns that are relative (for example `build/output` or `*.js`) will be resolved to an absolute path using the currently opened workspace. Complex glob patterns must match on absolute paths (i.e. prefix with `**/` or the full path and suffix with `/**` to match files within a path) to match properly (for example `**/build/output/**` or `/Users/name/workspaces/project/build/output/**`). When you experience the file watcher process consuming a lot of CPU, make sure to exclude large folders that are of less interest (such as build output folders).
    "**/.export/**": true,
    "**/{.input,.export,.output}/*.{csv,json,jsonl,log,xlsx,zip,pbix,pbit}": true,
    "**/.export/**": true,
    "**/.output/**": true,
    "**/.git/objects/**": true,
    "**/.git/subtree-cache/**": true,
    "**/node_modules/*/**": true,
    "**/.hg/store/**": true
},
// Configure extra paths to watch for changes inside the workspace. By default, all workspace folders will be watched recursively, except for folders that are symbolic links. You can explicitly add absolute or relative paths to support watching folders that are symbolic links. Relative paths will be resolved to an absolute path using the currently opened workspace.
"files.watcherInclude": [],

Files Exclude

    // Controls whether to use `.gitignore` and `.ignore` files when searching for files.
    "search.useIgnoreFiles": true,
    "search.useGlobalIgnoreFiles": true,
    
"files.exclude": {    
    // "**/*.log": true, // sometimes off
    "**/*.exe": true,
    "**/*.lnk": true,
    "**/.git": true,    
    "**/*.pbix": true,
    "**/*.zip": true,
    "**/*.xlsx": true,
    "**/*.docx": true,
    "**/someLogs/*.log": true,  // some logs, but not all
    
    // venv, cache, or compiled
    // build artifacts, caches, etc...
    "**/node_modules": true,
    "**/venv/*": true,
    "**/*.aws-sam": true, 
    "**/*.py[co]": true,
    "**/__pycache__": true,

    // multi-depth, multi-pattern
    "**/export/*.{csv,json,jsonl,log,xlsx,zip,pbix,pbit}": true,
    // docs: <https://code.visualstudio.com/docs/editor/codebasics#_advanced-search-options>
    // Configure glob patterns for excluding files and folders. For example, the File Explorer decides which files and folders to show or hide based on this setting. Refer to the #search.exclude# setting to define search-specific excludes. Refer to the #explorer.excludeGitIgnore# setting for ignoring files based on your .gitignore.  
    "**/*.js": {        
        "when": "$(basename).min.js",
        "exclude": false,
    },
    
    "**/*.{exe,zip,7z,xlsx}": true,
    "**/*.zip": true,

    // # top level
    "{.output,.export,.input}": true,
    
},

search.exclude examples with when conditions

      
      // [1] files by extensions
      "files.exclude": {
          "/*.lnk": true
      },
      // [2] files with multiple extensions
      "files.exclude": {
          "/*.{ext1,ext2,ext3}": true
      },
      // [3] files with siblings by name
      "files.exclude": {
          "/*.source-extension": {
              "when": "$(basename).target-extension"
          }
      },
      // [4] folder by name (any location)
      "files.exclude": {
          "/name": true
      },
      // [5] folder by name (top level)
      "files.exclude": {
          "name": true
      },
      // [6] folders with multiple names (by level)
      "files.exclude": {
          "{folder1,folder2,folder3}": true
      },

basic search.exclude globs

// Configure glob patterns for excluding files and folders in fulltext searches and quick open. Inherits all glob patterns from the `files.exclude` setting. Read more about glob patterns [here](https://code.visualstudio.com/docs/editor/codebasics#_advanced-search-options).
"search.exclude": {
    "**/{.input,.export,.output}/*.{csv,json,jsonl,log,xlsx,zip,pbix,pbit}": true,
    "**/*.log": true,
    "**/*.lnk": true,
    "**/node_modules": true,
    "**/*.export/*.log": true, // should be redundant
    // "**/*.export/*.json": true,
    "**/bower_components": true,
    "**/*.code-search": true,
    "**/.aws-sam/": true,
    "**/.parcel-cache": true.
}

More to Collect

  • on-saves
    • pester addon: disable 'auto run on saves'
    • disable formatting on file save
    • disable auto-save before running debug (this is another setting)
  • delay in MS before calling for completions
  • search completer: change to only search open files for completions and for searcing
  • ensure gitignore setting is working (not just hide files, but the other setting can stop it from parsing those files too)
    • I think there's at least 2 or 3 settings that control what symbols to search for. vs code, powershell

Links, Docs, See more:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment