|
From: | Dmitry Gutov |
Subject: | Re: JavaScript/TypeScript: What do people in 2024, on emacs 29, use for .js, .jsx, .ts and .tsx? |
Date: | Sun, 14 Jan 2024 23:00:04 +0200 |
User-agent: | Mozilla Thunderbird |
On 13/01/2024 09:30, Steinar Bang wrote:
Steinar Bang <sb@dod.no>: Dmitry Gutov <dmitry@gutov.dev>: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.I'll do a dive into the rjsx code and see if I can identify where it does tag splitting and post back on the thread here.Harder than I thought... parsing and manipulation of the buffer seems interweaved, but perhaps here: https://github.com/felipeochoa/rjsx-mode/blob/master/rjsx-mode.el#L452
Doesn't look like that: rjsx-parse-xml seems like a routine to parse and return an xml parse node.
If you have something like <Home/> and you type a ">" after "Home", i.e. <Home></> then the "</>" is immediately expanded to "</Home>" <Home></Home>
Seems like it's the command called 'rjsx-electric-gt' defined here: https://github.com/felipeochoa/rjsx-mode/blob/b697fe4d92cc84fa99a7bcb476f815935ea0d919/rjsx-mode.el#L916
And it, sort of, kind of, looks like the above code is the one doing it, maybe...? (Couldn't figure out where js2-DIV and friends were defined so I don't know what it matches)
js2-DIV is defined in js2-mode.el (which is a dependency). The value is a number which denoted the node type. But might be unnecessary, given the above.
[Prev in Thread] | Current Thread | [Next in Thread] |