Open marlinstrub opened 1 year ago
Make sure you have tree-sitter-mode
enabled in your buffer!
Ah my bad, I had indeed misconfigured tree-sitter. I think it's setup correctly now, at least syntax highlighting works with it.
I'm not sure if I'm using this package correctly though. Let me try to explain what I'm doing. I created a test file with the following content:
If I insert a new line above line 1 and type M-x ts-docstr-at-point
I get the following:
If I then place the cursor on line 7 (above auto baz ...
) and type M-x ts-docstr-at-point
again, nothing happens.
I noticed that the syntax highlighting is wrong after the first invocation of ts-docstr-at-point
. I can fix it by temporarily removing the second star of the opening comment identifier (/**
). If I do that and then place the cursor on line 7 and type M-x ts-docstr-at-point
again, another comment is inserted:
Notice how the syntax highlighting of that second comment is wrong again.
I observe the same behaviour when I try with emacs -Q
and load only the relevant packages. I'm on emacs version 29.0.50 (commit 8a5678906f).
Any pointers on how to fix this behaviour are much appreciated!
Yeah, I have the same experience and I suspect the issue is from the upstream tree-sitter-langs
. I think if you edit buffer with or without this package you will experience something like that (any packages/operations that modified the buffer directly). Can you try and confirm the behavior?
Emacs devel is working on built-in tree-sitter, so I'm not quite sure the route of all tree-sitter
packages (ts-docstr
, ts-fold
, tree-sitter-langs
, etc). I think we will eventually replace all Elisp API with the built-in one. Then I guess this issue will then be resolved?
Mhh. I don't use many packages that directly edit the buffer, but yasnippet
works, for example. Did you have a particular package in mind that you wanted me to test?
I agree that it could well be a problem with upstream tree-sitter
.
I think I have the same issue on python. After M-x ts-docstr-at-point
the syntax highlighting seems to be broken in the whole buffer. After saving, the syntax highlighting is back to normal.
We might need to refresh the AST or font-lock highlighting after the insertion.
Thanks for the library. I face the same issue for python mode
This package looks very promising. When I try
ts-docstr-at-point
I get the errorLanguage is either not supported or WIP... c++mode
.I load
tree-sitter
andts-docstr
as follows:I then visit a
cpp
file and callM-x ts-docstr-at-point
on a function.Am I doing this wrong?