New answers tagged


Indentation in js2-mode is not as customizable as indentation in C mode. As such it's not possible to do this outside of changing the source code for js2-mode itself. Like you, I like to have statements inside a function indented relative to the function keyword, so I added this code to the middle of the js2-bounce-indent function: ;; Fifth likely point: ...


Solved: After some digging it turns out the solution is actually really simple you just need to tell web mode to act the same for.js and .jsx files by adding this line into your emacs config: (setq web-mode-content-types-alist '(("jsx" . "\\.js[x]?\\'")))


With web-mode, make sure your treating your code as React, not JavaScript. Using your init file, and saving your example code to a file with a .js extension, I get the behavior you describe. Saving your example code to a .jsx file, the html is syntax highlighted and indented properly. To specify ReactJS vs JavaScript you could mess with web-mode-content-...


Use (ffip). What ~ means does not matter. ffip will try to find file in project root using the file name under cursor. Example,

Top 50 recent answers are included