Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for various treesitter based modes #108

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

pksadiq
Copy link

@pksadiq pksadiq commented Jul 13, 2023

This commit adds support for c-ts-mode, python-ts-mode and
rust-ts-mode.

These modes are builtin modes included in GNU Emacs since 29.1

I have only added support for modes that I currently use.

@davidshepherd7
Copy link
Owner

Hi, thanks for this!

I'm happy to merge the adding rules for treesitter modes part as is.

The electric-operator-c-ts-is-function-parameter? function though I would need tests for. We might need to start running CI on newer versions to do that?

It also seems like it needs some tweaks to compile on old Emacs versions. Maybe just a (function local) require?

@davidshepherd7
Copy link
Owner

The failure on 25.3 looks unrelated, I think it's ok to ignore for this pr if the others pass.

@pksadiq pksadiq force-pushed the wip/sadiq/treesitter-modes branch 2 times, most recently from a19e3b1 to 1e07208 Compare July 23, 2023 05:50
@pksadiq
Copy link
Author

pksadiq commented Jul 23, 2023

function though I would need tests for. We might need to start running CI on newer versions to do that?

Yes. We shall require a CI with Emacs 29.x (which don't have a stable release yet).

I have added a local require, may be I can move it to the top as it won't error on fail.

In case the CI is still failing, I shall try setting up some system with an older Emacs to check.

@davidshepherd7
Copy link
Owner

Sorry about the overly strict ci approval thing, it should be fixed to just run without needing that now

@pksadiq pksadiq force-pushed the wip/sadiq/treesitter-modes branch from 1e07208 to ed7afe4 Compare July 26, 2023 03:44
@pksadiq
Copy link
Author

pksadiq commented Aug 1, 2023

Forgot to ping you after my last push

@davidshepherd7
Copy link
Owner

So I think I owe you an update on this: treesitter seems like it will make it possible to handle a lot more edge cases which is exciting, but right now I don't understand it. If you want to get this merged soon then I'll need some tests for the edge cases that the new code handles. I've updated the tested emacs versions on master and it sounds like the 29.1 build used should contain treesittter, so you can rebase and then you should be able to write some tests.

Otherwise: I'm working on getting my emacs config to work with 29.1 so that I can play around with treesitter. Once I've done that I'll be in a better place to write the tests myself. I don't have a lot of spare time these days though so that might be a while.

@davidshepherd7
Copy link
Owner

Oh, I've also changed another setting which will hopefully allow your CI checks to run without manual approval 🤞

This commit adds support for c-ts-mode, python-ts-mode and
rust-ts-mode.

These modes are builtin modes included in GNU Emacs since 29.1
@pksadiq
Copy link
Author

pksadiq commented Aug 31, 2023

Thanks for the update. I tried running the c-mode operator tests with c-ts-mode, and it fails in around 12 tests.

Can you add an empty c-ts-mode feature that would run only if emacs is version 29.1+? Or how can do that?

Also, I think the CI image with emacs 29.1 has builtin treesitter support, but the parsers (ie, treesitter-c, etc) are not available.

So far it's working fine for me without much hiccup. But I agree that it's better to be merged only after we have some tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants