KaranAhlawat / scala-ts-mode

A tree-sitter based Emacs major-mode for the Scala programming language
GNU General Public License v3.0
31 stars 4 forks source link

Comment starting position is not correctlty detected #17

Open kurnevsky opened 2 months ago

kurnevsky commented 2 months ago

(nth 8 (syntax-ppss)) returns nil when point is inside a comment which is not correct, see https://www.gnu.org/software/emacs/manual/html_node/elisp/Parser-State.html

For strings it works fine.

kurnevsky commented 2 months ago

It doesn't work only for // comments, but for /* */ it's fine.

KaranAhlawat commented 2 months ago

May I ask what the use case is for this?

kurnevsky commented 2 months ago

I have my own function that I bind to <end> key that goes not to the line end but to the end of code, i.e. place where comment starts if any: https://github.com/kurnevsky/nixfiles/blob/461069fcbf63411d716df51847ac77b3b01afbb8/modules/emacs/init.el#L1634-L1657

It works everywhere except for scala-ts-mode :)

KaranAhlawat commented 2 months ago

Alright, I'm not very well versed with Emacs syntax-tables but I'll try to see what it's about.

In the meantime, PRs are welcome if you have any clues as to how to solve this issue