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

Definitions don't stand out #192

Open
monnier opened this issue Dec 31, 2024 · 12 comments
Open

Definitions don't stand out #192

monnier opened this issue Dec 31, 2024 · 12 comments

Comments

@monnier
Copy link
Contributor

monnier commented Dec 31, 2024

The font-lock rules put the same face (font-lock-function-name-face) on function definitions as on function calls.
It makes it harder to see the definitions at a glance, and does not follow the usual practice of most other major modes I use.
Personally I'd be happy to see function calls in the default face, but you really care about using a different face, font-lock-function-call-face would be a good choice.

@josteink
Copy link
Member

josteink commented Jan 3, 2025

Hey Stefan.

Thanks for the bug-report. I haven’t verified, but you are probably right.

Just to be clear, is this bug report about the «legacy» typescript-mode and a fix wanted there? Or are you using the new typescript-ts-mode?

@monnier
Copy link
Contributor Author

monnier commented Jan 3, 2025

Yes, it's about typescript-mode, not typescript-ts-mode (maybe that applies there as well, but I haven't bothered to check).

@josteink
Copy link
Member

josteink commented Jan 14, 2025

Right. In that case, I'll have to confess I've stopped actively maintaining typescript-mode, and right now I'm personally only using typescript-ts-mode.

Basically what you're suggesting is that we should improve the parsing to be able to distinguish between what is a method-definition and what is a method-call, in a pretty complicated and flexible language.

But the reason we decided to go with tree-sitter for typescript in the first place, was because the grammar was getting too complex to manage in Elisp alone.

So based on that, I won't try to improve this major-mode or do anything active to try to get this issue closed.

On the flip side, if someone want's to contribute a patch/PR, I will be happy test review, test and merge.

Sounds fair? (Sorry about the delay)

@monnier
Copy link
Contributor Author

monnier commented Jan 14, 2025 via email

@josteink
Copy link
Member

It seems like you've accidentally removed/deleted the patch?

But if you have a patch ready, just create a PR for it, and I'll get it merged if it looks reasonable!

@monnier
Copy link
Contributor Author

monnier commented Jan 15, 2025 via email

@josteink
Copy link
Member

josteink commented Jan 16, 2025

Sorry to be a bonehead about this, but I've tried all the different ways I can imagine to manually apply the patch, but I can't get it to merge cleanly.

$ git apply typescript-mode.patch
error: patch failed: typescript-mode.el:1
error: typescript-mode.el: patch does not apply
$ patch typescript-mode.el  typescript-mode.patch
patching file typescript-mode.el
12 out of 12 hunks failed--saving rejects to typescript-mode.el.rej
$ patch <typescript-mode.patch
patching file typescript-mode.el
12 out of 12 hunks failed--saving rejects to typescript-mode.el.rej
$

I really appreciate these patches though, so it would really help me out if you could send those patches as a PR here on Github, or tell me what I'm doing wrong 😄

@monnier
Copy link
Contributor Author

monnier commented Jan 17, 2025 via email

@josteink
Copy link
Member

Right. That merged cleanly.

Based on that, I've created a PR to ensure all the usual testing and verification is done prior to merging. And it seems some of the tests which used to pass are now failing.

You can see the build results here: https://github.com/emacs-typescript/typescript.el/actions/runs/12835889011/job/35796344055?pr=193

Some tests are probably expected to fail (due to intentionally altered behaviour), but some others may not be. I think as the author of the patch you are probably best suited to make that decision.

Now trying to run the tests locally (make test), I see that can easily fail if you don't have a particular esoteric tool (eask installed), so I can't blame you for not having been able to run and verify that prior to sending the patch.

So to make that easier, I've merged a quick fix which should allow make test to run without any other dependencies into git master: 8818e76

Could you update your nongnu-branch, and see if you can sort the tests out?

@monnier
Copy link
Contributor Author

monnier commented Jan 17, 2025 via email

@monnier
Copy link
Contributor Author

monnier commented Jan 18, 2025 via email

@josteink
Copy link
Member

Looks good to me. Isolating the function-call vs function-definition as its own method seems like a reasonable approach.

Thanks for the contribution. Consider it merged!

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

No branches or pull requests

2 participants