Skip to content

Commit c61f1be

Browse files
committed
Impls swift entry
1 parent da7aa2e commit c61f1be

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

docstr-key.el

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,9 @@ document string."
111111
(if (docstr-util-multiline-comment-p)
112112
(docstr-key-insert-prefix)
113113
(docstr-key-single-line-prefix-insertion))
114-
(when new-doc-p
114+
(when (and new-doc-p
115+
;; Make sure end symbol */ still at the back
116+
(not (docstr-util-current-line-empty-p)))
115117
;; We can't use `newline-and-indent' here, or else the space will be gone.
116118
(progn (insert "\n") (indent-for-tab-command))
117119
(forward-line -1))

docstr-writers.el

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,7 @@ RESTORE-PT is non-nil, go back to starting position."
292292
(ruby-mode . docstr-writers-ruby)
293293
(rust-mode . docstr-writers-rust)
294294
(scala-mode . docstr-writers-scala)
295+
(swift-mode . docstr-writers-swift)
295296
(typescript-mode . docstr-writers-typescript)
296297
(web-mode . docstr-writers-php))
297298
"List of writers to each `major-mode'."

docstr.el

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,8 @@ variable. Argument DESC is the description of VAR."
167167
(lua-mode . ("RET" docstr-trigger-lua-return))
168168
(python-mode . ("\"" docstr-trigger-python))
169169
(ruby-mode . ("#" docstr-trigger-ruby))
170-
(rust-mode . ("/" docstr-trigger-rust)))
170+
(rust-mode . ("/" docstr-trigger-rust))
171+
(swift-mode . ("/" docstr-trigger-swift)))
171172
"List of trigger to each `major-mode'.
172173
173174
The data is a cons cell form by (mode-name . (key function)). The first
@@ -186,9 +187,8 @@ You should customize this variable to add your own triggeration methods."
186187
(dolist (tri docstr-trigger-alist)
187188
(let* ((mode (car tri)) (data (cdr tri))
188189
(key (nth 0 data)) (fnc (nth 1 data)))
189-
(when (eq major-mode mode)
190-
(if act (docstr-util-key-advice-add key :after fnc)
191-
(docstr-util-key-advice-remove key fnc))))))
190+
(if act (docstr-util-key-advice-add key :after fnc)
191+
(docstr-util-key-advice-remove key fnc)))))
192192

193193
(defun docstr--enable ()
194194
"Enable `docstr' in current buffer."
@@ -231,7 +231,7 @@ You should customize this variable to add your own triggeration methods."
231231
'(lua)
232232
'(php python)
233233
'(ruby rust)
234-
'(scala)
234+
'(scala swift)
235235
'(typescript))
236236
"List of supported languages.")
237237

@@ -352,6 +352,7 @@ See function `docstr--get-search-string' description for argument TYPE."
352352
(ruby-mode . docstr-ruby-prefix)
353353
(rust-mode . docstr-rust-prefix)
354354
(scala-mode . docstr-scala-prefix)
355+
(swift-mode . docstr-swift-prefix)
355356
(typescript-mode . docstr-typescript-prefix)
356357
(web-mode . docstr-php-prefix))
357358
"Assocaition list for (major-mode . name).

0 commit comments

Comments
 (0)