0

Company-mode completion seems a little weak in emacs. Is it my configuration?

Property completion seems simple enough:

strong {
  color: red;  /* <= color is the property */
}

Where red is the value in above, value completion is seemingly entirely absent? Comparatively, browser console gives every possible completion for a css value in the dropdown, while company-css suggests nothing?

Am I missing a backend? I'm using company-css and company-capf?

Does anyone have any suggested configuration for working css value completion in company?

Thanks

1 Answer 1

0

That's odd, both company-css (which you shouldn't use anymore if your Emacs version is 26 or newer) and company-capf offer red as the value completion in this example on my machine.

You might want to try M-x company-diag to verify which backend is actually being used.

CSS completion in Emacs is not perfect and won't reach the completeness of a browser, but it does offer completion for a lot of CSS property values.

8
  • I'm okay with company, it would be better with a more complete css backend. Describe-variable company-backends gives (company-css company-dabbrev company-capf company-dabbrev-code), for my scss and css modes. What backend would you recommend? Sep 1, 2020 at 23:42
  • I recommend company-capf. And not putting company-dabbrev in front of it.
    – Dmitry
    Sep 2, 2020 at 9:28
  • Okay, thanks. Is it possible to copy completion options from the browser console and paste them into company-css somewhere? I'm looking to get company to offer completion in css/scss after the first semi-colon after the first letter typed (set to 3 characters by default) with a dropdown of all possible completions for each css property. In my work flow, I'm usually googling properties to remember completion options, would be much much quicker to get a dropdown in that case. Seems it should not be difficult to achieve with emacs? Sep 2, 2020 at 14:09
  • 1
    After the colon, you mean? It should work already. Try it with the default value of company-backends. And for "after the first letter", customize company-minimum-prefix-length.
    – Dmitry
    Sep 2, 2020 at 21:24
  • As grateful as I am to David A. Moon for coming up with Emacs, the scss/css completion could be working smarter. Default backend settings or not, no company dropdown suggestions after position:, align-self:, align-items:, grid-template-columns: (which doesn't appear in any dropdown anyway), grid-row, etc. Company-mode, on the other hand, is totally great. Do you know how to add completion suggestion data to the company-css backend manually? Sep 3, 2020 at 17:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.