tree-sitter-rust icon indicating copy to clipboard operation
tree-sitter-rust copied to clipboard

Expose doc comment contents

Open the-mikedavis opened this issue 1 year ago • 4 comments

#195 parsed doc comments but it exposed the nodes for the doc comment markers (!//) rather than the content of the comments. The comment content is useful for injecting markdown into the comments:

; injections.scm
([(line_comment !doc) (block_comment !doc)] @injection.content
 (#set! injection.language "comment"))

((doc_comment) @injection.content
 (#set! injection.language "markdown")
 (#set! injection.combined))

I've also changed the line doc comment slightly to fix an issue with the marker node (it unnecessarily consumed the character after the ///) and to include the line's line-ending, which is useful to tree-sitter-markdown.

~cc @ProfDoof I've only made the change to line comments, I may need some help to make block comments have the same structure~

Block comment changes are included as well.

the-mikedavis avatar Feb 17 '24 14:02 the-mikedavis

removed package brightnessctl from here to be added into the package file, as your requested changes

Pratyay360 avatar Feb 10 '24 06:02 Pratyay360

still this should be added as an commented option.

killajoe avatar Feb 29 '24 01:02 killajoe

have raised pull request in the package section

Pratyay360 avatar Feb 29 '24 14:02 Pratyay360

The question about why it should be added and if the current implementation is causing any issue is still open.

killajoe avatar Feb 29 '24 21:02 killajoe

I would have no issue to add the option commented, with the info that it is alternative to the one that is set-up already.. and indeed that you will need to install the package to use the option. I will not change a working implementation and add packages to the list of the install process without any reason.

killajoe avatar Feb 29 '24 21:02 killajoe