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 run in the org mode source code block #38

Open
kkweon opened this issue Jul 2, 2018 · 4 comments
Open

Unable to run in the org mode source code block #38

kkweon opened this issue Jul 2, 2018 · 4 comments

Comments

@kkweon
Copy link

kkweon commented Jul 2, 2018

Steps to reproduce

  1. Create any org file temp.org
  2. Create a source code block
#+BEGIN_SRC js
  const a = {
    data: [],
    nextOffset: 1
  }
#+END_SRC
  1. Edit and run prettier-js
prettier errors:
[error] No parser could be inferred for file: /Users/kkweon/temp/temp.org[*Org Src temp.org[ js ]*]

Thank you.

@rcoedo
Copy link

rcoedo commented Jul 3, 2018

You could fix this using the custom variable prettier-js-args to specify the prettier parse you want to use.

@kkweon
Copy link
Author

kkweon commented Jul 3, 2018

And can still be used to format js, ts, json, less, scss ? It will force the parser?

@rcoedo
Copy link

rcoedo commented Jul 3, 2018

Yes, it forces the parser. You will have to set the variable to the right format for each one of these files. You could do this with hooks for example.

Edit: If you need more info on the prettier args you can run prettier --help in the command line.

@bcc32
Copy link

bcc32 commented Jul 12, 2021

Sorry to revive an old thread, but perhaps prettier could infer a reasonable extension from the major mode when there is no buffer-file-name, as is the case in org-mode source blocks?

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

3 participants