all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Dmitry Gutov <dmitry@gutov.dev>
To: Steinar Bang <sb@dod.no>, help-gnu-emacs@gnu.org
Subject: Re: JavaScript/TypeScript: What do people in 2024, on emacs 29, use for .js, .jsx, .ts and .tsx?
Date: Tue, 9 Jan 2024 19:32:31 +0200	[thread overview]
Message-ID: <77493010-0b8f-4173-88ed-e726b89a3fad@gutov.dev> (raw)
In-Reply-To: <yqoonkla5pek8o0.fsf@dod.no>

On 09/01/2024 14:12, Steinar Bang wrote:
> So I decided to see what came up as default on emacs 29.
> 
> What I get according to 'C-h m', is:
>   The major mode is JavaScript[JSX] mode defined in js.el:
> 
> JSX tag syntax seems to be highlighted correctly and indentations seems
> to be correct (I'm usinghttps://github.com/editorconfig/editorconfig-emacs  ).
> 
> But there doesn't seem to be the same electric tag splitting behaviour I
> have on JSX mode...? Though that may be a configuration possibility...?
> 
> What do others use?
> 
> And what about typescript?
> 
> I don't like typescript so I don't use that in any of my private
> projects, but when working with frontends I have to adapt.
> 
> Last time I worked with typescript (2021-2022) I think I ended up with
> something called tide and web-mode for the .ts and .tsx files, while
> staying with rjsx-mode for .js and .jsx files.
> 
> I don't know if that's still the way to go for typescript or if the
> built-in javascript mode now handles typescript?

js-mode handles JSX indeed, but it's inevitaby limited in what it 
understands about its syntax (it uses sgml-mode under the covers to do 
highlighting, but I'm sure there would be odd edge cases).

The latest new option in 29.1 is js-ts-mode (which uses tree-sitter 
parser and supports JSX too). It should provide the most accurate 
highlighting and reliable indentation, but some features (like tag 
splitting?) might have to be reimplemented anew. Should be easier to do 
that using tree-sitter parse tree than with sgml-mode. Perhaps if 
rjsx-mode has an implementation, it wouldn't be too hard to port it.



  reply	other threads:[~2024-01-09 17:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-09 12:12 JavaScript/TypeScript: What do people in 2024, on emacs 29, use for .js, .jsx, .ts and .tsx? Steinar Bang
2024-01-09 17:32 ` Dmitry Gutov [this message]
2024-01-10 16:21   ` Steinar Bang
2024-01-13  7:30     ` Steinar Bang
2024-01-14 21:00       ` Dmitry Gutov
2024-01-22 13:54         ` Steinar Bang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=77493010-0b8f-4173-88ed-e726b89a3fad@gutov.dev \
    --to=dmitry@gutov.dev \
    --cc=help-gnu-emacs@gnu.org \
    --cc=sb@dod.no \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.