mirror of
https://github.com/joaotavora/yasnippet.git
synced 2025-10-13 21:13:04 +00:00
Ignore trailing spaces in snippet definitions
Probably nobody wants a snippet `key` with a trailing space. It can be hard to differentiate from a `key` without trailing space. The default `<TAB>` behavior of yasnippet will never expand these. * yasnippet.el (yas--parse-template): Ignore trailing spaces in snippet definitions. * yasnippet-tests.el (deftest ignore-trailing-whitespace): New test for new behavior. Copyright-paperwork-exempt: yes
This commit is contained in:
parent
3aa7cb29d4
commit
1cf723a408
@ -123,6 +123,15 @@
|
|||||||
(should (looking-at "ble"))
|
(should (looking-at "ble"))
|
||||||
(should (null (yas--snippets-at-point)))))
|
(should (null (yas--snippets-at-point)))))
|
||||||
|
|
||||||
|
(ert-deftest ignore-trailing-whitespace ()
|
||||||
|
(should (equal
|
||||||
|
(with-temp-buffer
|
||||||
|
(insert "# key: foo\n# --\nfoo")
|
||||||
|
(yas--parse-template))
|
||||||
|
(with-temp-buffer
|
||||||
|
(insert "# key: foo \n# --\nfoo")
|
||||||
|
(yas--parse-template)))))
|
||||||
|
|
||||||
;; (ert-deftest in-snippet-undo ()
|
;; (ert-deftest in-snippet-undo ()
|
||||||
;; (with-temp-buffer
|
;; (with-temp-buffer
|
||||||
;; (yas-minor-mode 1)
|
;; (yas-minor-mode 1)
|
||||||
|
@ -1448,7 +1448,7 @@ Here's a list of currently recognized directives:
|
|||||||
(point-max)))
|
(point-max)))
|
||||||
(setq bound (point))
|
(setq bound (point))
|
||||||
(goto-char (point-min))
|
(goto-char (point-min))
|
||||||
(while (re-search-forward "^# *\\([^ ]+?\\) *: *\\(.*\\)$" bound t)
|
(while (re-search-forward "^# *\\([^ ]+?\\) *: *\\(.*?\\)[[:space:]]*$" bound t)
|
||||||
(when (string= "uuid" (match-string-no-properties 1))
|
(when (string= "uuid" (match-string-no-properties 1))
|
||||||
(setq uuid (match-string-no-properties 2)))
|
(setq uuid (match-string-no-properties 2)))
|
||||||
(when (string= "type" (match-string-no-properties 1))
|
(when (string= "type" (match-string-no-properties 1))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user