- (setq company-eclim--doc
- (cdr (assoc 'completions
- (company-eclim--call-process
- "java_complete" "-p" (company-eclim--project-name)
- "-f" project-file
- "-o" (number-to-string (1- (point)))
- "-e" "utf-8"
- "-l" "standard")))))
- (let ((completion-ignore-case nil))
- ;; TODO: Handle overloaded methods somehow. Show one candidate per overload?
- ;; That would look nice, but kinda useless: a bunch of candidates for the
- ;; same completion. Maybe do expansion like `company-clang-objc-templatify'.
- (all-completions prefix (mapcar (lambda (item) (cdr (assoc 'completion item)))
- company-eclim--doc))))
+ (dolist (item (cdr (assoc 'completions
+ (company-eclim--call-process
+ "java_complete" "-p" (company-eclim--project-name)
+ "-f" project-file
+ "-o" (number-to-string
+ (company-eclim--search-point prefix))
+ "-e" "utf-8"
+ "-l" "standard"))))
+ (let* ((meta (cdr (assoc 'info item)))
+ (completion meta))
+ (when (string-match " ?[(:-]" completion)
+ (setq completion (substring completion 0 (match-beginning 0))))
+ (put-text-property 0 1 'meta meta completion)
+ (push completion completions)))
+ (let ((completion-ignore-case nil))
+ (all-completions prefix completions))))
+
+(defun company-eclim--search-point (prefix)
+ (if (or (cl-plusp (length prefix)) (eq (char-before) ?.))
+ (1- (point))
+ (point)))