prettier-vscode icon indicating copy to clipboard operation
prettier-vscode copied to clipboard

Markdown parser not found using the web-based editor

Open mathieu1 opened this issue 2 years ago • 2 comments

Summary

Markdown parser is not found when using the web-based editor.

Github Repository to Reproduce Issue

This repository

Steps To Reproduce:

  1. Open the VS Code web-based editor on this repo
  2. Make sure the Prettier extension is installed and enabled
  3. Open README.md for editing
  4. Remove the second line (between header and first paragraph)
  5. Save

Expected result

Format-on-save is supposed to happen, re-introducing the blank line between the header and the text

Actual result

Nothing happens.

Additional information

Format-on-save works for *.js and *.json files at least: after modifying e.g. .eslint.js and saving, format-on-save works correctly.

VS Code Version:

Version: 1.65.2 Commit: c722ca6c7eed3d7987c0d5c3df5c45f6b15e77d1 Date: 2022-03-10T14:33:30.517Z (19 hrs ago) Browser: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:97.0) Gecko/20100101 Firefox/97.0

Prettier Extension Version:

v9.3.0

OS and version:

Intel Mac OS X 10.15

Prettier Log Output

["INFO" - 11:20:24] Extension Name: dev.prettier-vscode.
["INFO" - 11:20:24] Extension Version: 0.0.0.
["INFO" - 11:20:24] Using standalone prettier
["INFO" - 11:20:24] Using standalone prettier
["INFO" - 11:20:29] Formatting vscode-vfs://github/prettier/prettier-vscode/README.md
["INFO" - 11:20:29] Using standalone prettier
["INFO" - 11:20:29] File Info:
{
  "ignored": false,
  "inferredParser": null
}
["WARN" - 11:20:29] Parser not inferred, trying VS Code language.
["ERROR" - 11:20:29] Failed to resolve a parser, skipping file. If you registered a custom file extension, be sure to configure the parser.

mathieu1 avatar Mar 11 '22 10:03 mathieu1

I'm running into this issue as well for markdown and JSON files. JS files format as expected.

Startup output:

["INFO" - 4:39:08 PM] Extension Name: dev.prettier-vscode.
["INFO" - 4:39:08 PM] Extension Version: 0.0.0.
["INFO" - 4:39:08 PM] Using standalone prettier
["INFO" - 4:39:08 PM] Using standalone prettier

Markdown file output:

["INFO" - 4:37:24 PM] Formatting vscode-vfs://github-path-to-my-repo/foo.md
["INFO" - 4:37:24 PM] Using standalone prettier
["INFO" - 4:37:24 PM] File Info:
{
  "ignored": false,
  "inferredParser": null
}
["WARN" - 4:37:24 PM] Parser not inferred, trying VS Code language.
["ERROR" - 4:37:24 PM] Failed to resolve a parser, skipping file. If you registered a custom file extension, be sure to configure the parser.

JSON file output:

["INFO" - 4:35:06 PM] Formatting vscode-vfs://github-path-to-my-repo/bar.json
["INFO" - 4:35:06 PM] Using standalone prettier
["INFO" - 4:35:06 PM] File Info:
{
  "ignored": false,
  "inferredParser": null
}
["WARN" - 4:35:06 PM] Parser not inferred, trying VS Code language.
["ERROR" - 4:35:06 PM] Failed to resolve a parser, skipping file. If you registered a custom file extension, be sure to configure the parser.

keawade avatar Apr 08 '22 20:04 keawade

Yep, seeing this as well when trying to edit and tweak Markdown files in various PRs. Would be great to see this fixed!

markerikson avatar May 22 '22 18:05 markerikson

It is quite weird, this one. I even defined the override to tell prettier which parser to use, but it still gives the same error.

My .prettierrc:

{
  "printWidth": 80,
  "proseWrap": "preserve",
  "endOfLine": "lf",
  "tabWidth": 4,
  "overrides": [
    {
      "files": "*.md",
      "options": {
        "parser": "markdown",
        "printWidth": 80,
        "proseWrap": "always"
      }
    }
  ]
}

marcelocra avatar Feb 25 '23 11:02 marcelocra

This issue has been labeled as stale due to inactivity. Reply to keep this issue open.

github-actions[bot] avatar Apr 27 '23 01:04 github-actions[bot]

Still very much a problem last time I checked.

markerikson avatar Apr 27 '23 02:04 markerikson

Same thing, with vscode 1.78. and prettier v9.12.0 Prettier stopped formating

br3d avatar May 09 '23 09:05 br3d

Same here using Turborepo with Svelte and Astro.

prettierrc
// eslint-disable-next-line unicorn/prefer-module, no-undef
module.exports = {
  semi: false,
  proseWrap: "always",
  printWidth: 120,
  pluginSearchDirs: ["."],
  overrides: [
    {
      files: "*.md",
      options: {
        printWidth: 90,
      },
    },
    {
      files: "*.svelte",
      options: {
        parser: "svelte",
      },
      plugins: ["prettier-plugin-svelte", "prettier-plugin-tailwindcss"],
      svelteStrictMode: true,
    },
    {
      files: "*.astro",
      options: {
        parser: "astro",
      },
      plugins: ["prettier-plugin-astro", "prettier-plugin-tailwindcss"],
    },
  ],
};

muuvmuuv avatar May 17 '23 18:05 muuvmuuv

This issue has been labeled as stale due to inactivity. Reply to keep this issue open.

github-actions[bot] avatar Jul 17 '23 02:07 github-actions[bot]

This issue has been labeled as stale due to inactivity. Reply to keep this issue open.

Still seeing this issue. This is the web-based editor version (using Chrome (but same error in Edge as well)):

Version: 1.81.1
Commit: 6c3e3dba23e8fadc360aed75ce363ba185c49794
Date: 2023-08-09T22:27:10.293Z
Browser: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36

Prettier version: 10.1.0

mikaello avatar Aug 29 '23 19:08 mikaello

Still the same error! Seems It was closed because no one was handling it.

haochuan9421 avatar Sep 17 '23 07:09 haochuan9421

@ntotten can you reopen this issue and prevent it from being auto-closed? It's still relevant.

Or @mathieu1 could create a new issue...

karlhorky avatar Dec 09 '23 14:12 karlhorky

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

github-actions[bot] avatar Mar 09 '24 00:03 github-actions[bot]