|
26 | 26 |
|
27 | 27 | (require 'docstr) |
28 | 28 |
|
29 | | -(declare-function docstr-writers-c++ "ext:docstr-c++.el") |
30 | | - |
31 | 29 | (defcustom docstr-go-style 'godoc |
32 | 30 | "Style specification for document string in Golang." |
33 | 31 | :type '(choice (const :tag "No specify" nil) |
34 | 32 | (const :tag "Document String in Golang" godoc)) |
35 | 33 | :group 'docstr) |
36 | 34 |
|
37 | | -(defcustom docstr-go-prefix "// " |
| 35 | +(defcustom docstr-go-prefix "" |
38 | 36 | "Prefix you use on each newline." |
39 | 37 | :type 'string |
40 | 38 | :group 'docstr) |
41 | 39 |
|
42 | 40 | (defun docstr-go-config-godoc () |
43 | 41 | "Configre for convention, GoDoc." |
44 | 42 | (docstr-util-default-format) |
45 | | - (setq-local docstr-go-prefix "// " |
46 | | - docstr-format-type "{%s}" |
| 43 | + (setq-local docstr-format-type "{%s}" |
47 | 44 | docstr-format-var "%s -" |
48 | 45 | docstr-show-type-name nil)) |
49 | 46 |
|
|
62 | 59 | (param-types (nth 0 paren-param-list)) |
63 | 60 | (param-vars (nth 1 paren-param-list)) |
64 | 61 | ;; Get the return data type. |
65 | | - (return-type-str (docstr-writers--return-type-behind search-string)) |
66 | | - docstring-type) |
67 | | - |
| 62 | + (return-type-str (docstr-writers--return-type-behind search-string))) |
68 | 63 | ;; Determine the docstring type. |
69 | | - (save-excursion |
70 | | - (backward-char 1) |
71 | | - (setq docstring-type (if (docstr-util-current-char-equal-p "/") |
72 | | - 'godoc 'javadoc))) |
73 | | - |
74 | | - (cl-case docstring-type |
75 | | - (javadoc (docstr-writers-c++ search-string)) |
76 | | - (godoc |
77 | | - (end-of-line) |
78 | | - (docstr-writers--insert-param param-types param-vars prefix) |
79 | | - (docstr-writers--insert-return return-type-str nil prefix) |
80 | | - (docstr-writers-after start t t t))))) |
| 64 | + (if (docstr-util-multiline-comment-p) (setq prefix "") (setq prefix "// ")) |
| 65 | + (end-of-line) |
| 66 | + (docstr-writers--insert-param param-types param-vars prefix) |
| 67 | + (docstr-writers--insert-return return-type-str nil prefix) |
| 68 | + (docstr-writers-after start t t t))) |
81 | 69 |
|
82 | 70 | ;;;###autoload |
83 | 71 | (defun docstr-trigger-golang (&rest _) |
|
0 commit comments