X-Git-Url: https://code.delx.au/gnu-emacs-elpa/blobdiff_plain/cd69d7b3ad6f7594c599a27da9c3a21c47622fe4..e52579348d8529b0cff08a1f0a676cb0cc6f61c3:/company-semantic.el diff --git a/company-semantic.el b/company-semantic.el index 27522da5d..8b13b72c6 100644 --- a/company-semantic.el +++ b/company-semantic.el @@ -26,6 +26,7 @@ ;;; Code: (require 'company) +(require 'company-template) (require 'cl-lib) (defvar semantic-idle-summary-function) @@ -57,6 +58,11 @@ If `company-begin-commands' is a list, it should include `c-electric-lt-gt' and `c-electric-colon', for automatic completion right after \">\" and \":\".") +(defcustom company-semantic-insert-arguments t + "When non-nil, insert function arguments as a template after completion." + :type 'boolean + :package-version '(company . "0.9.0")) + (defvar company-semantic-modes '(c-mode c++-mode jde-mode java-mode)) (defvar-local company-semantic--current-tags nil @@ -149,7 +155,13 @@ and `c-electric-colon', for automatic completion right after \">\" and (location (let ((tag (assoc arg company-semantic--current-tags))) (when (buffer-live-p (semantic-tag-buffer tag)) (cons (semantic-tag-buffer tag) - (semantic-tag-start tag))))))) + (semantic-tag-start tag))))) + (post-completion (let ((anno (company-semantic-annotation + arg company-semantic--current-tags))) + (when (and company-semantic-insert-arguments anno) + (insert anno) + (company-template-c-like-templatify (concat arg anno))) + )))) (provide 'company-semantic) ;;; company-semantic.el ends here