X-Git-Url: https://code.delx.au/gnu-emacs-elpa/blobdiff_plain/8952cfe3906b5b3817e04ec4c1bf956cdcc6a45f..971eea5ba3ff339ea6129cebff1fa2457fc9a6dc:/company-yasnippet.el diff --git a/company-yasnippet.el b/company-yasnippet.el index 93e6eb299..e5fded4d1 100644 --- a/company-yasnippet.el +++ b/company-yasnippet.el @@ -67,6 +67,8 @@ ;; matches, so the longest prefix with any matches should be the most useful. (cl-loop with tables = (yas--get-snippet-tables) for key-prefix in (company-yasnippet--key-prefixes) + ;; Only consider keys at least as long as the symbol at point. + when (>= (length key-prefix) (length prefix)) thereis (company-yasnippet--completions-for-prefix prefix key-prefix tables))) @@ -87,12 +89,8 @@ (propertize key 'yas-annotation name 'yas-template template - 'yas-prefix-offset - (let ((pl (length prefix)) - (kpl (length key-prefix))) - (if (> kpl pl) - (- kpl pl) - 0))) + 'yas-prefix-offset (- (length key-prefix) + (length prefix))) res)) value))) keyhash))