Skip to content

Commit 02d81db

Browse files
committed
Fix detect from go
1 parent d4b2e1c commit 02d81db

File tree

1 file changed

+8
-20
lines changed

1 file changed

+8
-20
lines changed

langs/docstr-go.el

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -26,24 +26,21 @@
2626

2727
(require 'docstr)
2828

29-
(declare-function docstr-writers-c++ "ext:docstr-c++.el")
30-
3129
(defcustom docstr-go-style 'godoc
3230
"Style specification for document string in Golang."
3331
:type '(choice (const :tag "No specify" nil)
3432
(const :tag "Document String in Golang" godoc))
3533
:group 'docstr)
3634

37-
(defcustom docstr-go-prefix "// "
35+
(defcustom docstr-go-prefix ""
3836
"Prefix you use on each newline."
3937
:type 'string
4038
:group 'docstr)
4139

4240
(defun docstr-go-config-godoc ()
4341
"Configre for convention, GoDoc."
4442
(docstr-util-default-format)
45-
(setq-local docstr-go-prefix "// "
46-
docstr-format-type "{%s}"
43+
(setq-local docstr-format-type "{%s}"
4744
docstr-format-var "%s -"
4845
docstr-show-type-name nil))
4946

@@ -62,22 +59,13 @@
6259
(param-types (nth 0 paren-param-list))
6360
(param-vars (nth 1 paren-param-list))
6461
;; 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)))
6863
;; 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)))
8169

8270
;;;###autoload
8371
(defun docstr-trigger-golang (&rest _)

0 commit comments

Comments
 (0)