Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prettier freezing VS Code in SvelteKit project

Unless I disable the Prettier extension for my SvelteKit project, VS Code gradually gets slower and slower until it's unusable and saving a small file can take up to 30 seconds. Disabling the extension resolved the issue.

I'm using VS Code 1.77.3, OS: Windows_NT x64.

How can I debug what is going wrong and why it's running so slow, and what could be the cause of the issue?

.prettierrc:

{
    "useTabs": true,
    "singleQuote": true,
    "trailingComma": "none",
    "printWidth": 100,
    "plugins": ["prettier-plugin-svelte", "prettier-plugin-tailwindcss"],
    "pluginSearchDirs": ["."],
    "overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }]
}

.eslitrc:

module.exports = {
    root: true,
    parser: '@typescript-eslint/parser',
    extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'prettier'],
    plugins: ['svelte3', '@typescript-eslint'],
    ignorePatterns: ['*.cjs'],
    overrides: [{ files: ['*.svelte'], processor: 'svelte3/svelte3' }],
    settings: {
        'svelte3/typescript': () => require('typescript')
    },
    parserOptions: {
        sourceType: 'module',
        ecmaVersion: 2020
    },
    env: {
        browser: true,
        es2017: true,
        node: true
    }
};

.postcss.config.cjs

const tailwindcss = require("tailwindcss");
const autoprefixer = require("autoprefixer");

const config = {
  plugins: [
    //Some plugins, like tailwindcss/nesting, need to run before Tailwind,
    tailwindcss(),
    //But others, like autoprefixer, need to run after,
    autoprefixer
  ]
};

module.exports = config;

tailwind.config.cjs

const config = {
    content: ['./src/**/*.{html,js,svelte,ts}'],
    theme: {
        extend: {}
    },

    plugins: [require('daisyui')]
};

module.exports = config;

Running extensions (without Prettier) Running Extensions 1 Running Extensions 2 Running Extensions 3

Update 22.05 I tried reproducing the issue by starting with a "clean" slate, so I downloaded Visual Studio Code - Insiders and installed the newest versions of the extensions, and the issue was reproduced when installing the same plugins.

like image 234
Rudy Avatar asked May 04 '26 18:05

Rudy


1 Answers

Based on my experience, the decrease in speed is not caused directly by Prettier. Rather, it is caused by other extensions that are installed in Visual Studio Code and affect the formatting. You should investigate whether any of the active extensions are generating errors.

After some test I personally found that disabling "Tailwind CSS IntelliSense" is helping a lot on my vs-code env.

like image 140
MacTheZazou Avatar answered May 07 '26 13:05

MacTheZazou



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!