Open ddovod opened 8 years ago
Yes currently I use string<
to sort. SomeClass.h
and SomeClass.cpp
usually stick together and a single M-n will get you to the right choice. I don't want to complicate the sorting function for now. It's hard to come up with a general rule for sorting.
Ok, thank you for response! Maybe you can implement the ability to set custom comparator for sorting algo which can be set manually? So anybody would have instrument to tweak behavior a bit without bloody patching of original code?
I have no many experience in elisp, but I can try to implement such thing and create a PR, don't you mind?
I can defvar
a some kind of post completion hook and I'll hand you all the candidates. You can do reordering or filtering or whatever you want. Does this look good to you?
Yes, sounds good!
I added a post completion hook and tried to reverse the list myself. It worked on my side. But after I returned those results to company, looks like company has sorted them again. I wonder if there anything on company side that prevents me from specifying a specific order.
company.el:
(defun company--preprocess-candidates (candidates)
(cl-assert (cl-every #'stringp candidates))
(unless (company-call-backend 'sorted)
(setq candidates (sort candidates 'string<)))
(when (company-call-backend 'duplicates)
(company--strip-duplicates candidates))
candidates)
Maybe I should create issue in the company-mode github repo = ( But your addition will be helpful no matter what. Thank you again!
Strangely I already set 'sorted
to t
, but it's still doing a sort for me somehow.
Hello. Assume we have some files: SomeClass.h SomeClass.cpp main.cpp
I would like to unclude SomeClass.h into main.cpp, so: main.cpp:
include "Some|
First candidate is .cpp file, but in 99% cases I would like to include .h, .hpp, .inl and other files, but not .cpp. I think this is due to 'sort' function, and 'c' is smaller than 'h', right? Is there any way to customize sorting behavior? Thank you a lot!