-
-
Notifications
You must be signed in to change notification settings - Fork 338
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
counsel-at-point for generic completion at point #331
Comments
Thanks, I'll work on this in the future. I've been meaning to write a |
Glad to hear it! Closing the issue for now. |
* ivy.el (ivy-completion-beg): Rename from `counsel-completion-beg'. (ivy-completion-end): Rename from `counsel-completion-end'. (ivy-completion-in-region-action): Rename from `counsel--el-action'. (ivy-completion-in-region): New defun. (ivy-mode): Set `completing-read-function' to 'ivy-completion-in-region. * counsel.el: Update due to renames. Fixes #331
OK, So However, I haven't yet figured out how to hook e.g. |
Oh, that is great news, thank you! I do not know how jedi is usually integrated with complenion systems. Maybe company and autocomplete implementations could help. Both seems to use jedi-core as a basis. Maybe you have seen all of this already. |
Yes, by looking at the sources, you are already aware of it! ^^ |
What do you think about |
@s-kostyaev Have a look. |
@abo-abo Thanks. Looks good. Can you also add action for showing docs for candidates? I don't know how it works in company, but |
@abo-abo for me very useful something like this: (defun counsel-company ()
"Complete using `company-candidates'."
(interactive)
(unless company-candidates
(company-complete))
(when company-point
(company-complete-common)
(when (looking-back company-common (line-beginning-position))
(setq ivy-completion-beg (match-beginning 0))
(setq ivy-completion-end (match-end 0)))
(ivy-read "company cand: " (mapcar (lambda (x)
(concat
x
"\t\t"
(company-call-backend 'annotation x)))
company-candidates)
:action (lambda (x)
(ivy-completion-in-region-action
(replace-regexp-in-string "\t\t\.*" "" x))
(run-at-time 0.01 nil 'company-pseudo-tooltip-hide))))) But I think that annotation should have another face. May be need some defcustom for customize that. |
I think adding annotations (with correct face) must be done by transformer, but my transformer does not work for now: (defun counsel-company-transformer (str)
"Add highlighted annotation into STR."
(let ((annotation (company-call-backend 'annotation str))
(set-text-properties 1 (length annotation) '(face success) annotation)
(concat str "\t\t" annotation))))
(ivy-set-display-transformer 'counsel-company 'counsel-company-transformer) |
@s-kostyaev Could you please open a new issue with the above two code snippets? I don't have time right now to deal with them, but I don't want to forget about it. An open issue helps to track it, but I don't want to re-open this one. |
@abo-abo done. |
@s-kostyaev Where is the new issue you opened about showing docs with |
I reconstituted these snippets from your dotfiles. Are these right?
And maybe as well
Such snippets could either be added to the wiki or the readme snippet. But what would be really great would be a generic completion method, like ido-at-point, which would complete symbol at point with ivy using built-in completion system or the counsel-* completions functions if dependencies are available.
It may not require much changes to this package, since using it and re-defining this function worked for me:
ivy-completing-read
worked as well.Thank you for your attention and awesome completion system!
[EDIT] Oh, and no hurry of course, this is a suggestion and not a request!
The text was updated successfully, but these errors were encountered: