summaryrefslogtreecommitdiff
path: root/helm-semantic.el
diff options
context:
space:
mode:
authorTu Do <tu.h.do@dektech.com.au>2015-03-19 12:34:18 +0700
committerTu Do <tu.h.do@dektech.com.au>2015-03-19 12:34:18 +0700
commitd85a1e987ba5bb4ad68fa7d14193524c990f8de3 (patch)
treea0df4693a0f0528fad1aebd3f34245d4e6ebe7de /helm-semantic.el
parenta52776661c453d6723c9f22e84de9b1060574c4e (diff)
[Fix #929] Improve helm-semantic interface
- Add a custom variable helm-semantic-display-style that allows user to choose between two display style: the default (the current style) and a more concise style, semantic-format-tag-prototype that omits all the information about a tag (i.e. no "Function: " or "Variable: " is appended in each entry). - Remove "Class" in format string to reduce the verbosity. Instead, only show the parent name next to current tag. - Don't create a candidate for function parameters. User would be faster to jump to a function and navigate to the function parameter.
Diffstat (limited to 'helm-semantic.el')
-rw-r--r--helm-semantic.el18
1 files changed, 13 insertions, 5 deletions
diff --git a/helm-semantic.el b/helm-semantic.el
index 05b8880c..8fb8eded 100644
--- a/helm-semantic.el
+++ b/helm-semantic.el
@@ -50,6 +50,13 @@
;; Internals vars
(defvar helm-semantic--tags-cache nil)
+(defcustom helm-semantic-display-style 'semantic-format-tag-summarize
+ "Function to present a semantic tag."
+ :group 'helm-semantic
+ :type '(radio
+ (const :tag "Default" semantic-format-tag-summarize)
+ (const :tag "Prototype" semantic-format-tag-prototype)))
+
(defun helm-semantic--fetch-candidates (tags depth &optional class)
"Write the contents of TAGS to the current buffer."
(let ((class class) cur-type)
@@ -63,22 +70,23 @@
(setq class nil))
(insert
(if (and class (not type-p))
- (format "%s%sClass(%s) "
+ (format "%s%s(%s) "
spaces (if (< depth 2) "" "├►") class)
spaces)
;; Save the tag for later
- (propertize (semantic-format-tag-summarize tag nil t)
+ (propertize (funcall helm-semantic-display-style tag nil t)
'semantic-tag tag)
"\n")
(and type-p (setq class (car tag)))
;; Recurse to children
- (helm-semantic--fetch-candidates
- (semantic-tag-components tag) (1+ depth) class)))
+ (unless (eq cur-type 'function)
+ (helm-semantic--fetch-candidates
+ (semantic-tag-components tag) (1+ depth) class))))
;; Don't do anything with packages or includes for now
((package include)
(insert
- (propertize (semantic-format-tag-summarize tag nil t)
+ (propertize (funcall helm-semantic-display-style tag nil t)
'semantic-tag tag)
"\n")
)