unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* CC Mode -> Tree sitter challenge
@ 2022-11-04 20:34 Theodor Thornhill
  2022-11-04 20:36 ` Theodor Thornhill
                   ` (3 more replies)
  0 siblings, 4 replies; 24+ messages in thread
From: Theodor Thornhill @ 2022-11-04 20:34 UTC (permalink / raw)
  To: emacs-devel; +Cc: Eli Zaretskii, casouri, Stefan Monnier


Hi Eli and others!

So you challenged me to add some more modes that are supported in CC
Mode, but not using CC Mode.  I finally got some free hours, so here's
my first follow-up to your "show me the code".

In this repo[0] you will find support for the following modes:

- javascript  (this is already in tree-sitter branch - but adding
  without cc mode here)
- c
- c++
- java
- css
- JSON
- TypeScript (left out, as it is in tree-sitter branch already)

So - some notes:

1. This is still very early, but I wanted to put it out there so that
others more knowledgeable than me could chime in on some of the
languages. C++ in particular is a language I don't code in, and is
notoriously complex.

2. I've focused mostly on indentation and font locking.  Indentation is
using xdisp code style and the gnu style in general.

3. There's some support for navigation

4. I'll make Imenu, which-func and other goodies later.  I want it to be
usable first.

5. Most other CC mode features such as electric-foo and whitespace
cleanup should be possible to do with constructs outside of cc mode.

When scrolling through xdisp with this variant of C support it is
noticeably faster on my system.  However, I'd like some guidance on how
to provide some benchmarks to prove my guess.  Loading said file and
immediately going to EOB is instant, but in CC Mode takes a little less
than a second.

@Stefan, you mentioned that filling could be extracted from cc
mode. Could you point me either to what/where to look for/at, so that I
can make such an attempt?

Please don't dismiss this with arguments such as "it's a fruit salad",
"there's no indentation styles" and other arguments.  These are things
that can be adjusted as we move forward.  I have a plan for indentation
styles, but haven't made my initial suggestion there.

If anyone on this list could try some of these I would be eternally
grateful, please add suggestions and/or bug reports either here on this
list or at the issue tracker[1].  I'll keep on pushing commits unless
some of you say this is a non-starter.

-- 
Theo

[0]: https://git.sr.ht/~theo/tree-sitter-modes
[1]: https://todo.sr.ht/~theo/tree-sitter



^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2022-11-07  8:05 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-04 20:34 CC Mode -> Tree sitter challenge Theodor Thornhill
2022-11-04 20:36 ` Theodor Thornhill
2022-11-04 20:38 ` Stefan Monnier
2022-11-04 20:44   ` Theodor Thornhill
2022-11-04 23:10 ` Yuan Fu
2022-11-05  7:56   ` Theodor Thornhill
2022-11-06  1:01     ` Yuan Fu
2022-11-06  5:54       ` Theodor Thornhill
2022-11-05  9:13 ` Eli Zaretskii
2022-11-05 13:12   ` Theodor Thornhill
2022-11-05 13:31     ` Eli Zaretskii
2022-11-05 13:42       ` Theodor Thornhill
2022-11-05 14:37       ` Theodor Thornhill
2022-11-05 14:55         ` Eli Zaretskii
2022-11-05 15:06           ` Theodor Thornhill
2022-11-05 15:27             ` Theodor Thornhill
2022-11-05 16:38               ` Theodor Thornhill
2022-11-05 16:43                 ` Eli Zaretskii
2022-11-06  1:13                 ` Yuan Fu
2022-11-06  6:04                   ` Theodor Thornhill
2022-11-07  0:11                     ` Yuan Fu
2022-11-07  8:05                       ` Theodor Thornhill
2022-11-05 14:34   ` Stefan Monnier
2022-11-05 14:46     ` Theodor Thornhill

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).