Skip to content

Poor caching of config files #3926

@CodeSmith32

Description

@CodeSmith32

Preflight Checklist

Issue Summary

When setting up prettier, the extension seems to cache the config file. After that, changing the config has no effect until either 1. we rename the config file, or 2. we restart the extension.

Reproduction Repository

https://github.com/CodeSmith32/test-dummy

Steps to Reproduce

  1. Download the example Stackblitz project, and open in VSCode. (https://stackblitz.com/edit/dummy-vnc8agfb?file=package.json,.prettierrc.json&terminal=dev)
Image
  1. Install this extension (obviously).
  2. Run npm install in the integrated terminal.
  3. Open the .prettierrc.json file, and change the tabWidth setting to 4, and save.
  4. Open up src/counter.ts and re-run formatting (save, use the shortcut, etc.)

At this point, the tab size of 4 does not apply.

  1. Now, rename .prettierrc.json to .prettierrc.
  2. Re-run formatting on counter.ts.

Now it works.

  1. Now, change the tabWidth setting back to 2 and save.
  2. Re-run formatting on src/counter.ts.

Again, it does not work.

  1. Open up extensions in VSCode.
  2. Find and disable Prettier - Code Formatter
  3. Restart extensions.
  4. Re-enable Prettier - Code Formatter
  5. Re-run formatting on counter.ts.

Now it works.

Expected Behavior

The extension should not require renaming the prettier config file, or restarting the extension just to get it to detect a config change.

Actual Behavior

Changes to the prettier config files are not immediately respected by the extension.

Operating System

Windows

IDE

VSCode

IDE Version

Version: 1.108.1 (system setup) Commit: 585eba7c0c34fd6b30faac7c62a42050bfbc0086 Date: 2026-01-14T14:55:44.241Z Electron: 39.2.7 ElectronBuildId: 12953945 Chromium: 142.0.7444.235 Node.js: 22.21.1 V8: 14.2.231.21-electron.0 OS: Windows_NT x64 10.0.26200

Prettier Extension Version

12.1.1

Prettier Version

3.8.0

Prettier Extension Logs

["INFO" - 7:11:26 PM] Extension Name: esbenp.prettier-vscode.
["INFO" - 7:11:26 PM] Extension Version: 12.1.1.
["INFO" - 7:11:46 PM] Using config file at c:\Users\CS32\Desktop\dummy\.prettierrc.json
["INFO" - 7:11:46 PM] EditorConfig support is enabled, checking for .editorconfig files
["INFO" - 7:11:46 PM] Resolved config:
{
  "arrowParens": "always",
  "trailingComma": "es5",
  "experimentalTernaries": false,
  "tabWidth": 2,
  "semi": true,
  "printWidth": 80,
  "endOfLine": "lf"
}
["INFO" - 7:11:59 PM] Formatting file:///c%3A/Users/CS32/Desktop/dummy/.prettierrc.json
["INFO" - 7:11:59 PM] Using config file at c:\Users\CS32\Desktop\dummy\.prettierrc.json
["INFO" - 7:11:59 PM] EditorConfig support is enabled, checking for .editorconfig files
["INFO" - 7:11:59 PM] Resolved config:
{
  "arrowParens": "always",
  "trailingComma": "es5",
  "experimentalTernaries": false,
  "tabWidth": 2,
  "semi": true,
  "printWidth": 80,
  "endOfLine": "lf"
}
["INFO" - 7:11:59 PM] PrettierInstance:
{
  "version": "3.8.0",
  "prettierModule": {
    "__debug": {},
    "util": {},
    "doc": {
      "builders": {
        "line": {
          "type": "line"
        },
        "softline": {
          "type": "line",
          "soft": true
        },
        "hardline": [
          {
            "type": "line",
            "hard": true
          },
          {
            "type": "break-parent"
          }
        ],
        "literalline": [
          {
            "type": "line",
            "hard": true,
            "literal": true
          },
          {
            "type": "break-parent"
          }
        ],
        "lineSuffixBoundary": {
          "type": "line-suffix-boundary"
        },
        "cursor": {
          "type": "cursor"
        },
        "breakParent": {
          "type": "break-parent"
        },
        "trim": {
          "type": "trim"
        },
        "hardlineWithoutBreakParent": {
          "type": "line",
          "hard": true
        },
        "literallineWithoutBreakParent": {
          "type": "line",
          "hard": true,
          "literal": true
        }
      },
      "printer": {},
      "utils": {}
    },
    "version": "3.8.0"
  },
  "modulePath": "c:\\Users\\CS32\\Desktop\\dummy\\node_modules\\prettier"
}
["WARN" - 7:11:59 PM] Unable to resolve ignore path: .prettierignore for c:\Users\CS32\Desktop\dummy\.prettierrc.json
["INFO" - 7:11:59 PM] Resolved plugins:
[]
["INFO" - 7:11:59 PM] File Info:
{
  "ignored": false,
  "inferredParser": "json"
}
["INFO" - 7:11:59 PM] Using local configuration (VS Code configuration will not be used)
["INFO" - 7:11:59 PM] Prettier Options:
{
  "filepath": "c:\\Users\\CS32\\Desktop\\dummy\\.prettierrc.json",
  "parser": "json",
  "arrowParens": "always",
  "trailingComma": "es5",
  "experimentalTernaries": false,
  "tabWidth": 2,
  "semi": true,
  "printWidth": 80,
  "endOfLine": "lf"
}
["INFO" - 7:11:59 PM] Formatting completed in 49ms.
["INFO" - 7:12:12 PM] Using config file at c:\Users\CS32\Desktop\dummy\.prettierrc.json
["INFO" - 7:12:12 PM] EditorConfig support is enabled, checking for .editorconfig files
["INFO" - 7:12:12 PM] Resolved config:
{
  "arrowParens": "always",
  "trailingComma": "es5",
  "experimentalTernaries": false,
  "tabWidth": 2,
  "semi": true,
  "printWidth": 80,
  "endOfLine": "lf"
}
["INFO" - 7:12:14 PM] Formatting file:///c%3A/Users/CS32/Desktop/dummy/src/counter.ts
["INFO" - 7:12:14 PM] Using config file at c:\Users\CS32\Desktop\dummy\.prettierrc.json
["INFO" - 7:12:14 PM] EditorConfig support is enabled, checking for .editorconfig files
["INFO" - 7:12:14 PM] Resolved config:
{
  "arrowParens": "always",
  "trailingComma": "es5",
  "experimentalTernaries": false,
  "tabWidth": 2,
  "semi": true,
  "printWidth": 80,
  "endOfLine": "lf"
}
["INFO" - 7:12:14 PM] PrettierInstance:
{
  "version": "3.8.0",
  "prettierModule": {
    "__debug": {},
    "util": {},
    "doc": {
      "builders": {
        "line": {
          "type": "line"
        },
        "softline": {
          "type": "line",
          "soft": true
        },
        "hardline": [
          {
            "type": "line",
            "hard": true
          },
          {
            "type": "break-parent"
          }
        ],
        "literalline": [
          {
            "type": "line",
            "hard": true,
            "literal": true
          },
          {
            "type": "break-parent"
          }
        ],
        "lineSuffixBoundary": {
          "type": "line-suffix-boundary"
        },
        "cursor": {
          "type": "cursor"
        },
        "breakParent": {
          "type": "break-parent"
        },
        "trim": {
          "type": "trim"
        },
        "hardlineWithoutBreakParent": {
          "type": "line",
          "hard": true
        },
        "literallineWithoutBreakParent": {
          "type": "line",
          "hard": true,
          "literal": true
        }
      },
      "printer": {},
      "utils": {}
    },
    "version": "3.8.0"
  },
  "modulePath": "c:\\Users\\CS32\\Desktop\\dummy\\node_modules\\prettier"
}
["WARN" - 7:12:14 PM] Unable to resolve ignore path: .prettierignore for c:\Users\CS32\Desktop\dummy\src\counter.ts
["INFO" - 7:12:14 PM] Resolved plugins:
[]
["INFO" - 7:12:14 PM] File Info:
{
  "ignored": false,
  "inferredParser": "typescript"
}
["INFO" - 7:12:14 PM] Using local configuration (VS Code configuration will not be used)
["INFO" - 7:12:14 PM] Prettier Options:
{
  "filepath": "c:\\Users\\CS32\\Desktop\\dummy\\src\\counter.ts",
  "parser": "typescript",
  "arrowParens": "always",
  "trailingComma": "es5",
  "experimentalTernaries": false,
  "tabWidth": 2,
  "semi": true,
  "printWidth": 80,
  "endOfLine": "lf"
}
["INFO" - 7:12:14 PM] Formatting completed in 73ms.
["INFO" - 7:12:23 PM] Using config file at c:\Users\CS32\Desktop\dummy\.prettierrc.json
["INFO" - 7:12:23 PM] EditorConfig support is enabled, checking for .editorconfig files
["INFO" - 7:12:23 PM] Resolved config:
{
  "arrowParens": "always",
  "trailingComma": "es5",
  "experimentalTernaries": false,
  "tabWidth": 2,
  "semi": true,
  "printWidth": 80,
  "endOfLine": "lf"
}
["INFO" - 7:12:25 PM] Using config file at c:\Users\CS32\Desktop\dummy\.prettierrc
["INFO" - 7:12:25 PM] EditorConfig support is enabled, checking for .editorconfig files
["INFO" - 7:12:25 PM] Resolved config:
{
  "arrowParens": "always",
  "trailingComma": "es5",
  "experimentalTernaries": false,
  "tabWidth": 4,
  "semi": true,
  "printWidth": 80,
  "endOfLine": "lf"
}
["INFO" - 7:12:30 PM] Using config file at c:\Users\CS32\Desktop\dummy\.prettierrc
["INFO" - 7:12:30 PM] EditorConfig support is enabled, checking for .editorconfig files
["INFO" - 7:12:30 PM] Resolved config:
{
  "arrowParens": "always",
  "trailingComma": "es5",
  "experimentalTernaries": false,
  "tabWidth": 4,
  "semi": true,
  "printWidth": 80,
  "endOfLine": "lf"
}
["INFO" - 7:12:31 PM] Formatting file:///c%3A/Users/CS32/Desktop/dummy/src/counter.ts
["INFO" - 7:12:31 PM] Using config file at c:\Users\CS32\Desktop\dummy\.prettierrc
["INFO" - 7:12:31 PM] EditorConfig support is enabled, checking for .editorconfig files
["INFO" - 7:12:31 PM] Resolved config:
{
  "arrowParens": "always",
  "trailingComma": "es5",
  "experimentalTernaries": false,
  "tabWidth": 4,
  "semi": true,
  "printWidth": 80,
  "endOfLine": "lf"
}
["INFO" - 7:12:31 PM] PrettierInstance:
{
  "version": "3.8.0",
  "prettierModule": {
    "__debug": {},
    "util": {},
    "doc": {
      "builders": {
        "line": {
          "type": "line"
        },
        "softline": {
          "type": "line",
          "soft": true
        },
        "hardline": [
          {
            "type": "line",
            "hard": true
          },
          {
            "type": "break-parent"
          }
        ],
        "literalline": [
          {
            "type": "line",
            "hard": true,
            "literal": true
          },
          {
            "type": "break-parent"
          }
        ],
        "lineSuffixBoundary": {
          "type": "line-suffix-boundary"
        },
        "cursor": {
          "type": "cursor"
        },
        "breakParent": {
          "type": "break-parent"
        },
        "trim": {
          "type": "trim"
        },
        "hardlineWithoutBreakParent": {
          "type": "line",
          "hard": true
        },
        "literallineWithoutBreakParent": {
          "type": "line",
          "hard": true,
          "literal": true
        }
      },
      "printer": {},
      "utils": {}
    },
    "version": "3.8.0"
  },
  "modulePath": "c:\\Users\\CS32\\Desktop\\dummy\\node_modules\\prettier"
}
["WARN" - 7:12:31 PM] Unable to resolve ignore path: .prettierignore for c:\Users\CS32\Desktop\dummy\src\counter.ts
["INFO" - 7:12:31 PM] Resolved plugins:
[]
["INFO" - 7:12:31 PM] File Info:
{
  "ignored": false,
  "inferredParser": "typescript"
}
["INFO" - 7:12:31 PM] Using local configuration (VS Code configuration will not be used)
["INFO" - 7:12:31 PM] Prettier Options:
{
  "filepath": "c:\\Users\\CS32\\Desktop\\dummy\\src\\counter.ts",
  "parser": "typescript",
  "arrowParens": "always",
  "trailingComma": "es5",
  "experimentalTernaries": false,
  "tabWidth": 4,
  "semi": true,
  "printWidth": 80,
  "endOfLine": "lf"
}
["INFO" - 7:12:31 PM] Formatting completed in 19ms.
["INFO" - 7:12:37 PM] Using config file at c:\Users\CS32\Desktop\dummy\.prettierrc
["INFO" - 7:12:37 PM] EditorConfig support is enabled, checking for .editorconfig files
["INFO" - 7:12:37 PM] Resolved config:
{
  "arrowParens": "always",
  "trailingComma": "es5",
  "experimentalTernaries": false,
  "tabWidth": 4,
  "semi": true,
  "printWidth": 80,
  "endOfLine": "lf"
}
["INFO" - 7:12:39 PM] Formatting file:///c%3A/Users/CS32/Desktop/dummy/.prettierrc
["INFO" - 7:12:39 PM] Using config file at c:\Users\CS32\Desktop\dummy\.prettierrc
["INFO" - 7:12:39 PM] EditorConfig support is enabled, checking for .editorconfig files
["INFO" - 7:12:39 PM] Resolved config:
{
  "arrowParens": "always",
  "trailingComma": "es5",
  "experimentalTernaries": false,
  "tabWidth": 4,
  "semi": true,
  "printWidth": 80,
  "endOfLine": "lf"
}
["INFO" - 7:12:39 PM] PrettierInstance:
{
  "version": "3.8.0",
  "prettierModule": {
    "__debug": {},
    "util": {},
    "doc": {
      "builders": {
        "line": {
          "type": "line"
        },
        "softline": {
          "type": "line",
          "soft": true
        },
        "hardline": [
          {
            "type": "line",
            "hard": true
          },
          {
            "type": "break-parent"
          }
        ],
        "literalline": [
          {
            "type": "line",
            "hard": true,
            "literal": true
          },
          {
            "type": "break-parent"
          }
        ],
        "lineSuffixBoundary": {
          "type": "line-suffix-boundary"
        },
        "cursor": {
          "type": "cursor"
        },
        "breakParent": {
          "type": "break-parent"
        },
        "trim": {
          "type": "trim"
        },
        "hardlineWithoutBreakParent": {
          "type": "line",
          "hard": true
        },
        "literallineWithoutBreakParent": {
          "type": "line",
          "hard": true,
          "literal": true
        }
      },
      "printer": {},
      "utils": {}
    },
    "version": "3.8.0"
  },
  "modulePath": "c:\\Users\\CS32\\Desktop\\dummy\\node_modules\\prettier"
}
["WARN" - 7:12:39 PM] Unable to resolve ignore path: .prettierignore for c:\Users\CS32\Desktop\dummy\.prettierrc
["INFO" - 7:12:39 PM] Resolved plugins:
[]
["INFO" - 7:12:39 PM] File Info:
{
  "ignored": false,
  "inferredParser": "yaml"
}
["INFO" - 7:12:39 PM] Using local configuration (VS Code configuration will not be used)
["INFO" - 7:12:39 PM] Prettier Options:
{
  "filepath": "c:\\Users\\CS32\\Desktop\\dummy\\.prettierrc",
  "parser": "yaml",
  "arrowParens": "always",
  "trailingComma": "es5",
  "experimentalTernaries": false,
  "tabWidth": 4,
  "semi": true,
  "printWidth": 80,
  "endOfLine": "lf"
}
["INFO" - 7:12:39 PM] Formatting completed in 20ms.
["INFO" - 7:12:52 PM] Using config file at c:\Users\CS32\Desktop\dummy\.prettierrc
["INFO" - 7:12:52 PM] EditorConfig support is enabled, checking for .editorconfig files
["INFO" - 7:12:52 PM] Resolved config:
{
  "arrowParens": "always",
  "trailingComma": "es5",
  "experimentalTernaries": false,
  "tabWidth": 4,
  "semi": true,
  "printWidth": 80,
  "endOfLine": "lf"
}
["INFO" - 7:12:53 PM] Formatting file:///c%3A/Users/CS32/Desktop/dummy/src/counter.ts
["INFO" - 7:12:53 PM] Using config file at c:\Users\CS32\Desktop\dummy\.prettierrc
["INFO" - 7:12:53 PM] EditorConfig support is enabled, checking for .editorconfig files
["INFO" - 7:12:53 PM] Resolved config:
{
  "arrowParens": "always",
  "trailingComma": "es5",
  "experimentalTernaries": false,
  "tabWidth": 4,
  "semi": true,
  "printWidth": 80,
  "endOfLine": "lf"
}
["INFO" - 7:12:53 PM] PrettierInstance:
{
  "version": "3.8.0",
  "prettierModule": {
    "__debug": {},
    "util": {},
    "doc": {
      "builders": {
        "line": {
          "type": "line"
        },
        "softline": {
          "type": "line",
          "soft": true
        },
        "hardline": [
          {
            "type": "line",
            "hard": true
          },
          {
            "type": "break-parent"
          }
        ],
        "literalline": [
          {
            "type": "line",
            "hard": true,
            "literal": true
          },
          {
            "type": "break-parent"
          }
        ],
        "lineSuffixBoundary": {
          "type": "line-suffix-boundary"
        },
        "cursor": {
          "type": "cursor"
        },
        "breakParent": {
          "type": "break-parent"
        },
        "trim": {
          "type": "trim"
        },
        "hardlineWithoutBreakParent": {
          "type": "line",
          "hard": true
        },
        "literallineWithoutBreakParent": {
          "type": "line",
          "hard": true,
          "literal": true
        }
      },
      "printer": {},
      "utils": {}
    },
    "version": "3.8.0"
  },
  "modulePath": "c:\\Users\\CS32\\Desktop\\dummy\\node_modules\\prettier"
}
["WARN" - 7:12:53 PM] Unable to resolve ignore path: .prettierignore for c:\Users\CS32\Desktop\dummy\src\counter.ts
["INFO" - 7:12:53 PM] Resolved plugins:
[]
["INFO" - 7:12:53 PM] File Info:
{
  "ignored": false,
  "inferredParser": "typescript"
}
["INFO" - 7:12:53 PM] Using local configuration (VS Code configuration will not be used)
["INFO" - 7:12:53 PM] Prettier Options:
{
  "filepath": "c:\\Users\\CS32\\Desktop\\dummy\\src\\counter.ts",
  "parser": "typescript",
  "arrowParens": "always",
  "trailingComma": "es5",
  "experimentalTernaries": false,
  "tabWidth": 4,
  "semi": true,
  "printWidth": 80,
  "endOfLine": "lf"
}
["INFO" - 7:12:53 PM] Formatting completed in 22ms.


############################################################################

RESTARTING EXTENSIONS CLEARS OUTPUT HERE

############################################################################

["INFO" - 7:13:34 PM] Extension Name: esbenp.prettier-vscode.
["INFO" - 7:13:34 PM] Extension Version: 12.1.1.
["INFO" - 7:13:49 PM] Using config file at c:\Users\CS32\Desktop\dummy\.prettierrc
["INFO" - 7:13:49 PM] EditorConfig support is enabled, checking for .editorconfig files
["INFO" - 7:13:49 PM] Resolved config:
{
  "arrowParens": "always",
  "trailingComma": "es5",
  "experimentalTernaries": false,
  "tabWidth": 2,
  "semi": true,
  "printWidth": 80,
  "endOfLine": "lf"
}
["INFO" - 7:13:51 PM] Formatting file:///c%3A/Users/CS32/Desktop/dummy/src/counter.ts
["INFO" - 7:13:51 PM] Using config file at c:\Users\CS32\Desktop\dummy\.prettierrc
["INFO" - 7:13:51 PM] EditorConfig support is enabled, checking for .editorconfig files
["INFO" - 7:13:51 PM] Resolved config:
{
  "arrowParens": "always",
  "trailingComma": "es5",
  "experimentalTernaries": false,
  "tabWidth": 2,
  "semi": true,
  "printWidth": 80,
  "endOfLine": "lf"
}
["INFO" - 7:13:51 PM] PrettierInstance:
{
  "version": "3.8.0",
  "prettierModule": {
    "__debug": {},
    "util": {},
    "doc": {
      "builders": {
        "line": {
          "type": "line"
        },
        "softline": {
          "type": "line",
          "soft": true
        },
        "hardline": [
          {
            "type": "line",
            "hard": true
          },
          {
            "type": "break-parent"
          }
        ],
        "literalline": [
          {
            "type": "line",
            "hard": true,
            "literal": true
          },
          {
            "type": "break-parent"
          }
        ],
        "lineSuffixBoundary": {
          "type": "line-suffix-boundary"
        },
        "cursor": {
          "type": "cursor"
        },
        "breakParent": {
          "type": "break-parent"
        },
        "trim": {
          "type": "trim"
        },
        "hardlineWithoutBreakParent": {
          "type": "line",
          "hard": true
        },
        "literallineWithoutBreakParent": {
          "type": "line",
          "hard": true,
          "literal": true
        }
      },
      "printer": {},
      "utils": {}
    },
    "version": "3.8.0"
  },
  "modulePath": "c:\\Users\\CS32\\Desktop\\dummy\\node_modules\\prettier"
}
["WARN" - 7:13:51 PM] Unable to resolve ignore path: .prettierignore for c:\Users\CS32\Desktop\dummy\src\counter.ts
["INFO" - 7:13:51 PM] Resolved plugins:
[]
["INFO" - 7:13:51 PM] File Info:
{
  "ignored": false,
  "inferredParser": "typescript"
}
["INFO" - 7:13:51 PM] Using local configuration (VS Code configuration will not be used)
["INFO" - 7:13:51 PM] Prettier Options:
{
  "filepath": "c:\\Users\\CS32\\Desktop\\dummy\\src\\counter.ts",
  "parser": "typescript",
  "arrowParens": "always",
  "trailingComma": "es5",
  "experimentalTernaries": false,
  "tabWidth": 2,
  "semi": true,
  "printWidth": 80,
  "endOfLine": "lf"
}
["INFO" - 7:13:51 PM] Formatting completed in 77ms.

Prettier Configuration

{
  "arrowParens": "always",
  "trailingComma": "es5",
  "experimentalTernaries": false,
  "tabWidth": 2,
  "semi": true,
  "printWidth": 80,
  "endOfLine": "lf"
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingneed-more-infoFurther information is requestedtriage-pendingAwaiting initial triage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions