[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#60805: [PATCH] Extend go-ts-mode with command to add docstring to fu
From: |
Theodor Thornhill |
Subject: |
bug#60805: [PATCH] Extend go-ts-mode with command to add docstring to function |
Date: |
Wed, 18 Jan 2023 12:59:43 +0100 |
Evgeni Kolev <evgenysw@gmail.com> writes:
> Regarding snippet support - I think it makes sense in general, but for
> this particular patch, not really.
>
> Go's docstrings don't typically follow a strict template, instead they
> are a human-readable comment which tries to be short but also describe
> any corner cases - very similar to Emacs' doc strings. I'm pasting
> below a few Go examples from https://go.dev/doc/comment
>
>> Is this really the best Emacs can do to produce such a comment? ... I'm
>> asking
>> whether Emacs could collect more information about the function, and provide
>> a
>> skeleton of a useful doc comment for the user to fill.
>
> Emacs could fill in the inputs and outputs as variable names but I
> don't think this will be very useful because the doc strings don't
> follow a strict template (as mentioned above). Something like this is
> an option:
>
> ```
> // sum accepts a and b and returns an int
> func sum(a, b int) int {
> return a + b
> }
> ```
Sure, I won't argue :)
What about something like this to locate the first comment above a
defun?
Theo
(defun move-to-top-comment ()
(interactive)
(save-restriction
(narrow-to-defun t)
(let ((comments (cdr (treesit-induce-sparse-tree
(treesit-buffer-root-node)
(lambda (n)
(equal (treesit-node-type n)
"comment"))))))
(goto-char
(apply #'treesit-node-start (car comments))))))
- bug#60805: [PATCH] Extend go-ts-mode with command to add docstring to function, Evgeni Kolev, 2023/01/14
- bug#60805: [PATCH] Extend go-ts-mode with command to add docstring to function, Eli Zaretskii, 2023/01/14
- bug#60805: [PATCH] Extend go-ts-mode with command to add docstring to function, Theodor Thornhill, 2023/01/14
- bug#60805: [PATCH] Extend go-ts-mode with command to add docstring to function, Eli Zaretskii, 2023/01/14
- bug#60805: [PATCH] Extend go-ts-mode with command to add docstring to function, Theodor Thornhill, 2023/01/14
- bug#60805: [PATCH] Extend go-ts-mode with command to add docstring to function, Evgeni Kolev, 2023/01/18
- bug#60805: [PATCH] Extend go-ts-mode with command to add docstring to function,
Theodor Thornhill <=
- bug#60805: [PATCH] Extend go-ts-mode with command to add docstring to function, Evgeni Kolev, 2023/01/20
- bug#60805: [PATCH] Extend go-ts-mode with command to add docstring to function, Theodor Thornhill, 2023/01/20
- bug#60805: [PATCH] Extend go-ts-mode with command to add docstring to function, Evgeni Kolev, 2023/01/20
- bug#60805: [PATCH] Extend go-ts-mode with command to add docstring to function, Evgeni Kolev, 2023/01/20
- bug#60805: [PATCH] Extend go-ts-mode with command to add docstring to function, Theodor Thornhill, 2023/01/20
- bug#60805: [PATCH] Extend go-ts-mode with command to add docstring to function, Randy Taylor, 2023/01/20
- bug#60805: [PATCH] Extend go-ts-mode with command to add docstring to function, Eshel Yaron, 2023/01/21
- bug#60805: [PATCH] Extend go-ts-mode with command to add docstring to function, Theodor Thornhill, 2023/01/21
- bug#60805: [PATCH] Extend go-ts-mode with command to add docstring to function, Evgeni Kolev, 2023/01/21
- bug#60805: [PATCH] Extend go-ts-mode with command to add docstring to function, Theodor Thornhill, 2023/01/21