Code Monkey home page Code Monkey logo

Comments (9)

rymndhng avatar rymndhng commented on May 17, 2024 3

Actually it does work out of the box! I am able to get this working by adding both hooks in my init.el, i.e for typescript:

(eval-after-load 'typescript-mode
    '(progn
       (add-hook 'typescript-mode-hook #'add-node-modules-path)
       (add-hook 'typescript-mode-hook #'prettier-js-mode)))

@rcoedo What do you think about adding that this to the README as a tip.

from prettier-emacs.

tauil avatar tauil commented on May 17, 2024 3

FYI: I had the same issue and fixed by updating my emacs exec-path.

(setenv "PATH" (concat (getenv "PATH") ":/usr/local/bin"))
    (setq exec-path (append exec-path '("/usr/local/bin")))

from prettier-emacs.

rymndhng avatar rymndhng commented on May 17, 2024 2

Is it possible for this to lean on https://github.com/codesuki/add-node-modules-path -- it seems undesirable when working in teams b/c the path is hard-coded.

from prettier-emacs.

rcoedo avatar rcoedo commented on May 17, 2024 1

@JuanCaicedo I have 0 knowledge of that part of emacs, but I tried customizing the variable via custom.el and it doesn't say it's unsafe for me.

If you have experience with defining customs, a PR would be appreciated!

from prettier-emacs.

rcoedo avatar rcoedo commented on May 17, 2024

I believe you may be able to do this already via the prettier-js-command defcustom 😄

from prettier-emacs.

JuanCaicedo avatar JuanCaicedo commented on May 17, 2024

Yes that worked well! I haven't been able to find a way to configure it globally, but for now I added a .dir-locals.el for the projects that use prettier

((nil
  (prettier-js-command
   .
   "/Users/JuanCaicedo/code/some-project/node_modules/\.bin/prettier")))

from prettier-emacs.

JuanCaicedo avatar JuanCaicedo commented on May 17, 2024

Although actually I get a command saying that it's not a safe variable. Maybe it should be marked as safe in the defcustom?

from prettier-emacs.

rcoedo avatar rcoedo commented on May 17, 2024

I didn't know about that one @rymndhng, seems like the way to solve this. I'm going to start using it too, thanks!

from prettier-emacs.

rcoedo avatar rcoedo commented on May 17, 2024

@rymndhng I think it can be very useful. Also, I'm adding this to my config right now 😄

Thanks!

from prettier-emacs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.