-
-
Notifications
You must be signed in to change notification settings - Fork 183
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
Update README.md to explain the differences (incl. benefits and caveats) of js2-mode
versus other packages
#596
Comments
Those are good questions. It would be great if others were to comment on this as well, and/or if someone wanted to start on such a FAQ. My own usage of JavaScript has been fairly limited in the recent years -- e.g. I've only (mostly) done pure JS, no React, and Angular or Vue.
Finally, I also recommend people try the major modes using tree-sitter currently incubating inside Emacs 29. |
Perhaps @felipeochoa, @jacksonrayhamilton or @mishoo have something to add regarding their own experience. |
I mostly use typescript these days -- typescript-mode for .ts, web-mode for .tsx. web-mode is frustrating, but the least bad option. I wrote rjsx out of frustration with web-mode, and because I wanted to keep using js2-refactor. Which I miss sorely now that I write TS. Here are a couple of old posts that describe my JS setup. https://news.ycombinator.com/item?id=24119721 https://www.reddit.com/r/emacs/comments/8e24t9/writing_reactjsx_in_2018_what_addons_do_you_all/dxuuz7j/?context=3. Not much has changed except I rarely use js2/rsjx anymore. If I were writing a guide, I'd probably suggest something like: If you want reasonable out-of-the-box functionality and don't care about extensibility, use LSP-based modes. If you want total control and a hackable setup, use js2/rjsx/typescript/web mode. I typically only use js-mode on gigantic JS files (typically output by a bundler) where the performance of js2/rjsx is not good enough (but I'm not yet using the JIT -- might not be relevant anymore).
|
Hey @felipeochoa thanks for the reply. And if by JIT you mean native compilation, then last I checked (or read), the speedup is around 2x on average. Not bad, but not revolutionary, so gigantic files still won't work too well in I'm also curious what your opinion on |
Nowadays I am working with TypeScript+React and for that I use Back when I had more free time to code, I added JSX highlighting and indentation support to
I was a |
I post here my own experience since I asked the same questions. As a React developer, I used Few months ago I needed to edit TSX files and could not find a solution that really matched my needs. So I ended by writing jtsx package which provides 2 major modes,
@jacksonrayhamilton , what do you mean by |
@llemaitre19 Looking in your package, it seems the main reasons to have major modes in there (as opposed to only minor modes) are 1) backporting fixes missing in Emacs 29.1 (a good thing), b) some new indentation features. Have you tried filing bug reports for b) to have them in |
Speaking of setups for React that people use, here's from a recent post on Reddit:
|
As soon as I do some hack to work around a bug in |
If you can't configure it to your liking, in general it's a missing feature. Feature requests are also sent through |
Copilot, etc |
First, let me be frank, I have not used
js2-mode
. That's not a reflection on the package or anything in particular, but a reflection on just how confusing it is to figure what to use and what not to use in Emacs for web development. I don't believe I am alone in this problem. I am not sure if I needjs2-mode
or not and if there would be conflicts with other packages (or if those other packages would even be needed). I believe alljs2-mode
does is add some parsing and advanced syntax highlighting on-top ofjs-mode
, but I am not totally sure of that and the code is far too large/long to really spend the time digging through it (it's just a big ol' file).It looks the README has not been updated in a few years and the aforementioned problem seems to come up a lot, at least in my searching online. There is often tremendous confusion regarding what pro's and con's there are to
js2-mode
vsjs-mode
. As well, where doesweb-mode
andrjsx-mode
fit in to all of it? What about TypeScript? etc.While I don't think any single package bears all of the responsibility of "explain the differences" or answering all the questions; however, I do think it can help people understand the pro's and con's of the package presented if the package's README can explain (in relatively high-level detail) the benefits and caveats of their package versus other packages in the same sphere. This is often done for the more popular packages as they get lots of attention and questions.
I know there is a section for React / JSX in the README, but it doesn't touch upon the caveats of
rjsx-mode
that it alludes too. What are those?I guess, in a nutshell, it would be nice to have a "
js2-mode
in relation to other packages" / "FAQ" section that may help address common questions folks have:js-mode
andjs2-mode
?js2-mode
andrjsx-mode
?js2-mode
andweb-mode
?js2-mode
recommended for TypeScript syntax highlighting/etc. support? If not, what is?js2-mode
recommended for React/Angular/Vue support? If not, what are?Thoughts?
The text was updated successfully, but these errors were encountered: