question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add --suggest-parser command line flag

See original GitHub issue

The --parser flag tells prettier which parser to use, overriding the auto-detection mechanism.

Could you add a similar --suggest-parser flag? This flag would tell prettier which parser to use if auto-detection fails.

I believe we need this for editor integration. The format-all plug-in for Emacs lets people format code in unsaved temporary buffers that have no filename. But in this case the plug-in knows which programming language mode is being used in Emacs for the temporary buffer, and can pass the information to prettier.

Related issue/PR:

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
fiskercommented, Jun 28, 2022
$ npx prettier --file-info foo.jsx
{ "ignored": false, "inferredParser": "babel" }

Is this what you are looking for?

(Seems we missed this flag in docs, cc @kachkaev https://github.com/prettier/prettier/pull/4341)

0reactions
lassikcommented, Jun 28, 2022

Fair enough. Let’s go with --file-info.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Custom command-line flags with flag.Func - Alex Edwards
This makes it much easier to define and use custom command-line flags in your application. For example, if you want to parse a...
Read more >
Setting a flag using a command-line argument with Argparse4j
I am using argparse4j to parse command line arguments. I want to add an argument that when present, sets a boolean to true,...
Read more >
How to specify command line flags - The Chromium Projects
How to specify command line flags. This page has been merged into the more complete: https://www.chromium.org/developers/how-tos/run-chromium-with-flags.
Read more >
Command-Line Flags - Go by Example
Command -line flags are a common way to specify options for command-line programs. ... Go provides a flag package supporting basic command-line flag...
Read more >
Declaring Arguments, Options, and Flags | Documentation
Declaring Arguments, Options, and Flags. Use the @Argument , @Option and @Flag property wrappers to declare the command-line interface for your command.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found