help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: JavaScript/TypeScript: What do people in 2024, on emacs 29, use for


From: Dmitry Gutov
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
User-agent: Mozilla Thunderbird

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 via email to

[Prev in Thread] Current Thread [Next in Thread]