Skip to content


Subversion checkout URL

You can clone with
Download ZIP


semantic: Use yasnippet to complete a function with argument placeholders #133

wants to merge 1 commit into from

4 participants


Whenever yasnippet is available, completing a function with the semantic backend will produce a snippet with argument placeholders to streamline the completion process.




Thanks for the pull request. I am splitting the semantic support into a separate package hosted by this organization, and will merge your pull request in there.

I'm very interested in closer integration between yasnippet and AC; you might be interested in the following issue at yas capitaomorte/yasnippet#295


Hmmm, thx for the interesting link to yasnippet, I'll be watching it.

Well, and thx for the merge, of course :) Just tell me if you want me to open a pull request against any other repo.

@monsanto monsanto was assigned


@tkf tkf referenced this pull request

1.4 release #219

@monsanto monsanto was unassigned by llvilanova

Merged with some fixes. Thanks!

@m2ym m2ym closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 3, 2013
  1. @llvilanova
This page is out of date. Refresh to see the latest.
Showing with 24 additions and 0 deletions.
  1. +24 −0 auto-complete-config.el
24 auto-complete-config.el
@@ -193,11 +193,34 @@
(setq res (concat res "\n\n" doc)))
+(defun ac-semantic-action ()
+ (when (and (boundp 'yas/minor-mode) yas/minor-mode)
+ (let* ((tag (car (last (oref (semantic-analyze-current-context) prefix))))
+ (class (semantic-tag-class tag))
+ (args))
+ (when (eq class 'function)
+ (setq args (semantic-tag-function-arguments tag))
+ (yas/expand-snippet
+ (concat "("
+ (mapconcat
+ (lambda (arg)
+ (let ((arg-type (semantic-format-tag-type arg nil))
+ (arg-name (semantic-format-tag-name arg nil)))
+ (concat "${"
+ (if (string= arg-name "")
+ arg-type
+ (concat arg-type " " arg-name))
+ "}")))
+ args
+ ", ")
+ ")$0"))))))
(ac-define-source semantic
'((available . (or (require 'semantic-ia nil t)
(require 'semantic/ia nil t)))
(candidates . (ac-semantic-candidates ac-prefix))
(document . ac-semantic-doc)
+ (action . ac-semantic-action)
(prefix . cc-member)
(requires . 0)
(symbol . "m")))
@@ -207,6 +230,7 @@
(require 'semantic/ia nil t)))
(candidates . (ac-semantic-candidates ac-prefix))
(document . ac-semantic-doc)
+ (action . ac-semantic-action)
(symbol . "s")))
;; eclim
Something went wrong with that request. Please try again.