emacs-devel
[Top][All Lists]
Advanced

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

CC Mode -> Tree sitter challenge


From: Theodor Thornhill
Subject: CC Mode -> Tree sitter challenge
Date: Fri, 04 Nov 2022 21:34:18 +0100

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



reply via email to

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