company-mode / company-mode

Modular in-buffer completion framework for Emacs
http://company-mode.github.io/
GNU General Public License v3.0
2.21k stars 228 forks source link

can support case sensitive candidate ? #569

Closed ChinaXing closed 5 years ago

ChinaXing commented 8 years ago

I saw the candidate list popup was case insensitive , IN camel case, the case is important:

for example : connectToStores hopes match case-sensitive, if not, when choose the item, I will need to correct it . that's not fine !

dgutov commented 8 years ago

I have no idea what you're trying to say.

Try a screencast maybe.

ChinaXing commented 8 years ago

2016-08-24 12 18 27

InstanceCfgActions was lowerCase in dropdown as : Instancecfgactions

dgutov commented 8 years ago

What major mode is this?

ChinaXing commented 8 years ago

web-mode

dgutov commented 8 years ago

web-mode will either have to inherit from prog-mode properly, or you should add it to company-dabbrev-code-modes.

dgutov commented 8 years ago

Also see https://github.com/company-mode/company-mode/issues/14.

sidmitra commented 7 years ago

I have the same issue. I'd added

(add-to-list 'company-dabbrev-code-modes 'web-mode)

I get this error

Symbol's value as variable is void: company-dabbrev-code-modes

Here's my full company mode config

(use-package company
  :ensure t
  :config
  (add-hook 'after-init-hook 'global-company-mode)
  ;; weight by frequency
  (setq company-transformers '(company-sort-by-occurrence))
  ;; delay in seconds before the pop-up appears
  (setq company-idle-delay 0.1)
  ;; you only need to enter one character in a buffer before auto-completion starts
  (setq company-minimum-prefix-length 1)

  ;; Add yasnippet support for all company backends
  ;; https://github.com/syl20bnr/spacemacs/pull/179
  (defvar company-mode/enable-yas t "Enable yasnippet for all backends.")
  (defun company-mode/backend-with-yas (backend)
  (if (or (not company-mode/enable-yas) (and (listp backend)    (member 'company-yasnippet backend)))
      backend
    (append (if (consp backend) backend (list backend))
            '(:with company-yasnippet))))

  ;; fix lowercase options in autocomplete
  ;; https://github.com/company-mode/company-mode/issues/14
  (add-to-list 'company-dabbrev-code-modes 'web-mode)
  )
dgutov commented 7 years ago

@sidmitra If you're using use-package, do that in a :config form. Otherwise, use eval-after-load.

sidmitra commented 7 years ago

@dgutov Thanks for the quick reply.

I did add (add-to-list 'company-dabbrev-code-modes 'web-mode) in the config section of use package(see my comment above). The error just becomes

Error (use-package): company :config: Symbol’s value as variable is void: company-dabbrev-code-modes

dgutov commented 7 years ago

@sidmitra Then I have no further suggestions. I don't use use-package myself. Try using any of their support channels.

ChinaXing commented 7 years ago

add the settings under web-mode-hook, it works for me, as following :

(defun my-web-mode-hook ()

(require 'react-snippets)

(add-to-list 'company-dabbrev-code-modes 'web-mode)

2017-02-16 6:41 GMT+08:00 Dmitry Gutov notifications@github.com:

@sidmitra https://github.com/sidmitra Then I have no further suggestions. I don't use use-package myself. Try using any of their support channels.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/company-mode/company-mode/issues/569#issuecomment-280164312, or mute the thread https://github.com/notifications/unsubscribe-auth/ABjXzZ9mBGDUr9kiKq_b464_kx_1VvKwks5rc382gaJpZM4JrByi .

--

Best Regards !

陈云星 Tel : 1866122992

haskelcurry commented 6 years ago

Hi! @sidmitra @ChinaXing I have exactly the same issue. And I'm using use-package too. Have you managed to solve this somehow? I have tried to add this into web-mode-hook, but it doesn't help either:

(use-package web-mode
  :ensure t
  :config
  (add-hook 'web-mode-hook
        (lambda () (add-to-list 'company-dabbrev-code-modes 'web-mode)))
  (add-to-list 'auto-mode-alist '("\\.html?\\'" . web-mode)))

Please help!