Prettier extension fails with "cannot format [filetype]-files" error on all file types

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

The Prettier VS Code extension fails in Cursor with the error message:

Extension 'Prettier - Code formatter' is configured as formatter but it cannot format 'XXX'-files

Where XXX changes based on the file type being edited (TypeScript, JSON, TypeScript JSX, JavaScript, etc.).

This occurs despite:

  • The extension being installed and enabled
  • Proper configuration in .vscode/settings.json
  • Prettier CLI working correctly (npx prettier --write formats files successfully)
  • The exact same configuration working perfectly in VS Code

Steps to Reproduce

  1. Install Prettier extension from Extensions marketplace ([email protected])

  2. Create .vscode/settings.json in your project:

    {
      "editor.defaultFormatter": "esbenp.prettier-vscode",
      "editor.formatOnSave": true,
      "[typescript]": {
        "editor.defaultFormatter": "esbenp.prettier-vscode"
      },
      "[typescriptreact]": {
        "editor.defaultFormatter": "esbenp.prettier-vscode"
      },
      "[json]": {
        "editor.defaultFormatter": "esbenp.prettier-vscode"
      }
    }
    
  3. Create .prettierrc in project root:

    {
      "plugins": ["prettier-plugin-tailwindcss"]
    }
    
  4. Open any TypeScript, TSX, or JSON file

  5. Try to save the file OR manually run “Format Document” (Shift+Alt+F)

  6. Observe error notification: “Extension ‘Prettier - Code formatter’ is configured as formatter but it cannot format ‘TypeScript’-files”

Expected Behavior

Prettier should format files on save without errors, just like it does in standard VS Code.

Files should be formatted:

  • :white_check_mark: Automatically on save
  • :white_check_mark: Via manual format command (Shift+Alt+F)
  • :white_check_mark: Without any error notifications

Actual Behavior

  • :cross_mark: Error notification appears for every file type
  • :cross_mark: Formatting does not occur
  • :cross_mark: Format on save fails silently
  • :white_check_mark: Prettier CLI (npx prettier --write file.ts) works correctly
  • :white_check_mark: The same configuration works perfectly in VS Code on the same machine

Error message examples:

  • Opening TypeScript file: “cannot format ‘TypeScript’-files”
  • Opening TSX file: “cannot format ‘TypeScript JSX’-files”
  • Opening JSON file: “cannot format ‘JSON’-files”

Operating System

Windows 10/11

Current Cursor Version (Menu → About Cursor → Copy)

  • Cursor Version: 2.3.41 (x64)
  • VS Code Version: 1.105.1 (x64)
  • OS: Windows 10.0.26200.7623
  • Prettier Extension Version: 12.1.0 (esbenp.prettier-vscode)
  • Prettier CLI Version: 3.8.0

Does this stop you from using Cursor

No - Cursor works, but with this issue

16 Likes

Hey, this is a known issue with the Prettier extension after a recent update.

There’s a workaround here: No longer eligible as formatter for many types of files · Issue #3906 · prettier/prettier-vscode · GitHub

The issue is on the Prettier VS Code plugin side (not a Cursor bug), but the workaround helps. A similar report was already closed yesterday: Prettier broke after updating Cursor to 2.39.41

Try the workaround from the GitHub issue, it should help. Let me know if it doesn’t work.

5 Likes

The issue is on the Prettier VS Code plugin side (not a Cursor bug)

Response from the maintainer:

This is an issue with Cursor not supporting the same Extension API as VSCode. I am only one person and I have a day job, nor do I actively use Cursor (or any of the other vscode forks) so my ability to work on this is limited. Without either Cursor fixing their API to match VSCode or the Cursor team contributing fixes for this, it’s unlikely this is going to be fixed any time soon.

I’m also gonna quote you from here:

You’ve identified a real limitation
 This means that while most extensions targeting VSCode 1.105 will work, ESM-specific features requiring runtime support won’t function. I’m escalating this to the team as it’s a valid compatibility gap for extension developers.

In the most non-aggressive way possible
 it sounds like it has been a Cursor bug since Nov 27.

3 Likes

This is not “solved”, Cursor extensions API should match VSCode, downgrading Prettier is not a solution

5 Likes

Agreed, it’s just a workaround which we expect to be fixed soon!

same error since todays update.

Workaround is not a “solve”

1 Like

We have identified the issue and are working on a fix, which we expect to be released in version 2.4. This update should be rolling out later this month.

8 Likes

Looking forward to it


When you type inside command palette >Developer: Show running extensions - it shows me that prettier on “Activating
” status.

I guess this is cursor’s bug, inside my vscode everything works fine.

Yes, facing the same issue.
quick fix as of now is to downgrade the prettier from v12 to v11.

It appears to be resolved in recent update. Check out version 2.4.2

3 Likes

its related new Prettier version i downgrade v12 to v11 its works.

6 Likes

ça a fonctionné pour moi

Guys I faced the same problem, I downgrade prettier version to 11.0 but still my ts. files didnt response to prettier thats why I hard coded these lines on my settings.json file
and it works for me you can try it

“editor.formatOnSave”: true,

“editor.defaultFormatter”: “esbenp.prettier-vscode”,

“[typescript]”: {

“editor.defaultFormatter”: “esbenp.prettier-vscode”

},

Why it is working in v11 and not working in v12

 "[typescript]": {
     "editor.defaultFormatter": "vscode.typescript-language-features"
  },
 "[typescriptreact]": {
     "editor.defaultFormatter": "vscode.typescript-language-features"
  },

Temporary help

It’s been a week, is there any update? is it working now in the latest version or still my code will continue looking ugly? :slightly_frowning_face:

It’s been a week, is there any update? is it working now in the latest version or still my code will continue looking ugly? :slightly_frowning_face:

There was another issue where Prettier v12 didn’t work on Windows. We have fixed the issue in version 2.4.22 of Cursor, which should be rolling out this week.

2 Likes