Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to format new syntax? #3587

Open
ajiho opened this issue Dec 4, 2024 · 0 comments
Open

Unable to format new syntax? #3587

ajiho opened this issue Dec 4, 2024 · 0 comments

Comments

@ajiho
Copy link

ajiho commented Dec 4, 2024

Summary

When the following code appears in the JS file, it cannot work

import navJson from "../nav.json" with { type: "json" };

Github Repository to Reproduce Issue

NOT REQUIRED

Steps To Reproduce:

NOT REQUIRED

Expected result

Can format normally

Actual result

SyntaxError: Unexpected token, expected

Additional information

image

VS Code Version:

版本: 1.95.1 (user setup)
提交: 65edc4939843c90c34d61f4ce11704f09d3e5cb6
日期: 2024-10-31T05:14:54.222Z
Electron: 32.2.1
ElectronBuildId: 10427718
Chromium: 128.0.6613.186
Node.js: 20.18.0
V8: 12.8.374.38-electron.0
OS: Windows_NT x64 10.0.19044

Prettier Extension Version:v11.0.0

OS and version:win10

Prettier Log Output

import navJson from "../nav.json" with { type: "json" };
  4 |
  5 | const config = JSON.parse(process.env.MY_ENV_CONFIGS);
SyntaxError: Unexpected token, expected "(" (2:43)
  1 | import { defineConfig } from "vitepress";
> 2 | import sidebar from "./sidebar.json" with { type: "json" };
    |                                           ^
  3 | import navJson from "../nav.json" with { type: "json" };
  4 |
  5 | const config = JSON.parse(process.env.MY_ENV_CONFIGS);
    at p (c:\Users\Administrator\.vscode\extensions\esbenp.prettier-vscode-11.0.0\node_modules\prettier\parser-babel.js:22:1054)
    at d (c:\Users\Administrator\.vscode\extensions\esbenp.prettier-vscode-11.0.0\node_modules\prettier\parser-babel.js:22:1287)
    at Object.parse (c:\Users\Administrator\.vscode\extensions\esbenp.prettier-vscode-11.0.0\node_modules\prettier\parser-babel.js:29:54501)
    at Object.parse (c:\Users\Administrator\.vscode\extensions\esbenp.prettier-vscode-11.0.0\node_modules\prettier\index.js:7515:23)
    at coreFormat (c:\Users\Administrator\.vscode\extensions\esbenp.prettier-vscode-11.0.0\node_modules\prettier\index.js:8829:18)
    at formatWithCursor2 (c:\Users\Administrator\.vscode\extensions\esbenp.prettier-vscode-11.0.0\node_modules\prettier\index.js:9021:18)
    at c:\Users\Administrator\.vscode\extensions\esbenp.prettier-vscode-11.0.0\node_modules\prettier\index.js:38183:12
    at Object.format (c:\Users\Administrator\.vscode\extensions\esbenp.prettier-vscode-11.0.0\node_modules\prettier\index.js:38197:12)
    at t.default.format (c:\Users\Administrator\.vscode\extensions\esbenp.prettier-vscode-11.0.0\dist\extension.js:1:16369)
    at t.PrettierEditProvider.provideEdits (c:\Users\Administrator\.vscode\extensions\esbenp.prettier-vscode-11.0.0\dist\extension.js:1:12927)
    at g$.provideDocumentFormattingEdits (file:///c:/Users/Administrator/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:137:134090)
["INFO" - 13:33:04] Formatting completed in 11ms.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant