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
How to wrap long lines of tooltip #1040
Comments
|
Hi! Wrap how? The best we could do for this particular case, I guess, is to only treat the last path segment as "prefix". |
|
How to setup up ignore the prefix you mentioned to show the next part of path? Current setup shows each file/directory in a line, if it's too long I don't know which line is the correct one to complete. Wrapping means show the each line in two lines to show the whole path. Thanks! |
|
@dgutov For example, if the file path I need is: Can I setup to just show "dir_scz.145.sub.1e-6.5e5.bed.fmt_generic_disTRUE_max20_ws1e6" when I try to auto complete at "~/fs0/subgwas/scz/145loci/gibbs_result/" or can it is shown as: ~/fs0/subgwas/scz/145loci/gibbs_result/dir_scz.145.sub.1e-6.5e5.bed.fmt_generic so that I can know which selection is right. I have searched for so many times and don't identify a way to workaround. Please give me some advice. Thanks! |
|
There's no existing option, it will be a change in the implementation. For instance, like this: diff --git a/company-files.el b/company-files.el
index 8859266..a6339d0 100644
--- a/company-files.el
+++ b/company-files.el
@@ -98,15 +98,15 @@ The values should use the same format as `completion-ignored-extensions'."
(defvar company-files--completion-cache nil)
(defun company-files--complete (prefix)
- (let* ((dir (file-name-directory prefix))
- (file (file-name-nondirectory prefix))
+ (let* ((dir (file-name-directory
+ (company-files--grab-existing-name)))
+ (file prefix)
(key (list file
(expand-file-name dir)
(nth 5 (file-attributes dir))))
(completion-ignore-case read-file-name-completion-ignore-case))
(unless (company-file--keys-match-p key (car company-files--completion-cache))
- (let* ((candidates (mapcar (lambda (f) (concat dir f))
- (company-files--directory-files dir file)))
+ (let* ((candidates (company-files--directory-files dir file))
(directories (unless (file-remote-p dir)
(cl-remove-if-not (lambda (f)
(and (company-files--trailing-slash-p f)
@@ -116,7 +116,9 @@ The values should use the same format as `completion-ignored-extensions'."
(children (and directories
(cl-mapcan (lambda (d)
(mapcar (lambda (c) (concat d c))
- (company-files--directory-files d "")))
+ (company-files--directory-files
+ (concat dir d)
+ "")))
directories))))
(setq company-files--completion-cache
(cons key (append candidates children)))))
@@ -139,7 +141,7 @@ File paths with spaces are only supported inside strings."
(interactive (list 'interactive))
(cl-case command
(interactive (company-begin-backend 'company-files))
- (prefix (company-files--grab-existing-name))
+ (prefix (file-name-nondirectory (company-files--grab-existing-name)))
(candidates (company-files--complete arg))
(location (cons (dired-noselect
(file-name-directory (directory-file-name arg))) 1))I'm tempted to push this, but it does call |
|
Happy holidays! Just have several days off! Thanks for your reply! I just merge the changes to the company-files.el in my installed dir but no wrapping or no ignoring of prefix. Am I doing something wrong? Thanks! |
|
Let's see. What does (And happy holidays!) |
|
Okay, that looks legit. Did you apply the patch? And re-evaluated the definitions? Or restarted Emacs? |
There are roughly three options:
|
|
After some testing, there are a couple of problems with this patch (in particular, seeing the A better solution is in the works. |
|
Thanks for the remind! The current patch is enought for me! Looking forward to the perfect solution. 👍 |
|
Let's keep this open in the meantime. 👍 |
|
Sure! I hope I can help but I am still learning lisp. |
|
Hi, is there any update about this issue? Has it been pushed to the main so that this works instantly after installation without patching? Thanks! |
|
Not yet, but thanks for the bump. |
|
Pushed after some more tweaking. Let me know if you see any problems. |
|
Thanks very much! Will try :) Can't believe you are still monitoring! |




Thanks for the great plugin!
I use company to auto complete file path. However, it's usually very long and the lines appearing in the tooltip doesn't wrap so very hard to select the right choice. Is it possbile to wrap the lines? Please advice. Thanks!
The text was updated successfully, but these errors were encountered: