redguardtoo / company-ctags

Fastest Emacs auto-completion using Company and Ctags
GNU General Public License v3.0
56 stars 3 forks source link

Completion doesn't work if first character is wrong case #12

Closed Trisk3lion closed 3 years ago

Trisk3lion commented 3 years ago

Hello, thanks for a very nice package!

I write COBOL and use a function on save which upcases everything when i save which means all my potential candidates are up-cased., but when i type its all lowercase.

Naturally I then have (setq company-ctags-ignore-case t), but I have noticed that it doesn't matter if the first character in the string is the wrong case. So if I have a completion candidate that is "N-FINISH" and i have start to type "n-f", nothing will show. On the other hand, "N-f" and "N-F" both works just fine.

My elisp is not particular good, but my theory is that the problem lies in company-ctags-all-candidates, more specifically:

 (let* ((c (elt prefix 0))
           (arr (gethash c tagname-dict)))
      (company-ctags-all-completions prefix arr)))))

(elt prefix 0) returns different values for "n-f" and "N-f", but the same value for "N-F" and "N-f". I don't really understand yet from the code how the has-tables are constructed thou.

Could it be thats the problem? and Then maybe we could upcase/downcase first charcter in prefix.

redguardtoo commented 3 years ago

26f0a90 fixed: Completion doesn't work if first character is wrong case #12 (Chen Bin)

Trisk3lion commented 3 years ago

Works great now! Thanks @redguardtoo!